From 380dff622f83e199a08f37692395bfe3a3e5b437 Mon Sep 17 00:00:00 2001 From: Maxim Rydkin Date: Tue, 29 Aug 2017 11:51:15 +0300 Subject: exclude spec/ and features/ from `Style/PredicateName` cop --- .rubocop.yml | 12 ++++++++++++ .rubocop_todo.yml | 10 ---------- features/steps/project/star.rb | 8 ++++---- features/steps/shared/group.rb | 14 +++++++------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index abdda90a33e..e96f4273c6a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -606,6 +606,18 @@ Style/YodaCondition: Style/Proc: Enabled: true +# Use `spam?` instead of `is_spam?` +# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. +# NamePrefix: is_, has_, have_ +# NamePrefixBlacklist: is_, has_, have_ +# NameWhitelist: is_a? +Style/PredicateName: + Enabled: true + NamePrefixBlacklist: is_ + Exclude: + - 'spec/**/*' + - 'features/**/*' + # Metrics ##################################################################### # A calculated magnitude based on number of assignments, diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9e6412a436d..cdf97d1d842 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -237,16 +237,6 @@ Style/PercentLiteralDelimiters: Style/PerlBackrefs: Enabled: false -# Offense count: 105 -# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. -# NamePrefix: is_, has_, have_ -# NamePrefixBlacklist: is_, has_, have_ -# NameWhitelist: is_a? -Style/PredicateName: - Enabled: true - NamePrefixBlacklist: is_ - NameWhitelist: have_visible_content - # Offense count: 58 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb index 2e7eb65901a..9f7c748a3b7 100644 --- a/features/steps/project/star.rb +++ b/features/steps/project/star.rb @@ -9,15 +9,15 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps end step "The project has 0 stars" do - has_n_stars?(0) + has_n_stars(0) end step "The project has 1 star" do - has_n_stars?(1) + has_n_stars(1) end step "The project has 2 stars" do - has_n_stars?(2) + has_n_stars(2) end # Requires @javascript @@ -31,7 +31,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps protected - def has_n_stars?(n) + def has_n_stars(n) expect(page).to have_css(".star-count", text: n, visible: true) end end diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb index 45fad83e8bb..de119f2c6c0 100644 --- a/features/steps/shared/group.rb +++ b/features/steps/shared/group.rb @@ -2,27 +2,27 @@ module SharedGroup include Spinach::DSL step 'current user is developer of group "Owned"' do - member_of?(current_user.name, "Owned", Gitlab::Access::DEVELOPER) + is_member_of(current_user.name, "Owned", Gitlab::Access::DEVELOPER) end step '"John Doe" is owner of group "Owned"' do - member_of?("John Doe", "Owned", Gitlab::Access::OWNER) + is_member_of("John Doe", "Owned", Gitlab::Access::OWNER) end step '"John Doe" is guest of group "Guest"' do - member_of?("John Doe", "Guest", Gitlab::Access::GUEST) + is_member_of("John Doe", "Guest", Gitlab::Access::GUEST) end step '"Mary Jane" is owner of group "Owned"' do - member_of?("Mary Jane", "Owned", Gitlab::Access::OWNER) + is_member_of("Mary Jane", "Owned", Gitlab::Access::OWNER) end step '"Mary Jane" is guest of group "Owned"' do - member_of?("Mary Jane", "Owned", Gitlab::Access::GUEST) + is_member_of("Mary Jane", "Owned", Gitlab::Access::GUEST) end step '"Mary Jane" is guest of group "Guest"' do - member_of?("Mary Jane", "Guest", Gitlab::Access::GUEST) + is_member_of("Mary Jane", "Guest", Gitlab::Access::GUEST) end step 'I should see group "TestGroup"' do @@ -35,7 +35,7 @@ module SharedGroup protected - def member_of?(username, groupname, role) + def is_member_of(username, groupname, role) @project_count ||= 0 user = User.find_by(name: username) || create(:user, name: username) group = Group.find_by(name: groupname) || create(:group, name: groupname) -- cgit v1.2.1