Skip to content

Commit

Permalink
Upgrade rubocop and fix offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed Jan 3, 2021
1 parent 168f244 commit 9cdc07b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 32 deletions.
34 changes: 19 additions & 15 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Lint/AmbiguousRegexpLiteral:
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true

Lint/ConstantDefinitionInBlock:
Exclude:
- "spec/**/*_spec.rb"

Lint/DeprecatedOpenSSLConstant:
Description: Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`.
Enabled: true
Expand Down Expand Up @@ -141,16 +145,16 @@ Naming/FileName:
- "spec/fixtures/utf-8.rb"

Style/AccessorGrouping:
Enabled: true
Enabled: true

Style/ArrayCoercion:
Enabled: true
Enabled: true

Style/BisectedAttrAccessor:
Enabled: true
Enabled: true

Style/CaseLikeIf:
Enabled: true
Enabled: true

Style/CollectionMethods:
Description: Enforces the use of consistent method names from the Enumerable module.
Expand All @@ -170,8 +174,8 @@ Style/DoubleNegation:
Enabled: false

Style/ExplicitBlockArgument:
# capturing as a proc has a performance hit, so is a case by case choice
Enabled: false
# capturing as a proc has a performance hit, so is a case by case choice
Enabled: false

Style/ExponentialNotation:
Description: When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).
Expand All @@ -187,21 +191,21 @@ Style/FrozenStringLiteralComment:
- "spec/fixtures/**/*"

Style/GlobalStdStream:
Enabled: true
Enabled: true

Style/GuardClause:
Description: Use a guard clause instead of wrapping the code inside a conditional expression.
Enabled: false

Style/HashAsLastArrayItem:
Enabled: true
Enabled: true

Style/HashEachMethods:
Description: Use Hash#each_key and Hash#each_value.
Enabled: true

Style/HashLikeCase:
Enabled: true
Enabled: true

Style/HashTransformKeys:
Description: Prefer `transform_keys` over `each_with_object` and `map`.
Expand All @@ -216,16 +220,16 @@ Style/HashSyntax:
EnforcedStyle: ruby19

Style/OptionalBooleanParameter:
Enabled: true
Enabled: true

Style/RedundantAssignment:
Enabled: true
Enabled: true

Style/RedundantFetchBlock:
Enabled: true
Enabled: true

Style/RedundantFileExtensionInRequire:
Enabled: true
Enabled: true

Style/RedundantRegexpCharacterClass:
Description: Checks for unnecessary single-element Regexp character classes.
Expand All @@ -241,7 +245,7 @@ Style/RegexpLiteral:
Enabled: false

Style/SingleArgumentDig:
Enabled: true
Enabled: true

Style/SlicingWithRange:
Description: Checks array slicing is done with endless ranges when suitable.
Expand All @@ -255,7 +259,7 @@ Style/SpecialGlobalVars:
- "lib/simplecov/defaults.rb"

Style/StringConcatenation:
Enabled: true
Enabled: true

Style/StringLiterals:
Description: Allow double-quoted strings without interpolation.
Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ GEM
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.10-java)
parallel (1.19.2)
parser (2.7.1.4)
parallel (1.20.1)
parser (3.0.0.0)
ast (~> 2.4.1)
power_assert (1.2.0)
protobuf-cucumber (3.10.8)
Expand Down Expand Up @@ -125,18 +125,18 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.1)
rubocop (0.89.0)
rubocop (1.7.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, < 3.0)
rexml
rubocop-ast (>= 0.1.0, < 1.0)
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
ruby-progressbar (1.10.1)
rubocop-ast (1.4.0)
parser (>= 2.7.1.5)
ruby-progressbar (1.11.0)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
spoon (0.0.6)
Expand Down
10 changes: 4 additions & 6 deletions lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
require "English"

# Coverage may be inaccurate under JRUBY.
if defined?(JRUBY_VERSION) && defined?(JRuby)
if defined?(JRUBY_VERSION) && defined?(JRuby) && !org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED

# @see https://github.com/jruby/jruby/issues/1196
# @see https://github.com/metricfu/metric_fu/pull/226
# @see https://github.com/simplecov-ruby/simplecov/issues/420
# @see https://github.com/simplecov-ruby/simplecov/issues/86
# @see https://jira.codehaus.org/browse/JRUBY-6106

unless org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED
warn 'Coverage may be inaccurate; set the "--debug" command line option,' \
' or do JRUBY_OPTS="--debug"' \
' or set the "debug.fullTrace=true" option in your .jrubyrc'
end
warn 'Coverage may be inaccurate; set the "--debug" command line option,' \
' or do JRUBY_OPTS="--debug"' \
' or set the "debug.fullTrace=true" option in your .jrubyrc'
end

#
Expand Down
4 changes: 2 additions & 2 deletions spec/result_merger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}
end

let(:merged_resultset_1_and_2) do
let(:merged_resultset1_and2) do
{
source_fixture("sample.rb") => {"lines" => [1, 1, 2, 2, nil, nil, 2, 2, nil, nil]},
source_fixture("app/models/user.rb") => {"lines" => [nil, 2, 6, 2, nil, nil, 2, 0, nil, nil]},
Expand Down Expand Up @@ -293,6 +293,6 @@ def outdated(result)

def expect_resultset_1_and_2_merged(result_hash)
merged_coverage = result_hash.fetch("result1, result2").fetch("coverage")
expect(merged_coverage).to eq(merged_resultset_1_and_2)
expect(merged_coverage).to eq(merged_resultset1_and2)
end
end

0 comments on commit 9cdc07b

Please sign in to comment.