From 0c2e8ef85763bee34b975bb8df4ed0bda093dcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 18 Jan 2018 18:45:05 +0100 Subject: [PATCH] Update rubocop, rubocop-rspec, and gitlab-styles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .rubocop_todo.yml | 135 +++++++++++++--------------- Gemfile | 6 +- Gemfile.lock | 16 ++-- spec/requests/api/jobs_spec.rb | 2 +- spec/requests/api/v3/builds_spec.rb | 2 +- 5 files changed, 75 insertions(+), 86 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 085dc153596..8d2276f71be 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,27 +1,26 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2017-12-14 12:04:26 +0100 using RuboCop version 0.52.0. +# on 2018-01-18 18:23:26 +0100 using RuboCop version 0.52.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: 174 +# Offense count: 181 Capybara/CurrentPathExpectation: Enabled: false -# Offense count: 951 +# Offense count: 956 Capybara/FeatureMethods: Enabled: false -# Offense count: 24 +# Offense count: 23 FactoryBot/DynamicAttributeDefinedStatically: Exclude: - 'spec/factories/broadcast_messages.rb' - 'spec/factories/ci/builds.rb' - 'spec/factories/ci/runners.rb' - 'spec/factories/clusters/applications/helm.rb' - - 'spec/factories/clusters/applications/ingress.rb' - 'spec/factories/clusters/platforms/kubernetes.rb' - 'spec/factories/emails.rb' - 'spec/factories/gpg_keys.rb' @@ -33,40 +32,31 @@ FactoryBot/DynamicAttributeDefinedStatically: - 'spec/factories/todos.rb' - 'spec/factories/uploads.rb' -# Offense count: 65 +# Offense count: 167 # Cop supports --auto-correct. Layout/EmptyLinesAroundArguments: Enabled: false -# Offense count: 249 +# Offense count: 253 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. Layout/ExtraSpacing: Enabled: false -# Offense count: 82 +# Offense count: 83 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_brackets Layout/IndentArray: Enabled: false -# Offense count: 239 +# Offense count: 237 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces Layout/IndentHash: Enabled: false -# Offense count: 15 -# Cop supports --auto-correct. -# Configuration parameters: . -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceBeforeBlockBraces: - EnforcedStyle: space - EnforcedStyleForEmptyBraces: space - # Offense count: 11 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment. @@ -97,7 +87,7 @@ Layout/SpaceInsideArrayLiteralBrackets: Exclude: - 'spec/lib/gitlab/import_export/relation_factory_spec.rb' -# Offense count: 323 +# Offense count: 327 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. # SupportedStyles: space, no_space @@ -105,7 +95,7 @@ Layout/SpaceInsideArrayLiteralBrackets: Layout/SpaceInsideBlockBraces: Enabled: false -# Offense count: 146 +# Offense count: 156 # Cop supports --auto-correct. Layout/SpaceInsideParens: Enabled: false @@ -118,7 +108,7 @@ Layout/SpaceInsidePercentLiteralDelimiters: - 'lib/gitlab/health_checks/fs_shards_check.rb' - 'spec/lib/gitlab/health_checks/fs_shards_check_spec.rb' -# Offense count: 25 +# Offense count: 26 Lint/DuplicateMethods: Exclude: - 'app/models/application_setting.rb' @@ -144,7 +134,7 @@ Lint/InterpolationCheck: - 'spec/features/users_spec.rb' - 'spec/services/quick_actions/interpret_service_spec.rb' -# Offense count: 198 +# Offense count: 206 # Configuration parameters: MaximumRangeSize. Lint/MissingCopEnableDirective: Enabled: false @@ -185,6 +175,12 @@ Lint/UriEscapeUnescape: - 'spec/requests/api/issues_spec.rb' - 'spec/requests/api/v3/issues_spec.rb' +# Offense count: 1 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 1310 + # Offense count: 2 Naming/ConstantName: Exclude: @@ -202,13 +198,13 @@ Naming/HeredocDelimiterCase: - 'spec/support/repo_helpers.rb' - 'spec/support/seed_repo.rb' -# Offense count: 101 +# Offense count: 112 # Configuration parameters: Blacklist. # Blacklist: END, (?-mix:EO[A-Z]{1}) Naming/HeredocDelimiterNaming: Enabled: false -# Offense count: 28 +# Offense count: 27 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect. Performance/HashEachMethods: @@ -225,21 +221,27 @@ Performance/UriDefaultParser: Exclude: - 'lib/gitlab/url_sanitizer.rb' -# Offense count: 3745 +# Offense count: 3821 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: Enabled: false -# Offense count: 291 +# Offense count: 293 RSpec/EmptyLineAfterFinalLet: Enabled: false -# Offense count: 180 +# Offense count: 188 RSpec/EmptyLineAfterSubject: Enabled: false -# Offense count: 220 +# Offense count: 258 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: method_call, block +RSpec/ExpectChange: + Enabled: false + +# Offense count: 221 RSpec/ExpectInHook: Enabled: false @@ -304,7 +306,7 @@ RSpec/OverwritingSetup: - 'spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb' - 'spec/services/notes/quick_actions_service_spec.rb' -# Offense count: 917 +# Offense count: 965 # Configuration parameters: Strict, EnforcedStyle. # SupportedStyles: inflected, explicit RSpec/PredicateMatcher: @@ -314,13 +316,13 @@ RSpec/PredicateMatcher: RSpec/RepeatedExample: Enabled: false -# Offense count: 132 +# Offense count: 140 # Configuration parameters: EnforcedStyle. # SupportedStyles: and_return, block RSpec/ReturnFromStub: Enabled: false -# Offense count: 105 +# Offense count: 112 RSpec/ScatteredLet: Enabled: false @@ -353,23 +355,23 @@ RSpec/VoidExpect: - 'spec/models/ci/runner_spec.rb' - 'spec/services/users/destroy_service_spec.rb' -# Offense count: 40 +# Offense count: 41 # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/CreateTableWithTimestamps: Enabled: false -# Offense count: 149 +# Offense count: 155 Rails/FilePath: Enabled: false -# Offense count: 119 +# Offense count: 121 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasManyOrHasOneDependent: Enabled: false -# Offense count: 113 +# Offense count: 157 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/InverseOf: @@ -399,12 +401,6 @@ Rails/Presence: - 'lib/gitlab/git/hook.rb' - 'lib/gitlab/github_import/importer/releases_importer.rb' -# Offense count: 14 -# Cop supports --auto-correct. -Rails/RedundantReceiverInWithOptions: - Exclude: - - 'config/initializers/doorkeeper_openid_connect.rb' - # Offense count: 2 # Configuration parameters: Include. # Include: db/migrate/*.rb @@ -412,7 +408,7 @@ Rails/ReversibleMigration: Exclude: - 'db/migrate/20160824103857_drop_unused_ci_tables.rb' -# Offense count: 430 +# Offense count: 446 # Configuration parameters: Blacklist. # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters Rails/SkipsModelValidations: @@ -439,7 +435,7 @@ Security/YAMLLoad: - 'spec/models/clusters/platforms/kubernetes_spec.rb' - 'spec/models/project_services/kubernetes_service_spec.rb' -# Offense count: 63 +# Offense count: 64 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: percent_q, bare_percent @@ -506,7 +502,7 @@ Style/EmptyLiteral: - 'spec/requests/api/jobs_spec.rb' - 'spec/support/chat_slash_commands_shared_examples.rb' -# Offense count: 98 +# Offense count: 102 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: compact, expanded @@ -523,35 +519,28 @@ Style/EvalWithLocation: Exclude: - 'app/models/service.rb' -# Offense count: 52 -# Cop supports --auto-correct. -# Configuration parameters: Autocorrect, EnforcedStyle. -# SupportedStyles: module_function, extend_self -Style/ExtendSelf: - Enabled: false - -# Offense count: 34 +# Offense count: 35 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: format, sprintf, percent Style/FormatString: Enabled: false -# Offense count: 371 +# Offense count: 384 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false -# Offense count: 21 +# Offense count: 22 Style/IfInsideElse: Enabled: false -# Offense count: 781 +# Offense count: 809 # Cop supports --auto-correct. Style/IfUnlessModifier: Enabled: false -# Offense count: 71 +# Offense count: 75 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: line_count_dependent, lambda, literal @@ -573,7 +562,7 @@ Style/LineEndConcatenation: Style/MethodCallWithoutArgsParentheses: Enabled: false -# Offense count: 17 +# Offense count: 18 Style/MethodMissing: Enabled: false @@ -599,28 +588,28 @@ Style/MultilineIfModifier: - 'lib/api/commit_statuses.rb' - 'lib/gitlab/ci/trace.rb' -# Offense count: 23 +# Offense count: 25 # 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: 20 +# Offense count: 19 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, MinBodyLength. # SupportedStyles: skip_modifier_ifs, always Style/Next: Enabled: false -# Offense count: 58 +# Offense count: 61 # Cop supports --auto-correct. # Configuration parameters: EnforcedOctalStyle. # SupportedOctalStyles: zero_with_o, zero_only Style/NumericLiteralPrefix: Enabled: false -# Offense count: 112 +# Offense count: 114 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle. # SupportedStyles: predicate, comparison @@ -641,7 +630,7 @@ Style/OrAssignment: Style/ParallelAssignment: Enabled: false -# Offense count: 891 +# Offense count: 917 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -663,14 +652,14 @@ Style/PerlBackrefs: - 'lib/gitlab/search_results.rb' - 'lib/gitlab/sherlock/query.rb' -# Offense count: 82 +# Offense count: 87 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: compact, exploded Style/RaiseArgs: Enabled: false -# Offense count: 8 +# Offense count: 9 # Cop supports --auto-correct. Style/RedundantBegin: Exclude: @@ -689,7 +678,7 @@ Style/RedundantConditional: Exclude: - 'lib/system_check/helpers.rb' -# Offense count: 58 +# Offense count: 57 # Cop supports --auto-correct. Style/RedundantFreeze: Enabled: false @@ -709,31 +698,31 @@ Style/RedundantReturn: - 'lib/gitlab/utils.rb' - 'lib/google_api/auth.rb' -# Offense count: 454 +# Offense count: 460 # Cop supports --auto-correct. Style/RedundantSelf: Enabled: false -# Offense count: 140 +# Offense count: 142 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed Style/RegexpLiteral: Enabled: false -# Offense count: 35 +# Offense count: 36 # Cop supports --auto-correct. Style/RescueModifier: Enabled: false -# Offense count: 105 +# Offense count: 107 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, explicit Style/RescueStandardError: Enabled: false -# Offense count: 91 +# Offense count: 92 # Cop supports --auto-correct. # Configuration parameters: ConvertCodeThatCanStartToReturnNil. Style/SafeNavigation: @@ -778,7 +767,7 @@ Style/StderrPuts: Style/StringLiteralsInInterpolation: Enabled: false -# Offense count: 99 +# Offense count: 106 # Cop supports --auto-correct. # Configuration parameters: IgnoredMethods. # IgnoredMethods: respond_to, define_method @@ -837,7 +826,7 @@ Style/UnlessElse: - 'lib/tasks/gitlab/check.rake' - 'spec/features/issues/award_emoji_spec.rb' -# Offense count: 30 +# Offense count: 31 # Cop supports --auto-correct. Style/UnneededInterpolation: Enabled: false @@ -856,7 +845,7 @@ Style/ZeroLengthPredicate: - 'lib/extracts_path.rb' - 'lib/gitlab/git/repository.rb' -# Offense count: 22050 +# Offense count: 22840 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Metrics/LineLength: diff --git a/Gemfile b/Gemfile index 5f4911ff628..6f82890d0d1 100644 --- a/Gemfile +++ b/Gemfile @@ -341,10 +341,10 @@ group :development, :test do gem 'spring-commands-rspec', '~> 1.0.4' gem 'spring-commands-spinach', '~> 1.1.0' - gem 'gitlab-styles', '~> 2.2.0', require: false + gem 'gitlab-styles', '~> 2.3', require: false # Pin these dependencies, otherwise a new rule could break the CI pipelines - gem 'rubocop', '~> 0.52.0' - gem 'rubocop-rspec', '~> 1.20.1' + gem 'rubocop', '~> 0.52.1' + gem 'rubocop-rspec', '~> 1.22.1' gem 'scss_lint', '~> 0.56.0', require: false gem 'haml_lint', '~> 0.26.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index b251b8c481a..284e1e7654d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -304,7 +304,7 @@ GEM mime-types (>= 1.16) posix-spawn (~> 0.3) gitlab-markup (1.6.3) - gitlab-styles (2.2.0) + gitlab-styles (2.3.0) rubocop (~> 0.51) rubocop-gitlab-security (~> 0.1.0) rubocop-rspec (~> 1.19) @@ -583,7 +583,7 @@ GEM rubypants (~> 0.2) orm_adapter (0.5.0) os (0.9.6) - parallel (1.12.0) + parallel (1.12.1) parser (2.4.0.2) ast (~> 2.3) parslet (1.5.0) @@ -786,7 +786,7 @@ GEM pg rails sqlite3 - rubocop (0.52.0) + rubocop (0.52.1) parallel (~> 1.10) parser (>= 2.4.0.2, < 3.0) powerpack (~> 0.1) @@ -795,8 +795,8 @@ GEM unicode-display_width (~> 1.0, >= 1.0.1) rubocop-gitlab-security (0.1.1) rubocop (>= 0.51) - rubocop-rspec (1.20.1) - rubocop (>= 0.51.0) + rubocop-rspec (1.22.1) + rubocop (>= 0.52.1) ruby-fogbugz (0.2.1) crack (~> 0.4) ruby-prof (0.16.2) @@ -1060,7 +1060,7 @@ DEPENDENCIES github-linguist (~> 4.7.0) gitlab-flowdock-git-hook (~> 1.0.1) gitlab-markup (~> 1.6.2) - gitlab-styles (~> 2.2.0) + gitlab-styles (~> 2.3) gitlab_omniauth-ldap (~> 2.0.4) gollum-lib (~> 4.2) gollum-rugged_adapter (~> 0.4.4) @@ -1162,8 +1162,8 @@ DEPENDENCIES rspec-retry (~> 0.4.5) rspec-set (~> 0.1.3) rspec_profiling (~> 0.0.5) - rubocop (~> 0.52.0) - rubocop-rspec (~> 1.20.1) + rubocop (~> 0.52.1) + rubocop-rspec (~> 1.22.1) ruby-fogbugz (~> 0.2.1) ruby-prof (~> 0.16.2) ruby_parser (~> 3.8) diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index e211c347266..4dd8deb6404 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -53,7 +53,7 @@ describe API::Jobs do expect(json_job['pipeline']['status']).to eq job.pipeline.status end - it 'avoids N+1 queries', skip_before_request: true do + it 'avoids N+1 queries', :skip_before_request do first_build = create(:ci_build, :artifacts, pipeline: pipeline) first_build.runner = create(:ci_runner) first_build.user = create(:user) diff --git a/spec/requests/api/v3/builds_spec.rb b/spec/requests/api/v3/builds_spec.rb index cdbc5692e19..af9e36a3b29 100644 --- a/spec/requests/api/v3/builds_spec.rb +++ b/spec/requests/api/v3/builds_spec.rb @@ -42,7 +42,7 @@ describe API::V3::Builds do expect(json_build['pipeline']['status']).to eq build.pipeline.status end - it 'avoids N+1 queries', skip_before_request: true do + it 'avoids N+1 queries', :skip_before_request do first_build = create(:ci_build, :artifacts, pipeline: pipeline) first_build.runner = create(:ci_runner) first_build.user = create(:user)