Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rubocop offenses #1350

Merged
merged 11 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 56 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ require:
AllCops:
NewCops: disable
TargetRubyVersion: 2.4
Exclude:
- 'gemfiles/*'
Bundler/OrderedGems:
Include:
- '**/Gemfile'
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Layout/CommentIndentation:
Expand All @@ -17,23 +22,26 @@ Layout/EmptyLineBetweenDefs:
Layout/HeredocIndentation:
Enabled: false
Layout/LineLength:
Exclude:
KapilSachdev marked this conversation as resolved.
Show resolved Hide resolved
- spec/**/*
IgnoredPatterns:
- "^[ ]*#.+$"
- "^[ ]*describe.+$"
- "^[ ]*context.+$"
- "^[ ]*shared_context.+$"
- "^[ ]*shared_examples_for.+$"
- "^[ ]*it.+$"
- "^[ ]*'.+?' => '.+?',?$"
- "^[ ]*\".+?\" => \".+?\",?$"
- !ruby/regexp /\A +(it|describe|context|shared_examples|include_examples|it_behaves_like) ["']/
- !ruby/regexp /\A(require|require_relative) ["']/
- '^[ ]*#.+$'
- '^[ ]*''.+?'' => ''.+?'',?$'
- '^[ ]*".+?" => ".+?",?$'
Max: 80
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Layout/SpaceInsideBlockBraces:
Enabled: false
Layout/SpaceInLambdaLiteral:
EnforcedStyle: require_space
Layout/SpaceInsideBlockBraces:
Enabled: false
Lint/AmbiguousBlockAssociation:
Exclude:
- spec/**/*
Lint/AmbiguousOperator:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Expand All @@ -50,6 +58,8 @@ Lint/LiteralInInterpolation:
Enabled: false
Lint/Loop:
Enabled: false
Lint/MissingSuper:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: false
Lint/RequireParentheses:
Expand All @@ -63,43 +73,50 @@ Lint/UnderscorePrefixedVariableName:
Lint/Void:
Enabled: false
Metrics/AbcSize:
Max: 25
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Max: 30
Metrics/ModuleLength:
Enabled: true
Exclude:
- spec/**/*
Metrics/ParameterLists:
CountKeywordArgs: false
Metrics/PerceivedComplexity:
Max: 10
Enabled: false
Naming/AccessorMethodName:
Enabled: false
Naming/AsciiIdentifiers:
Enabled: false
Naming/BinaryOperatorParameterName:
Enabled: false
Naming/FileName:
Enabled: false
Naming/HeredocDelimiterNaming:
Enabled: false
Naming/MemoizedInstanceVariableName:
EnforcedStyleForLeadingUnderscores: required
Naming/PredicateName:
Enabled: false
Style/BlockDelimiters:
Enabled: false
Style/ClassVars:
Enabled: false
Style/ColonMethodCall:
Enabled: false
Naming/FileName:
Naming/RescuedExceptionsVariableName:
Enabled: false
Rails/Date:
Enabled: false
Rails/Delegate:
Enabled: false
Rails/TimeZone:
Enabled: false
Rails/HttpPositionalArguments:
Enabled: false
Rails/SkipsModelValidations:
Exclude:
- spec/**/*
Rails/TimeZone:
Enabled: false
Style/Alias:
Enabled: false
Style/ArrayJoin:
Expand All @@ -108,19 +125,25 @@ Style/AsciiComments:
Enabled: false
Style/Attr:
Enabled: false
Style/BlockDelimiters:
Enabled: false
Style/CaseEquality:
Enabled: false
Style/CharacterLiteral:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/ClassVars:
Enabled: false
Style/CollectionMethods:
Enabled: true
PreferredMethods:
find: detect
reduce: inject
collect: map
find: detect
find_all: select
reduce: inject
Style/ColonMethodCall:
Enabled: false
Style/CommentAnnotation:
Enabled: false
Style/Documentation:
Expand All @@ -133,12 +156,16 @@ Style/EmptyElse:
Enabled: false
Style/EmptyLiteral:
Enabled: false
Style/EmptyMethod:
EnforcedStyle: expanded
Style/Encoding:
Enabled: false
Style/EvenOdd:
Enabled: false
Style/FormatString:
Enabled: false
Style/FormatStringToken:
mcmire marked this conversation as resolved.
Show resolved Hide resolved
EnforcedStyle: template
Style/FrozenStringLiteralComment:
Enabled: false
Style/GlobalVars:
Expand All @@ -151,6 +178,8 @@ Style/IfWithSemicolon:
Enabled: false
Style/InlineComment:
Enabled: false
Style/InverseMethods:
Enabled: false
Style/Lambda:
Enabled: false
Style/LambdaCall:
Expand All @@ -177,6 +206,8 @@ Style/NumericPredicate:
Enabled: false
Style/OneLineConditional:
Enabled: false
Style/OptionalBooleanParameter:
Enabled: false
Style/ParenthesesAroundCondition:
Enabled: false
Style/PercentLiteralDelimiters:
Expand Down Expand Up @@ -213,11 +244,11 @@ Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/TrivialAccessors:
Enabled: false
Style/VariableInterpolation:
Enabled: false
Style/WhenThen:
Enabled: false
Style/WhileUntilModifier:
Enabled: false
Style/WordArray:
Enabled: false
Style/VariableInterpolation:
Enabled: false
3 changes: 2 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ appraise 'rails_5_2' do
gem 'sqlite3', '~> 1.3.6'
end

if Gem::Requirement.new('>= 2.5.0').satisfied_by?(Gem::Version.new(RUBY_VERSION))
if Gem::Requirement.new('>= 2.5.0').
satisfied_by?(Gem::Version.new(RUBY_VERSION))
appraise 'rails_6_0' do
instance_eval(&shared_dependencies)
instance_eval(&controller_test_dependency)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ gem 'zeus', require: false

# YARD
gem 'fssm'
gem 'rouge'
gem 'redcarpet'
gem 'rouge'
gem 'yard'
41 changes: 28 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
appraisal (2.2.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.1)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
diff-lcs (1.3)
fssm (0.2.10)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
minitest (5.14.2)
parallel (1.19.2)
parser (2.7.1.4)
parser (2.7.2.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rack (2.2.2)
rack (2.2.3)
rainbow (3.0.0)
rake (13.0.1)
redcarpet (3.5.0)
regexp_parser (1.7.1)
regexp_parser (1.8.2)
rexml (3.2.4)
rouge (3.22.0)
rspec (3.9.0)
Expand All @@ -40,27 +50,32 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)
rubocop (0.89.1)
rubocop (1.0.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.3.0, < 1.0)
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
rubocop-packaging (0.4.0)
rubocop (~> 0.89)
rubocop-rails (2.0.1)
rubocop-ast (1.1.0)
parser (>= 2.7.1.5)
rubocop-packaging (0.5.1)
rubocop (>= 0.89, < 2.0)
rubocop-rails (2.8.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.70.0)
rubocop (>= 0.87.0)
ruby-progressbar (1.10.1)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
warnings_logger (0.1.1)
yard (0.9.25)
zeitwerk (2.4.0)
zeus (0.15.14)
method_source (>= 0.6.7)

Expand Down
16 changes: 7 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ require_relative 'spec/support/tests/current_bundle'

RSpec::Core::RakeTask.new('spec:unit') do |t|
t.ruby_opts = '-w -r ./spec/report_warnings'
t.pattern = "spec/unit/**/*_spec.rb"
t.pattern = 'spec/unit/**/*_spec.rb'
t.rspec_opts = '--color --format progress'
t.verbose = false
end

RSpec::Core::RakeTask.new('spec:acceptance') do |t|
t.ruby_opts = '-w -r ./spec/report_warnings'
t.pattern = "spec/acceptance/**/*_spec.rb"
t.pattern = 'spec/acceptance/**/*_spec.rb'
t.rspec_opts = '--color --format progress'
t.verbose = false
end
Expand All @@ -24,18 +24,16 @@ task :default do
if Tests::CurrentBundle.instance.appraisal_in_use?
sh 'rake spec:unit --trace'
sh 'rake spec:acceptance --trace'
elsif ENV['CI']
exec 'appraisal install && appraisal rake --trace'
else
if ENV['CI']
exec "appraisal install && appraisal rake --trace"
else
appraisal = Tests::CurrentBundle.instance.latest_appraisal
exec "appraisal install && appraisal #{appraisal} rake --trace"
end
appraisal = Tests::CurrentBundle.instance.latest_appraisal
exec "appraisal install && appraisal #{appraisal} rake --trace"
end
end

namespace :appraisal do
task :list do
task list: :environment do
appraisals = Tests::CurrentBundle.instance.available_appraisals
puts "Valid appraisals: #{appraisals.join(', ')}"
end
Expand Down
12 changes: 6 additions & 6 deletions custom_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class CustomPlan < Zeus::Plan
def boot
ENV['BUNDLE_GEMFILE'] = File.expand_path(
"../gemfiles/#{latest_appraisal}.gemfile",
__FILE__
__FILE__,
)

require 'bundler/setup'

$LOAD_PATH << File.expand_path('../lib', __FILE__)
$LOAD_PATH << File.expand_path('../spec', __FILE__)
$LOAD_PATH << File.expand_path('lib', __dir__)
$LOAD_PATH << File.expand_path('spec', __dir__)

# Fix Zeus for Pry 0.13.0+
Pry::Pager.class_eval do
Expand All @@ -41,8 +41,8 @@ def best_available
end

require_relative 'spec/support/unit/load_environment'
rescue Gem::LoadError => error
KapilSachdev marked this conversation as resolved.
Show resolved Hide resolved
raise CouldNotBootZeusError.create(underlying_error: error)
rescue Gem::LoadError => e
raise CouldNotBootZeusError.create(underlying_error: e)
end

def after_fork
Expand Down Expand Up @@ -97,7 +97,7 @@ def expand_rspec_argument(rspec_argument)
file_path, location = match.captures
expanded_file_path = File.expand_path(
"../spec/unit/shoulda/matchers/#{file_path}",
__FILE__
__FILE__,
)

[expanded_file_path, location]
Expand Down
4 changes: 3 additions & 1 deletion doc_config/yard/setup.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')
YARD::Templates::Engine.register_template_path(
"#{File.dirname(__FILE__)}/templates",
)

require 'rouge'

Expand Down
Loading