exclude spec/ and features/ from Style/PredicateName cop

This commit is contained in:
Maxim Rydkin 2017-08-29 11:51:15 +03:00
parent e637f80243
commit 380dff622f
4 changed files with 23 additions and 21 deletions

View file

@ -606,6 +606,18 @@ Style/YodaCondition:
Style/Proc: Style/Proc:
Enabled: true 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 ##################################################################### # Metrics #####################################################################
# A calculated magnitude based on number of assignments, # A calculated magnitude based on number of assignments,

View file

@ -237,16 +237,6 @@ Style/PercentLiteralDelimiters:
Style/PerlBackrefs: Style/PerlBackrefs:
Enabled: false 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 # Offense count: 58
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.

View file

@ -9,15 +9,15 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
end end
step "The project has 0 stars" do step "The project has 0 stars" do
has_n_stars?(0) has_n_stars(0)
end end
step "The project has 1 star" do step "The project has 1 star" do
has_n_stars?(1) has_n_stars(1)
end end
step "The project has 2 stars" do step "The project has 2 stars" do
has_n_stars?(2) has_n_stars(2)
end end
# Requires @javascript # Requires @javascript
@ -31,7 +31,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
protected protected
def has_n_stars?(n) def has_n_stars(n)
expect(page).to have_css(".star-count", text: n, visible: true) expect(page).to have_css(".star-count", text: n, visible: true)
end end
end end

View file

@ -2,27 +2,27 @@ module SharedGroup
include Spinach::DSL include Spinach::DSL
step 'current user is developer of group "Owned"' do 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 end
step '"John Doe" is owner of group "Owned"' do 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 end
step '"John Doe" is guest of group "Guest"' do 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 end
step '"Mary Jane" is owner of group "Owned"' do 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 end
step '"Mary Jane" is guest of group "Owned"' do 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 end
step '"Mary Jane" is guest of group "Guest"' do 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 end
step 'I should see group "TestGroup"' do step 'I should see group "TestGroup"' do
@ -35,7 +35,7 @@ module SharedGroup
protected protected
def member_of?(username, groupname, role) def is_member_of(username, groupname, role)
@project_count ||= 0 @project_count ||= 0
user = User.find_by(name: username) || create(:user, name: username) user = User.find_by(name: username) || create(:user, name: username)
group = Group.find_by(name: groupname) || create(:group, name: groupname) group = Group.find_by(name: groupname) || create(:group, name: groupname)