Skip to content

Commit

Permalink
Rubocop-fixes (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
olbrich authored Sep 2, 2024
1 parent 0ff229b commit f525893
Show file tree
Hide file tree
Showing 38 changed files with 1,809 additions and 1,863 deletions.
8 changes: 2 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ AllCops:
Exclude:
- ruby-units.gemspec
- bin/*
Style/CaseEquality:
Enabled: true
Style/StringLiterals:
EnforcedStyle: double_quotes
Layout/LineLength:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Naming/FileName:
Exclude:
- 'lib/ruby-units.rb'
Naming/MethodParameterName:
Enabled: false
Style/FormatString:
Enabled: false
Style/DateTime:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/MethodLength:
Expand Down
192 changes: 0 additions & 192 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,11 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.


# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Layout/SpaceAfterComma:
Exclude:
- 'spec/benchmarks/bigdecimal.rb'
- 'spec/ruby_units/complex_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceBeforeBlockBraces:
Exclude:
- 'spec/benchmarks/bigdecimal.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideBlockBraces:
Exclude:
- 'spec/benchmarks/bigdecimal.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperator:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:
Exclude:
- 'lib/ruby_units/unit_definitions/standard.rb'

# Offense count: 2
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Lint/UselessNumericOperation:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'lib/ruby_units/definition.rb'

# Offense count: 2
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
Expand All @@ -85,21 +33,6 @@ RSpec/BeforeAfterAll:
- '**/spec/support/**/*.rb'
- 'spec/ruby_units/temperature_spec.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: be_a, be_kind_of
RSpec/ClassCheck:
Exclude:
- 'spec/ruby_units/math_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 16
# This cop supports safe autocorrection (--autocorrect).
RSpec/ContextMethod:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 95
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
Expand Down Expand Up @@ -137,56 +70,11 @@ RSpec/DescribedClass:
- 'spec/ruby_units/complex_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.
RSpec/EmptyLineAfterExample:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 20
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterExampleGroup:
Exclude:
- 'spec/ruby_units/temperature_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterFinalLet:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 114
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterSubject:
Exclude:
- 'spec/ruby_units/temperature_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 8
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 7

# Offense count: 11
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
# DisallowedExamples: works
RSpec/ExampleWording:
Exclude:
- 'spec/ruby_units/bugs_spec.rb'
- 'spec/ruby_units/unit_spec.rb'
- 'spec/ruby_units/utf-8/unit_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 2
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Expand All @@ -199,12 +87,6 @@ RSpec/InstanceVariable:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/LeadingSubject:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
RSpec/MultipleDescribes:
Exclude:
Expand All @@ -228,14 +110,6 @@ RSpec/NamedSubject:
RSpec/NestedGroups:
Max: 5

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: not_to, to_not
RSpec/NotToNot:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
Expand Down Expand Up @@ -267,15 +141,6 @@ RSpec/SpecFilePathFormat:
- '**/spec/routing/**/*'
- 'spec/ruby_units/utf-8/unit_spec.rb'

# Offense count: 27
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
Style/CaseEquality:
Exclude:
- 'lib/ruby_units/unit.rb'
- 'spec/ruby_units/complex_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
Expand All @@ -284,16 +149,6 @@ Style/ClassAndModuleChildren:
Exclude:
- 'lib/ruby_units/definition.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Keywords, RequireColon.
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
Style/CommentAnnotation:
Exclude:
- 'Guardfile'
- 'spec/ruby_units/temperature_spec.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedConstants.
Style/Documentation:
Expand All @@ -309,12 +164,6 @@ Style/GlobalStdStream:
- 'spec/benchmarks/bigdecimal.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
Style/NumericLiterals:
MinDigits: 10

# Offense count: 1
Style/OpenStructUse:
Exclude:
Expand All @@ -327,31 +176,6 @@ Style/OptionalBooleanParameter:
Exclude:
- 'lib/ruby_units/date.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConstantBase:
Exclude:
- 'spec/ruby_units/date_spec.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantFreeze:
Exclude:
- 'lib/ruby_units/unit.rb'
- 'lib/ruby_units/version.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantParentheses:
Exclude:
- 'lib/ruby_units/definition.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSend.
Expand All @@ -367,19 +191,3 @@ Style/StringConcatenation:
- 'spec/ruby_units/bugs_spec.rb'
- 'spec/ruby_units/unit_spec.rb'
- 'spec/ruby_units/utf-8/unit_spec.rb'

# Offense count: 20
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'spec/benchmarks/bigdecimal.rb'
- 'spec/ruby_units/unit_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Style/SuperArguments:
Exclude:
- 'lib/ruby_units/math.rb'
- 'lib/ruby_units/time.rb'
34 changes: 17 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

# These are gems that are only used for local development and don't need to be included at runtime or for running tests.
# The CI process will not install them.
group :optional do
gem 'debug', '>= 1.0.0', platform: :mri
gem 'guard-rspec'
gem 'pry'
gem 'redcarpet', platform: :mri # redcarpet doesn't support jruby
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'ruby-maven', platform: :jruby
gem 'ruby-prof', platform: :mri
gem 'simplecov-html'
gem 'solargraph'
gem 'terminal-notifier'
gem 'terminal-notifier-guard'
gem 'webrick'
gem "debug", ">= 1.0.0", platform: :mri
gem "guard-rspec"
gem "pry"
gem "redcarpet", platform: :mri # redcarpet doesn't support jruby
gem "rubocop"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "ruby-maven", platform: :jruby
gem "ruby-prof", platform: :mri
gem "simplecov-html"
gem "solargraph"
gem "terminal-notifier"
gem "terminal-notifier-guard"
gem "webrick"
end

gem 'simplecov'
gem 'yard'
gem "simplecov"
gem "yard"

gemspec
10 changes: 5 additions & 5 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ directories %w[lib spec]
## Uncomment to clear the screen before every task
clearing :on

# Note: The cmd option is now required due to the increasing number of ways
# NOTE: The cmd option is now required due to the increasing number of ways
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
Expand All @@ -18,14 +18,14 @@ clearing :on
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'

guard :rspec, cmd: 'bundle exec rspec' do
require 'ostruct'
guard :rspec, cmd: "bundle exec rspec" do
require "ostruct"

# Generic Ruby apps
rspec = OpenStruct.new
rspec.spec = ->(m) { "spec/#{m}_spec.rb" }
rspec.spec_dir = 'spec'
rspec.spec_helper = 'spec/spec_helper.rb'
rspec.spec_dir = "spec"
rspec.spec_helper = "spec/spec_helper.rb"

watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| rspec.spec.call(m[1]) }
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

Expand Down
2 changes: 1 addition & 1 deletion lib/ruby-units.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

require_relative 'ruby_units/namespaced'
require_relative "ruby_units/namespaced"
Unit = RubyUnits::Unit
2 changes: 1 addition & 1 deletion lib/ruby_units/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def initialize
def separator=(value)
raise ArgumentError, "configuration 'separator' may only be true or false" unless [true, false].include?(value)

@separator = value ? ' ' : nil
@separator = value ? " " : nil
end

# Set the format to use when generating output.
Expand Down
Loading

0 comments on commit f525893

Please sign in to comment.