summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo.yml632
-rw-r--r--Gemfile5
-rw-r--r--Gemfile.lock28
-rw-r--r--rubocop/cop/gitlab/finder_with_find_by.rb4
4 files changed, 505 insertions, 164 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 77ad4753c84..e9051bd41da 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,42 +1,180 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2018-01-18 18:23:26 +0100 using RuboCop version 0.52.1.
+# on 2019-05-02 07:38:39 -0700 using RuboCop version 0.68.1.
# 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: 181
+# Offense count: 264
+# Cop supports --auto-correct.
Capybara/CurrentPathExpectation:
Enabled: false
-# Offense count: 167
+# Offense count: 979
# Cop supports --auto-correct.
-Layout/EmptyLinesAroundArguments:
+FactoryBot/AttributeDefinedStatically:
Enabled: false
-# Offense count: 83
+# Offense count: 18
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: create_list, n_times
+FactoryBot/CreateList:
+ Exclude:
+ - 'ee/spec/lib/ee/gitlab/auth/ldap/sync/groups_spec.rb'
+ - 'ee/spec/models/license_spec.rb'
+ - 'spec/controllers/autocomplete_controller_spec.rb'
+ - 'spec/features/boards/boards_spec.rb'
+ - 'spec/features/instance_statistics/cohorts_spec.rb'
+ - 'spec/features/issuables/issuable_list_spec.rb'
+ - 'spec/finders/issues_finder_spec.rb'
+ - 'spec/models/concerns/each_batch_spec.rb'
+ - 'spec/models/concerns/issuable_spec.rb'
+ - 'spec/models/project_spec.rb'
+ - 'spec/models/trending_project_spec.rb'
+ - 'spec/requests/api/jobs_spec.rb'
+ - 'spec/requests/api/pipelines_spec.rb'
+
+# Offense count: 1096
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, IndentationWidth.
+# SupportedStyles: with_first_argument, with_fixed_indentation
+Layout/AlignArguments:
+ Enabled: false
+
+# Offense count: 822
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
+# SupportedHashRocketStyles: key, separator, table
+# SupportedColonStyles: key, separator, table
+# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
+Layout/AlignHash:
+ Enabled: false
+
+# Offense count: 13
+# Cop supports --auto-correct.
+Layout/ClosingHeredocIndentation:
+ Exclude:
+ - 'app/graphql/mutations/merge_requests/set_wip.rb'
+ - 'ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb'
+ - 'ee/db/migrate/20160204190809_update_jenkins_service_category.rb'
+ - 'ee/lib/gitlab/background_migration/prune_orphaned_geo_events.rb'
+ - 'ee/lib/gitlab/geo/health_check.rb'
+ - 'lib/gitlab/background_migration/populate_untracked_uploads.rb'
+ - 'qa/qa/service/kubernetes_cluster.rb'
+ - 'spec/features/merge_request/user_sees_diff_spec.rb'
+ - 'spec/lib/gitlab/asciidoc_spec.rb'
+ - 'spec/lib/gitlab/checks/project_moved_spec.rb'
+ - 'spec/rubocop/cop/active_record_association_reload_spec.rb'
+ - 'spec/services/task_list_toggle_service_spec.rb'
+
+# Offense count: 14
+# Cop supports --auto-correct.
+Layout/ClosingParenthesisIndentation:
+ Exclude:
+ - 'db/post_migrate/20180704145007_update_project_indexes.rb'
+ - 'ee/db/geo/migrate/20180405074130_add_partial_index_project_repository_verification.rb'
+ - 'ee/db/migrate/20180308234102_add_partial_index_to_project_repository_states_checksum_columns.rb'
+ - 'ee/db/post_migrate/20180605213516_fix_partial_index_to_project_repository_states_checksum_columns.rb'
+ - 'ee/lib/ee/gitlab/usage_data.rb'
+ - 'spec/services/issues/resolve_discussions_spec.rb'
+ - 'spec/services/projects/update_service_spec.rb'
+ - 'spec/support/helpers/stub_object_storage.rb'
+ - 'spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb'
+
+# Offense count: 2
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: leading, trailing
+Layout/DotPosition:
+ Exclude:
+ - 'app/models/concerns/relative_positioning.rb'
+ - 'app/models/group.rb'
+
+# Offense count: 69
+# Cop supports --auto-correct.
+Layout/EmptyLinesAroundArguments:
+ Exclude:
+ - 'app/models/concerns/discussion_on_diff.rb'
+ - 'app/models/concerns/resolvable_discussion.rb'
+ - 'app/models/diff_discussion.rb'
+ - 'app/models/discussion.rb'
+ - 'ee/app/helpers/license_helper.rb'
+ - 'ee/spec/models/geo/project_registry_spec.rb'
+ - 'lib/banzai/pipeline/broadcast_message_pipeline.rb'
+ - 'lib/banzai/pipeline/gfm_pipeline.rb'
+ - 'lib/banzai/pipeline/single_line_pipeline.rb'
+ - 'spec/features/markdown/copy_as_gfm_spec.rb'
+
+# Offense count: 158
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
-Layout/IndentArray:
+Layout/IndentFirstArrayElement:
Enabled: false
-# Offense count: 237
+# Offense count: 629
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
-Layout/IndentHash:
+Layout/IndentFirstHashElement:
+ Enabled: false
+
+# Offense count: 5
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, IndentationWidth.
+# SupportedStyles: consistent, align_parentheses
+Layout/IndentFirstParameter:
+ Exclude:
+ - 'app/models/ci/pipeline_schedule.rb'
+ - 'lib/gitlab/cross_project_access.rb'
+ - 'lib/gitlab/data_builder/push.rb'
+ - 'spec/support/helpers/repo_helpers.rb'
+ - 'spec/support/helpers/stub_object_storage.rb'
+
+# Offense count: 5
+# Cop supports --auto-correct.
+Layout/LeadingBlankLines:
+ Exclude:
+ - 'app/workers/update_project_statistics_worker.rb'
+ - 'db/migrate/20161007073613_create_user_activities.rb'
+ - 'ee/spec/helpers/boards_helper_spec.rb'
+ - 'lib/tasks/yarn.rake'
+ - 'spec/javascripts/fixtures/merge_requests_diffs.rb'
+
+# Offense count: 28
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle, IndentationWidth.
+# SupportedStyles: aligned, indented
+Layout/MultilineOperationIndentation:
Enabled: false
-# Offense count: 93
+# Offense count: 13
+# Cop supports --auto-correct.
+Layout/RescueEnsureAlignment:
+ Exclude:
+ - 'app/models/blob_viewer/dependency_manager.rb'
+ - 'app/models/ci/pipeline.rb'
+ - 'app/models/project.rb'
+ - 'app/services/prometheus/proxy_service.rb'
+ - 'app/workers/delete_stored_files_worker.rb'
+ - 'app/workers/reactive_caching_worker.rb'
+ - 'config/initializers/1_settings.rb'
+ - 'config/initializers/trusted_proxies.rb'
+ - 'ee/db/migrate/20151113115819_canonicalize_kerberos_identities.rb'
+ - 'lib/gitlab/background_migration/archive_legacy_traces.rb'
+ - 'lib/gitlab/highlight.rb'
+ - 'lib/tasks/gitlab/lfs/migrate.rake'
+
+# Offense count: 344
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: require_no_space, require_space
Layout/SpaceInLambdaLiteral:
Enabled: false
-# Offense count: 327
+# Offense count: 578
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
@@ -44,20 +182,27 @@ Layout/SpaceInLambdaLiteral:
Layout/SpaceInsideBlockBraces:
Enabled: false
-# Offense count: 156
+# Offense count: 252
# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: space, no_space
Layout/SpaceInsideParens:
Enabled: false
-# Offense count: 26
+# Offense count: 1
+Lint/DisjunctiveAssignmentInConstructor:
+ Exclude:
+ - 'app/models/uploads/base.rb'
+
+# Offense count: 19
Lint/DuplicateMethods:
Exclude:
- - 'app/models/application_setting.rb'
- 'app/models/commit.rb'
- 'app/models/note.rb'
- - 'app/services/merge_requests/merge_service.rb'
- 'lib/bitbucket/representation/repo.rb'
- 'lib/declarative_policy/base.rb'
+ - 'lib/gitlab/auth/ldap/person.rb'
+ - 'lib/gitlab/auth/o_auth/user.rb'
- 'lib/gitlab/ci/build/artifacts/metadata/entry.rb'
- 'lib/gitlab/cycle_analytics/base_event_fetcher.rb'
- 'lib/gitlab/diff/formatters/base_formatter.rb'
@@ -65,22 +210,40 @@ Lint/DuplicateMethods:
- 'lib/gitlab/git/repository.rb'
- 'lib/gitlab/git/tree.rb'
- 'lib/gitlab/git/wiki_page.rb'
- - 'lib/gitlab/auth/ldap/person.rb'
- - 'lib/gitlab/auth/o_auth/user.rb'
-# Offense count: 4
+# Offense count: 2
Lint/InterpolationCheck:
Exclude:
- 'spec/features/issues/filtered_search/filter_issues_spec.rb'
- - 'spec/features/users_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb'
-# Offense count: 206
+# Offense count: 326
# Configuration parameters: MaximumRangeSize.
Lint/MissingCopEnableDirective:
Enabled: false
-# Offense count: 9
+# Offense count: 2
+# Cop supports --auto-correct.
+# Configuration parameters: Whitelist.
+# Whitelist: present?, blank?, presence, try, try!
+Lint/SafeNavigationConsistency:
+ Exclude:
+ - 'lib/gitlab/gpg/commit.rb'
+
+# Offense count: 2
+# Cop supports --auto-correct.
+Lint/ToJSON:
+ Exclude:
+ - 'lib/gitlab/cycle_analytics/usage_data.rb'
+ - 'lib/gitlab/template/base_template.rb'
+
+# Offense count: 3
+# Cop supports --auto-correct.
+Lint/UnneededCopDisableDirective:
+ Exclude:
+ - 'spec/factories/project_auto_devops.rb'
+
+# Offense count: 7
Lint/UriEscapeUnescape:
Exclude:
- 'app/controllers/application_controller.rb'
@@ -88,13 +251,25 @@ Lint/UriEscapeUnescape:
- 'spec/lib/google_api/auth_spec.rb'
- 'spec/requests/api/files_spec.rb'
- 'spec/requests/api/internal_spec.rb'
- - 'spec/requests/api/issues_spec.rb'
# Offense count: 1
-# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
+# Configuration parameters: CheckForMethodsWithNoSideEffects.
+Lint/Void:
+ Exclude:
+ - 'lib/gitlab/git/diff_collection.rb'
+
+# Offense count: 158
+# Cop supports --auto-correct.
+# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
- Max: 1310
+ Max: 176
+
+# Offense count: 94
+# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
+# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
+Naming/FileName:
+ Enabled: false
# Offense count: 11
# Configuration parameters: EnforcedStyle.
@@ -107,61 +282,125 @@ Naming/HeredocDelimiterCase:
- 'spec/support/helpers/repo_helpers.rb'
- 'spec/support/helpers/seed_repo.rb'
-# Offense count: 112
+# Offense count: 197
# Configuration parameters: Blacklist.
-# Blacklist: END, (?-mix:EO[A-Z]{1})
+# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Enabled: false
+# Offense count: 121
+# Cop supports --auto-correct.
+# Configuration parameters: PreferredName.
+Naming/RescuedExceptionsVariableName:
+ Enabled: false
+
+# Offense count: 6
+# Cop supports --auto-correct.
+Performance/InefficientHashSearch:
+ Exclude:
+ - 'app/controllers/concerns/sessionless_authentication.rb'
+ - 'app/models/note.rb'
+ - 'app/models/user_preference.rb'
+ - 'ee/app/models/ee/project.rb'
+ - 'lib/gitlab/import_export/members_mapper.rb'
+ - 'qa/spec/spec_helper.rb'
+
+# Offense count: 3
+# Cop supports --auto-correct.
+Performance/ReverseEach:
+ Exclude:
+ - 'app/models/commit.rb'
+ - 'db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb'
+ - 'lib/gitlab/profiler.rb'
-# Offense count: 3821
+# Offense count: 6
+RSpec/Be:
+ Exclude:
+ - 'spec/controllers/projects/pipelines_controller_spec.rb'
+ - 'spec/models/concerns/issuable_spec.rb'
+ - 'spec/uploaders/file_uploader_spec.rb'
+ - 'spec/uploaders/namespace_file_uploader_spec.rb'
+
+# Offense count: 7050
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Enabled: false
-# Offense count: 293
+# Offense count: 18
+# Cop supports --auto-correct.
+RSpec/EmptyLineAfterExampleGroup:
+ Exclude:
+ - 'ee/spec/lib/gitlab/vulnerabilities/container_scanning_vulnerability_spec.rb'
+ - 'ee/spec/services/ee/issues/create_from_vulnerability_data_service_spec.rb'
+ - 'spec/controllers/projects/notes_controller_spec.rb'
+ - 'spec/lib/gitlab/git/diff_collection_spec.rb'
+ - 'spec/lib/gitlab/git/repository_spec.rb'
+ - 'spec/lib/gitlab/gitaly_client_spec.rb'
+ - 'spec/migrations/clean_stage_id_reference_migration_spec.rb'
+ - 'spec/models/user_spec.rb'
+ - 'spec/routing/project_routing_spec.rb'
+ - 'spec/services/projects/overwrite_project_service_spec.rb'
+
+# Offense count: 406
+# Cop supports --auto-correct.
RSpec/EmptyLineAfterFinalLet:
Enabled: false
-# Offense count: 188
+# Offense count: 37
+# Cop supports --auto-correct.
+RSpec/EmptyLineAfterHook:
+ Enabled: false
+
+# Offense count: 232
+# Cop supports --auto-correct.
RSpec/EmptyLineAfterSubject:
Enabled: false
-# Offense count: 258
+# Offense count: 719
+# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: method_call, block
RSpec/ExpectChange:
Enabled: false
-# Offense count: 221
+# Offense count: 512
RSpec/ExpectInHook:
Enabled: false
-# Offense count: 19
+# Offense count: 21
+# Cop supports --auto-correct.
+RSpec/HooksBeforeExamples:
+ Enabled: false
+
+# Offense count: 1498
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: single_line_only, single_statement_only, disallow
+RSpec/ImplicitSubject:
+ Enabled: false
+
+# Offense count: 10
+# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: it_behaves_like, it_should_behave_like
RSpec/ItBehavesLike:
Exclude:
- 'spec/lib/gitlab/git/commit_spec.rb'
- 'spec/lib/gitlab/git/repository_spec.rb'
- - 'spec/lib/gitlab/shell_spec.rb'
- 'spec/services/notification_service_spec.rb'
- - 'spec/workers/git_garbage_collect_worker_spec.rb'
-# Offense count: 5
+# Offense count: 3
RSpec/IteratedExpectation:
Exclude:
- 'spec/features/admin/admin_settings_spec.rb'
- - 'spec/features/merge_requests/diff_notes_resolve_spec.rb'
- - 'spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb'
- 'spec/lib/gitlab/gitlab_import/client_spec.rb'
- 'spec/lib/gitlab/legacy_github_import/client_spec.rb'
-# Offense count: 75
+# Offense count: 68
+# Cop supports --auto-correct.
RSpec/LetBeforeExamples:
Exclude:
- - 'spec/controllers/projects/commit_controller_spec.rb'
- 'spec/lib/banzai/filter/issue_reference_filter_spec.rb'
- 'spec/lib/banzai/filter/user_reference_filter_spec.rb'
- 'spec/lib/gitlab/email/handler/create_issue_handler_spec.rb'
@@ -170,12 +409,16 @@ RSpec/LetBeforeExamples:
- 'spec/models/commit_range_spec.rb'
- 'spec/models/milestone_spec.rb'
- 'spec/models/project_services/packagist_service_spec.rb'
- - 'spec/models/repository_spec.rb'
- 'spec/rubocop/cop/migration/update_column_in_batches_spec.rb'
- 'spec/serializers/pipeline_details_entity_spec.rb'
- - 'spec/views/ci/lints/show.html.haml_spec.rb'
# Offense count: 1
+RSpec/MissingExampleGroupArgument:
+ Exclude:
+ - 'spec/lib/gitlab/git_access_spec.rb'
+
+# Offense count: 1
+# Cop supports --auto-correct.
RSpec/MultipleSubjects:
Exclude:
- 'spec/services/merge_requests/create_from_issue_service_spec.rb'
@@ -188,95 +431,177 @@ RSpec/OverwritingSetup:
- 'spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb'
- 'spec/services/notes/quick_actions_service_spec.rb'
-# Offense count: 965
+# Offense count: 1825
+# Cop supports --auto-correct.
# Configuration parameters: Strict, EnforcedStyle.
# SupportedStyles: inflected, explicit
RSpec/PredicateMatcher:
Enabled: false
-# Offense count: 35
+# Offense count: 23
+# Cop supports --auto-correct.
+RSpec/ReceiveCounts:
+ Enabled: false
+
+# Offense count: 5
+# Cop supports --auto-correct.
+RSpec/ReceiveNever:
+ Exclude:
+ - 'ee/spec/lib/gitlab/elastic/project_search_results_spec.rb'
+ - 'ee/spec/services/geo/metrics_update_service_spec.rb'
+ - 'spec/lib/banzai/renderer_spec.rb'
+ - 'spec/models/concerns/reactive_caching_spec.rb'
+
+# Offense count: 55
RSpec/RepeatedExample:
Enabled: false
-# Offense count: 140
+# Offense count: 479
+# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: and_return, block
RSpec/ReturnFromStub:
Enabled: false
-# Offense count: 112
+# Offense count: 188
RSpec/ScatteredLet:
Enabled: false
-# Offense count: 22
+# Offense count: 10
RSpec/ScatteredSetup:
Exclude:
- 'spec/controllers/projects/templates_controller_spec.rb'
- 'spec/lib/gitlab/bitbucket_import/importer_spec.rb'
- - 'spec/lib/gitlab/git/env_spec.rb'
- 'spec/requests/api/jobs_spec.rb'
- 'spec/services/projects/create_service_spec.rb'
# Offense count: 1
+# Cop supports --auto-correct.
RSpec/SharedContext:
Exclude:
- 'spec/features/admin/admin_groups_spec.rb'
-# Offense count: 5
+# Offense count: 39
+# Cop supports --auto-correct.
+RSpec/SharedExamples:
+ Exclude:
+ - 'ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
+ - 'ee/spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
+ - 'ee/spec/lib/gitlab/email/handler/ee/service_desk_handler_spec.rb'
+ - 'ee/spec/services/approval_rules/params_filtering_service_spec.rb'
+ - 'spec/lib/banzai/filter/relative_link_filter_spec.rb'
+ - 'spec/lib/gitlab/email/handler/create_issue_handler_spec.rb'
+ - 'spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb'
+ - 'spec/lib/gitlab/email/handler/create_note_handler_spec.rb'
+ - 'spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb'
+ - 'spec/lib/gitlab/email/receiver_spec.rb'
+ - 'spec/lib/gitlab/git/tree_spec.rb'
+ - 'spec/models/project_services/drone_ci_service_spec.rb'
+ - 'spec/models/user_spec.rb'
+ - 'spec/support/shared_contexts/email_shared_context.rb'
+
+# Offense count: 4
+RSpec/UnspecifiedException:
+ Exclude:
+ - 'spec/controllers/projects/jobs_controller_spec.rb'
+ - 'spec/lib/gitlab/background_migration/delete_diff_files_spec.rb'
+ - 'spec/services/merge_requests/post_merge_service_spec.rb'
+ - 'spec/workers/delete_diff_files_worker_spec.rb'
+
+# Offense count: 4
RSpec/VoidExpect:
Exclude:
- - 'spec/features/projects/artifacts/download_spec.rb'
- 'spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb'
- 'spec/models/ci/group_spec.rb'
- 'spec/models/ci/runner_spec.rb'
- 'spec/services/users/destroy_service_spec.rb'
-# Offense count: 41
+# Offense count: 8
+# Cop supports --auto-correct.
+Rails/BelongsTo:
+ Exclude:
+ - 'app/models/deployment.rb'
+ - 'app/models/environment.rb'
+ - 'ee/app/models/prometheus_alert.rb'
+ - 'ee/app/models/prometheus_alert_event.rb'
+
+# Offense count: 80
# Configuration parameters: Include.
# Include: db/migrate/*.rb
Rails/CreateTableWithTimestamps:
Enabled: false
-# Offense count: 155
+# Offense count: 222
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: slashes, arguments
Rails/FilePath:
Enabled: false
-# Offense count: 121
+# Offense count: 167
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Enabled: false
-# Offense count: 157
+# Offense count: 77
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: numeric, symbolic
+Rails/HttpStatus:
+ Enabled: false
+
+# Offense count: 2
+# Configuration parameters: Include.
+# Include: app/controllers/**/*.rb
+Rails/IgnoredSkipActionFilterOption:
+ Exclude:
+ - 'app/controllers/projects/snippets_controller.rb'
+ - 'app/controllers/snippets_controller.rb'
+
+# Offense count: 87
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Enabled: false
-# Offense count: 48
+# Offense count: 46
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb
Rails/LexicallyScopedActionFilter:
Enabled: false
-# Offense count: 14
+# Offense count: 4
+# Cop supports --auto-correct.
+Rails/LinkToBlank:
+ Exclude:
+ - 'app/helpers/projects_helper.rb'
+ - 'app/helpers/wiki_helper.rb'
+ - 'ee/app/helpers/ee/user_callouts_helper.rb'
+ - 'ee/app/helpers/license_helper.rb'
+
+# Offense count: 11
# Cop supports --auto-correct.
Rails/Presence:
Exclude:
- - 'app/controllers/projects/blob_controller.rb'
- 'app/models/ci/pipeline.rb'
- 'app/models/clusters/platforms/kubernetes.rb'
- 'app/models/concerns/mentionable.rb'
- - 'app/models/concerns/token_authenticatable.rb'
- 'app/models/project_services/hipchat_service.rb'
- 'app/models/project_services/irker_service.rb'
- 'app/models/project_services/jira_service.rb'
- 'app/models/project_services/kubernetes_service.rb'
- 'app/models/project_services/packagist_service.rb'
- 'app/models/wiki_page.rb'
- - 'lib/gitlab/git/hook.rb'
- 'lib/gitlab/github_import/importer/releases_importer.rb'
+# Offense count: 1
+# Cop supports --auto-correct.
+# Configuration parameters: Include.
+# Include: app/models/**/*.rb
+Rails/RedundantAllowNil:
+ Exclude:
+ - 'app/models/application_setting.rb'
+
# Offense count: 2
# Configuration parameters: Include.
# Include: db/migrate/*.rb
@@ -284,8 +609,8 @@ Rails/ReversibleMigration:
Exclude:
- 'db/migrate/20160824103857_drop_unused_ci_tables.rb'
-# Offense count: 446
-# Configuration parameters: Blacklist.
+# Offense count: 860
+# Configuration parameters: Blacklist, Whitelist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
Rails/SkipsModelValidations:
Enabled: false
@@ -297,21 +622,25 @@ Rails/UnknownEnv:
Exclude:
- 'db/migrate/20171124125748_populate_missing_merge_request_statuses.rb'
-# Offense count: 13
+# Offense count: 11
# Cop supports --auto-correct.
Security/YAMLLoad:
Exclude:
- - 'config/initializers/carrierwave.rb'
- 'lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits.rb'
- 'lib/gitlab/redis/wrapper.rb'
- 'lib/system_check/incoming_email/imap_authentication_check.rb'
- 'spec/config/mail_room_spec.rb'
- 'spec/initializers/secret_token_spec.rb'
- 'spec/lib/gitlab/prometheus/additional_metrics_parser_spec.rb'
- - 'spec/models/clusters/platforms/kubernetes_spec.rb'
- 'spec/models/project_services/kubernetes_service_spec.rb'
-# Offense count: 64
+# Offense count: 34
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: inline, group
+Style/AccessModifierDeclarations:
+ Enabled: false
+
+# Offense count: 121
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: percent_q, bare_percent
@@ -324,17 +653,13 @@ Style/CommentedKeyword:
- 'lib/tasks/gitlab/backup.rake'
- 'spec/tasks/gitlab/backup_rake_spec.rb'
-# Offense count: 30
-Style/DateTime:
- Enabled: false
-
# Offense count: 1
# Cop supports --auto-correct.
Style/Dir:
Exclude:
- 'qa/qa.rb'
-# Offense count: 9
+# Offense count: 7
# Cop supports --auto-correct.
Style/EachWithObject:
Exclude:
@@ -345,46 +670,42 @@ Style/EachWithObject:
- 'lib/gitlab/i18n/po_linter.rb'
- 'lib/gitlab/import_export/members_mapper.rb'
- 'lib/gitlab/import_export/relation_factory.rb'
- - 'scripts/static-analysis'
-# Offense count: 24
+# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty, nil, both
Style/EmptyElse:
Enabled: false
-# Offense count: 14
+# Offense count: 11
# Cop supports --auto-correct.
Style/EmptyLambdaParameter:
Exclude:
- 'app/models/ci/build.rb'
- 'app/models/ci/runner.rb'
-# Offense count: 12
+# Offense count: 9
# Cop supports --auto-correct.
Style/EmptyLiteral:
Exclude:
- - 'features/steps/project/commits/commits.rb'
- 'lib/gitlab/fogbugz_import/importer.rb'
- 'lib/gitlab/git/diff_collection.rb'
- 'lib/gitlab/gitaly_client.rb'
- - 'scripts/trigger-build'
- - 'spec/features/merge_requests/versions_spec.rb'
- 'spec/helpers/merge_requests_helper_spec.rb'
- 'spec/lib/gitlab/request_context_spec.rb'
- 'spec/lib/gitlab/workhorse_spec.rb'
- 'spec/requests/api/jobs_spec.rb'
- 'spec/support/shared_examples/chat_slash_commands_shared_examples.rb'
-# Offense count: 102
+# Offense count: 180
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Enabled: false
-# Offense count: 23
+# Offense count: 40
# Cop supports --auto-correct.
Style/Encoding:
Enabled: false
@@ -394,52 +715,52 @@ Style/EvalWithLocation:
Exclude:
- 'app/models/service.rb'
-# Offense count: 35
+# Offense count: 203
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: format, sprintf, percent
Style/FormatString:
Enabled: false
-# Offense count: 384
+# Offense count: 667
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false
-# Offense count: 22
+# Offense count: 27
Style/IfInsideElse:
Enabled: false
-# Offense count: 809
+# Offense count: 1344
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Enabled: false
-# Offense count: 75
+# Offense count: 183
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Enabled: false
-# Offense count: 11
+# Offense count: 3
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Exclude:
- - 'app/helpers/tree_helper.rb'
- - 'spec/features/issuables/markdown_references_spec.rb'
- - 'spec/lib/gitlab/checks/project_moved_spec.rb'
- 'spec/lib/gitlab/gfm/reference_rewriter_spec.rb'
- 'spec/lib/gitlab/incoming_email_spec.rb'
# Offense count: 18
-Style/MethodMissing:
+Style/MethodMissingSuper:
Enabled: false
-# Offense count: 7
+# Offense count: 18
+Style/MissingRespondToMissing:
+ Enabled: false
+
+# Offense count: 6
Style/MixinUsage:
Exclude:
- - 'features/support/env.rb'
- 'spec/factories/ci/builds.rb'
- 'spec/factories/ci/job_artifacts.rb'
- 'spec/factories/lfs_objects.rb'
@@ -447,59 +768,64 @@ Style/MixinUsage:
- 'spec/lib/gitlab/import_export/project_tree_restorer_spec.rb'
- 'spec/lib/gitlab/import_export/version_checker_spec.rb'
-# Offense count: 6
+# Offense count: 5
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'app/helpers/snippets_helper.rb'
- 'app/models/project_wiki.rb'
- 'app/services/ci/process_pipeline_service.rb'
- - 'app/services/create_deployment_service.rb'
- 'lib/api/commit_statuses.rb'
- 'lib/gitlab/ci/trace.rb'
-# Offense count: 25
+# Offense count: 72
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: literals, strict
+Style/MutableConstant:
+ Enabled: false
+
+# Offense count: 28
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.
# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
Style/NestedParenthesizedCalls:
Enabled: false
-# Offense count: 19
+# Offense count: 31
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength.
# SupportedStyles: skip_modifier_ifs, always
Style/Next:
Enabled: false
-# Offense count: 61
+# Offense count: 67
# Cop supports --auto-correct.
# Configuration parameters: EnforcedOctalStyle.
# SupportedOctalStyles: zero_with_o, zero_only
Style/NumericLiteralPrefix:
Enabled: false
-# Offense count: 114
+# Offense count: 185
# Cop supports --auto-correct.
-# Configuration parameters: AutoCorrect, EnforcedStyle.
+# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Enabled: false
-# Offense count: 4
+# Offense count: 2
# Cop supports --auto-correct.
Style/OrAssignment:
Exclude:
- - 'app/models/concerns/token_authenticatable.rb'
- 'lib/api/commit_statuses.rb'
- 'lib/gitlab/project_transfer.rb'
-# Offense count: 50
+# Offense count: 79
# Cop supports --auto-correct.
Style/ParallelAssignment:
Enabled: false
-# Offense count: 917
+# Offense count: 1383
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
@@ -521,25 +847,20 @@ Style/PerlBackrefs:
- 'lib/gitlab/search_results.rb'
- 'lib/gitlab/sherlock/query.rb'
-# Offense count: 87
+# Offense count: 129
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
Enabled: false
-# Offense count: 9
+# Offense count: 3
# Cop supports --auto-correct.
Style/RedundantBegin:
Exclude:
- - 'app/controllers/projects/clusters/gcp_controller.rb'
- 'app/models/merge_request.rb'
- 'app/services/projects/import_service.rb'
- - 'lib/api/branches.rb'
- - 'lib/gitlab/current_settings.rb'
- - 'lib/gitlab/git/commit.rb'
- 'lib/gitlab/health_checks/base_abstract_check.rb'
- - 'lib/tasks/gitlab/task_helpers.rb'
# Offense count: 1
# Cop supports --auto-correct.
@@ -547,7 +868,7 @@ Style/RedundantConditional:
Exclude:
- 'lib/system_check/helpers.rb'
-# Offense count: 57
+# Offense count: 360
# Cop supports --auto-correct.
Style/RedundantFreeze:
Enabled: false
@@ -567,41 +888,36 @@ Style/RedundantReturn:
- 'lib/gitlab/utils.rb'
- 'lib/google_api/auth.rb'
-# Offense count: 460
+# Offense count: 701
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false
-# Offense count: 142
+# Offense count: 28
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
- Enabled: true
- EnforcedStyle: mixed
- AllowInnerSlashes: false
+ Enabled: false
-# Offense count: 36
+# Offense count: 41
# Cop supports --auto-correct.
Style/RescueModifier:
Enabled: false
-# Offense count: 107
+# Offense count: 197
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Enabled: false
-# Offense count: 8
+# Offense count: 5
# Cop supports --auto-correct.
Style/SelfAssignment:
Exclude:
- 'app/models/concerns/bulk_member_access_load.rb'
- 'app/serializers/base_serializer.rb'
- - 'app/services/notification_service.rb'
- - 'lib/api/runners.rb'
- - 'spec/features/merge_requests/diff_notes_resolve_spec.rb'
- 'spec/features/projects/clusters/interchangeability_spec.rb'
- 'spec/support/import_export/configuration_helper.rb'
@@ -612,7 +928,7 @@ Style/SingleLineMethods:
Exclude:
- 'lib/gitlab/ci/ansi2html.rb'
-# Offense count: 66
+# Offense count: 91
# Cop supports --auto-correct.
# Configuration parameters: .
# SupportedStyles: use_perl_names, use_english_names
@@ -625,21 +941,21 @@ Style/StderrPuts:
Exclude:
- 'config/initializers/rspec_profiling.rb'
-# Offense count: 45
+# Offense count: 65
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiteralsInInterpolation:
Enabled: false
-# Offense count: 106
+# Offense count: 187
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: respond_to, define_method
Style/SymbolProc:
Enabled: false
-# Offense count: 9
+# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
@@ -647,45 +963,65 @@ Style/TernaryParentheses:
Exclude:
- 'app/finders/projects_finder.rb'
- 'app/helpers/namespaces_helper.rb'
- - 'features/support/capybara.rb'
- 'lib/gitlab/ci/build/artifacts/metadata/entry.rb'
- 'spec/requests/api/pipeline_schedules_spec.rb'
- 'spec/support/capybara.rb'
-# Offense count: 17
+# Offense count: 3
# Cop supports --auto-correct.
-# Configuration parameters: AllowNamedUnderscoreVariables.
-Style/TrailingUnderscoreVariable:
+# Configuration parameters: EnforcedStyleForMultiline.
+# SupportedStylesForMultiline: comma, consistent_comma, no_comma
+Style/TrailingCommaInArguments:
Exclude:
- - 'app/controllers/admin/background_jobs_controller.rb'
- - 'app/controllers/invites_controller.rb'
- - 'app/helpers/tab_helper.rb'
- - 'lib/backup/manager.rb'
- - 'lib/gitlab/logger.rb'
- - 'lib/gitlab/upgrader.rb'
- - 'lib/system_check/app/migrations_are_up_check.rb'
- - 'lib/system_check/incoming_email/mail_room_running_check.rb'
- - 'lib/tasks/gitlab/check.rake'
- - 'lib/tasks/gitlab/task_helpers.rb'
- - 'spec/lib/gitlab/etag_caching/middleware_spec.rb'
- - 'spec/services/quick_actions/interpret_service_spec.rb'
+ - 'spec/features/markdown/copy_as_gfm_spec.rb'
-# Offense count: 4
+# Offense count: 10
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyleForMultiline.
+# SupportedStylesForMultiline: comma, consistent_comma, no_comma
+Style/TrailingCommaInArrayLiteral:
+ Exclude:
+ - 'ee/spec/models/project_spec.rb'
+ - 'spec/lib/gitlab/diff/position_tracer_spec.rb'
+ - 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb'
+
+# Offense count: 2
+# Cop supports --auto-correct.
+# Configuration parameters: EnforcedStyleForMultiline.
+# SupportedStylesForMultiline: comma, consistent_comma, no_comma
+Style/TrailingCommaInHashLiteral:
+ Exclude:
+ - 'lib/gitlab/ci/ansi2html.rb'
+ - 'lib/gitlab/kubernetes.rb'
+
+# Offense count: 2
# Cop supports --auto-correct.
Style/UnlessElse:
Exclude:
- 'lib/backup/manager.rb'
- 'lib/gitlab/project_search_results.rb'
- - 'lib/tasks/gitlab/check.rake'
- - 'spec/features/issues/award_emoji_spec.rb'
-# Offense count: 31
+# Offense count: 10
+# Cop supports --auto-correct.
+Style/UnneededCondition:
+ Exclude:
+ - 'app/helpers/button_helper.rb'
+ - 'app/helpers/environment_helper.rb'
+ - 'app/models/project.rb'
+ - 'app/services/issuable/clone/base_service.rb'
+ - 'app/services/prometheus/adapter_service.rb'
+ - 'lib/gitlab/email/message/repository_push.rb'
+ - 'lib/gitlab/prometheus_client.rb'
+ - 'spec/lib/rspec_flaky/flaky_example_spec.rb'
+
+# Offense count: 71
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Enabled: false
-# Offense count: 22840
-# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
-# URISchemes: http, https
-Metrics/LineLength:
- Max: 1310
+# Offense count: 2
+# Cop supports --auto-correct.
+Style/UnneededSort:
+ Exclude:
+ - 'app/models/concerns/resolvable_discussion.rb'
+ - 'lib/gitlab/highlight.rb'
diff --git a/Gemfile b/Gemfile
index 1faacc0801c..3a47b88bf15 100644
--- a/Gemfile
+++ b/Gemfile
@@ -349,9 +349,10 @@ group :development, :test do
gem 'spring', '~> 2.0.0'
gem 'spring-commands-rspec', '~> 1.0.4'
- gem 'gitlab-styles', '~> 2.5', require: false
+ gem 'gitlab-styles', '~> 2.6', require: false
# Pin these dependencies, otherwise a new rule could break the CI pipelines
- gem 'rubocop', '~> 0.54.0'
+ gem 'rubocop', '~> 0.68.1'
+ gem 'rubocop-performance', '~> 1.1.0'
gem 'rubocop-rspec', '~> 1.22.1'
gem 'scss_lint', '~> 0.56.0', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index e02de8292bd..5fa54081491 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -297,9 +297,10 @@ GEM
gitlab-markup (1.7.0)
gitlab-sidekiq-fetcher (0.4.0)
sidekiq (~> 5)
- gitlab-styles (2.5.2)
- rubocop (~> 0.54.0)
+ gitlab-styles (2.6.1)
+ rubocop (~> 0.68.1)
rubocop-gitlab-security (~> 0.1.0)
+ rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.19)
gitlab_omniauth-ldap (2.1.1)
net-ldap (~> 0.16)
@@ -407,6 +408,7 @@ GEM
jaeger-client (0.10.0)
opentracing (~> 0.3)
thrift
+ jaro_winkler (1.5.2)
jira-ruby (1.4.1)
activesupport
multipart-post
@@ -585,7 +587,7 @@ GEM
rubypants (~> 0.2)
orm_adapter (0.5.0)
os (1.0.0)
- parallel (1.12.1)
+ parallel (1.17.0)
parser (2.5.3.0)
ast (~> 2.4.0)
parslet (1.8.2)
@@ -615,7 +617,6 @@ GEM
pg (1.1.4)
po_to_json (1.0.1)
json (>= 1.6.0)
- powerpack (0.1.1)
premailer (1.10.4)
addressable
css_parser (>= 1.4.10)
@@ -787,15 +788,17 @@ GEM
pg
rails
sqlite3
- rubocop (0.54.0)
+ rubocop (0.68.1)
+ jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
- parser (>= 2.5)
- powerpack (~> 0.1)
+ parser (>= 2.5, != 2.5.1.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (~> 1.0, >= 1.0.1)
+ unicode-display_width (>= 1.4.0, < 1.6)
rubocop-gitlab-security (0.1.1)
rubocop (>= 0.51)
+ rubocop-performance (1.1.0)
+ rubocop (>= 0.67.0)
rubocop-rspec (1.22.2)
rubocop (>= 0.52.1)
ruby-enum (0.7.2)
@@ -803,7 +806,7 @@ GEM
ruby-fogbugz (0.2.1)
crack (~> 0.4)
ruby-prof (0.17.0)
- ruby-progressbar (1.9.0)
+ ruby-progressbar (1.10.0)
ruby-saml (1.7.2)
nokogiri (>= 1.5.10)
ruby_parser (3.11.0)
@@ -929,7 +932,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
- unicode-display_width (1.3.2)
+ unicode-display_width (1.5.0)
unicorn (5.4.1)
kgio (~> 2.6)
raindrops (~> 0.7)
@@ -1065,7 +1068,7 @@ DEPENDENCIES
gitlab-labkit (~> 0.2.0)
gitlab-markup (~> 1.7.0)
gitlab-sidekiq-fetcher (~> 0.4.0)
- gitlab-styles (~> 2.5)
+ gitlab-styles (~> 2.6)
gitlab_omniauth-ldap (~> 2.1.1)
gon (~> 6.2)
google-api-client (~> 0.23)
@@ -1171,7 +1174,8 @@ DEPENDENCIES
rspec-set (~> 0.1.3)
rspec_junit_formatter
rspec_profiling (~> 0.0.5)
- rubocop (~> 0.54.0)
+ rubocop (~> 0.68.1)
+ rubocop-performance (~> 1.1.0)
rubocop-rspec (~> 1.22.1)
ruby-fogbugz (~> 0.2.1)
ruby-prof (~> 0.17.0)
diff --git a/rubocop/cop/gitlab/finder_with_find_by.rb b/rubocop/cop/gitlab/finder_with_find_by.rb
index f45a37ddc06..764a5073143 100644
--- a/rubocop/cop/gitlab/finder_with_find_by.rb
+++ b/rubocop/cop/gitlab/finder_with_find_by.rb
@@ -2,7 +2,7 @@ module RuboCop
module Cop
module Gitlab
class FinderWithFindBy < RuboCop::Cop::Cop
- FIND_PATTERN = /\Afind(_by\!?)?\z/
+ FIND_PATTERN = /\Afind(_by\!?)?\z/.freeze
ALLOWED_MODULES = ['FinderMethods'].freeze
def message(used_method)
@@ -36,7 +36,7 @@ module RuboCop
def find_on_execute?(node)
chained_on_node = node.descendants.first
node.method_name.to_s =~ FIND_PATTERN &&
- chained_on_node&.method_name == :execute
+ chained_on_node.is_a?(RuboCop::AST::SendNode) && chained_on_node.method_name == :execute
end
def allowed_module?(node)