From e8432c8baa8f78242e8725b14421bea35b1a1a1b Mon Sep 17 00:00:00 2001 From: Alec Kagebein Date: Fri, 4 Oct 2024 13:48:17 -0500 Subject: [PATCH] Required changes for .rubocop.yml to work --- .rubocop.yml | 19 +- .rubocop_todo.yml | 576 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 591 insertions(+), 4 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 82e04ba6f..9693b677e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,10 +1,13 @@ +inherit_from: .rubocop_todo.yml + +require: + - rubocop-performance + - rubocop-rails + - .rubocop/custom_cop/top_level_constants_per_file.rb + AllCops: TargetRubyVersion: 2.5 TargetRailsVersion: 5.1 - Include: - - '**/config.ru' - - '**/Rakefile' - - '**/*.rake' Exclude: - 'bin/**/*' - 'db/**/*' @@ -62,3 +65,11 @@ Style/TrailingCommaInArrayLiteral: Style/TrailingCommaInHashLiteral: Enabled: false + +CustomCop/TopLevelConstantsPerFile: + Enabled: true + Include: + - 'app/**/*' + - 'lib/**/*' + Exclude: + - '**/*[^.rb]' # exclude non-.rb files (ex: .rake files) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..c046b807c --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,576 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-10-04 13:43:11 -0500 using RuboCop version 0.83.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'app/services/manifest_fetcher.rb' + - 'app/services/record_fetcher.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ClosingHeredocIndentation: + Exclude: + - 'spec/services/pdf_service_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ClosingParenthesisIndentation: + Exclude: + - 'spec/initializers/deprecation_warning_subscriber_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/CommentIndentation: + Exclude: + - 'spec/features/help_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ElseAlignment: + Exclude: + - 'spec/features/user_error_flows_spec.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'app/controllers/api/v2/manifests_controller.rb' + - 'app/controllers/api/v2/records_controller.rb' + - 'app/controllers/sessions_controller.rb' + - 'app/helpers/application_helper.rb' + - 'app/models/manifest.rb' + - 'app/models/manifest_source.rb' + - 'app/services/external_api/bgs_service.rb' + - 'app/services/manifest_fetcher.rb' + - 'lib/fakes/bgs_service.rb' + - 'lib/fakes/document_service.rb' + - 'spec/support/download_helper.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'app/services/manifest_fetcher.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/EmptyLines: + Exclude: + - 'app/services/external_api/bgs_service.rb' + - 'app/services/manifest_fetcher.rb' + - 'lib/fakes/test_auth_strategy.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: around, only_before +Layout/EmptyLinesAroundAccessModifier: + Exclude: + - 'app/controllers/health_checks_controller.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'app/controllers/health_checks_controller.rb' + - 'app/services/record_api_fetcher.rb' + - 'app/services/record_fetcher.rb' + - 'app/services/record_fetcher_base.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. +# SupportedStylesAlignWith: keyword, variable, start_of_line +Layout/EndAlignment: + Exclude: + - 'spec/features/user_error_flows_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses +Layout/FirstArgumentIndentation: + Exclude: + - 'spec/initializers/deprecation_warning_subscriber_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/FirstHashElementIndentation: + EnforcedStyle: consistent + +# Offense count: 27 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'spec/requests/api/v2/manifests_spec.rb' + - 'spec/services/bgs_service_spec.rb' + - 'spec/services/user_authorizer_spec.rb' + - 'spec/services/veteran_finder_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'spec/features/user_error_flows_spec.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +Layout/LeadingCommentSpace: + Exclude: + - 'Gemfile' + - 'ci-bin/concatenate-log.rb' + - 'spec/rails_helper.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/LeadingEmptyLines: + Exclude: + - 'app/services/external_api/vbms_service.rb' + - 'lib/fakes/bgs_service.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Exclude: + - 'spec/controllers/api_v2_application_controller_spec.rb' + - 'spec/helpers/application_helper_spec.rb' + - 'spec/services/external_api/vbms_service_spec.rb' + +# Offense count: 38 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'spec/services/bgs_service_spec.rb' + - 'spec/services/user_authorizer_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'spec/services/manifest_fetcher_spec.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'spec/features/backend_error_flows_spec.rb' + - 'spec/features/react_download_spec.rb' + - 'spec/jobs/v2/download_manifest_job_spec.rb' + - 'spec/requests/api/v2/document_counts_spec.rb' + - 'spec/requests/api/v2/manifests_spec.rb' + - 'spec/services/document_counter_spec.rb' + - 'spec/services/manifest_fetcher_spec.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'spec/services/document_creator_spec.rb' + - 'spec/services/manifest_fetcher_spec.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'spec/services/bgs_service_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - '.simplecov' + - 'app/services/metrics_service.rb' + - 'spec/services/manifest_fetcher_spec.rb' + +# Offense count: 31 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'app/services/external_api/vbms_service.rb' + - 'app/services/manifest_fetcher.rb' + - 'app/services/record_fetcher.rb' + - 'spec/controllers/sessions_controller_spec.rb' + - 'spec/jobs/v2/download_manifest_job_spec.rb' + - 'spec/services/document_creator_spec.rb' + - 'spec/services/manifest_fetcher_spec.rb' + - 'spec/services/user_authorizer_spec.rb' + - 'spec/support/capybara.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/AmbiguousRegexpLiteral: + Exclude: + - 'spec/requests/sso_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/DeprecatedClassMethods: + Exclude: + - 'spec/services/zipfile_creator_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/EnsureReturn: + Exclude: + - 'app/services/manifest_fetcher.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Lint/NonDeterministicRequireOrder: + Exclude: + - 'Rakefile' + - 'spec/rails_helper.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Lint/RedundantCopDisableDirective: + Exclude: + - 'app/helpers/application_helper.rb' + - 'app/services/metrics_service.rb' + - 'spec/features/help_spec.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'app/services/metrics_service.rb' + - 'lib/fakes/bgs_service.rb' + - 'lib/fakes/document_service.rb' + - 'spec/requests/sso_spec.rb' + +# Offense count: 1 +Lint/UselessAssignment: + Exclude: + - 'app/services/manifest_fetcher.rb' + +# Offense count: 2 +# Configuration parameters: IgnoredMethods. +Metrics/AbcSize: + Max: 65 + +# Offense count: 4 +# Configuration parameters: IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 15 + +# Offense count: 3 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/MethodLength: + Max: 32 + +# Offense count: 4 +# Configuration parameters: IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 15 + +# Offense count: 1 +# Configuration parameters: IgnoredPatterns. +# SupportedStyles: snake_case, camelCase +Naming/MethodName: + EnforcedStyle: snake_case + +# Offense count: 4 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp +Naming/MethodParameterName: + Exclude: + - 'app/services/zipfile_creator.rb' + - 'lib/fakes/bgs_service.rb' + - 'lib/fakes/document_service.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: PreferredName. +Naming/RescuedExceptionsVariableName: + Exclude: + - 'app/controllers/sessions_controller.rb' + - 'app/jobs/middleware/job_metrics_service_metric_middleware.rb' + - 'app/jobs/v2/download_manifest_job.rb' + - 'app/jobs/v2/package_files_job.rb' + - 'app/services/external_api/bgs_service.rb' + - 'app/services/manifest_fetcher.rb' + - 'app/services/metrics_service.rb' + - 'app/services/record_api_fetcher.rb' + - 'app/services/record_fetcher.rb' + - 'app/services/user_authorizer.rb' + - 'lib/efolder/migration.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Performance/Count: + Exclude: + - 'app/models/manifest.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Performance/RegexpMatch: + Exclude: + - 'app/services/external_api/bgs_service.rb' + - 'lib/tasks/symlink_assets.rake' + +# Offense count: 1 +# Cop supports --auto-correct. +Rails/ApplicationController: + Exclude: + - 'app/controllers/base_controller.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Rails/ApplicationJob: + Exclude: + - 'app/jobs/fakes/download_files_job.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. +Rails/Blank: + Exclude: + - 'app/controllers/sessions_controller.rb' + - 'lib/fakes/bgs_service.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: numeric, symbolic +Rails/HttpStatus: + Exclude: + - 'app/controllers/api/v1/application_controller.rb' + - 'app/controllers/api/v2/application_controller.rb' + - 'app/controllers/api/v2/records_controller.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Rails/Presence: + Exclude: + - 'app/services/external_api/bgs_service.rb' + - 'app/services/user_authorizer.rb' + - 'app/services/veteran_finder.rb' + - 'lib/fakes/bgs_service.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank. +Rails/Present: + Exclude: + - 'app/services/pdf_service.rb' + +# Offense count: 3 +# Configuration parameters: Include. +# Include: **/Rakefile, **/*.rake +Rails/RakeEnvironment: + Exclude: + - 'lib/capistrano/tasks/**/*.rake' + - 'lib/tasks/bundle_javascript.rake' + - 'lib/tasks/lint.rake' + - 'lib/tasks/symlink_assets.rake' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/UniqueValidationWithoutIndex: + Exclude: + - 'app/models/manifest_source.rb' + +# Offense count: 1 +Security/Open: + Exclude: + - 'app/jobs/touch_file_job.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'app/services/manifest_fetcher.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'app/controllers/sessions_controller.rb' + - 'app/controllers/test_controller.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'spec/rails_helper.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + Exclude: + - 'app/services/zipfile_creator.rb' + +# Offense count: 38 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Exclude: + - 'spec/services/bgs_service_spec.rb' + - 'spec/services/user_authorizer_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - '.simplecov' + - 'app/controllers/application_controller.rb' + - 'app/models/user.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: line_count_dependent, lambda, literal +Style/Lambda: + Exclude: + - 'spec/jobs/application_job_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedOctalStyle. +# SupportedOctalStyles: zero_with_o, zero_only +Style/NumericLiteralPrefix: + Exclude: + - 'spec/services/user_authorizer_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, exploded +Style/RaiseArgs: + Exclude: + - 'spec/controllers/api_v2_application_controller_spec.rb' + - 'spec/features/backend_error_flows_spec.rb' + - 'spec/features/user_error_flows_spec.rb' + - 'spec/requests/api/v2/manifests_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'app/services/manifest_fetcher.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantCondition: + Exclude: + - 'app/services/external_api/bgs_service.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantInterpolation: + Exclude: + - 'spec/support/fake_saml_idp.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'app/controllers/api/v2/document_counts_controller.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Exclude: + - 'spec/requests/sso_spec.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: only_raise, only_fail, semantic +Style/SignalException: + Exclude: + - 'app/controllers/sessions_controller.rb' + - 'app/models/css_authentication_session.rb' + - 'app/services/external_api/bgs_service.rb' + - 'app/services/manifest_fetcher.rb' + - 'lib/fakes/bgs_service.rb' + +# Offense count: 37 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'app/controllers/api/v2/files_downloads_controller.rb' + - 'app/controllers/application_controller.rb' + - 'app/controllers/test_controller.rb' + - 'app/jobs/touch_file_job.rb' + - 'app/services/external_api/bgs_service.rb' + - 'app/services/record_fetcher.rb' + - 'app/services/record_fetcher_base.rb' + - 'spec/controllers/api_v2_application_controller_spec.rb' + - 'spec/features/active_job_spec.rb' + - 'spec/requests/sso_spec.rb' + - 'spec/support/capybara.rb' + - 'spec/support/fake_saml_idp.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'app/models/css_authentication_session.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/WhileUntilDo: + Exclude: + - 'spec/support/download_helper.rb'