diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a7c19fd..f4a4d33 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -11,7 +11,7 @@ jobs: name: Rubocop uses: theforeman/actions/.github/workflows/rubocop.yml@v0 with: - command: bundle exec rubocop + command: bundle exec rubocop --parallel --format github test: name: Ruby diff --git a/.rubocop.yml b/.rubocop.yml index a96d2d4..0a237bd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,43 +1,27 @@ -require: - - rubocop-performance - - rubocop-rails - - rubocop-minitest - -# TODO: remove this file by either moving cops here or fixing code inherit_from: - .rubocop_todo.yml +inherit_gem: + theforeman-rubocop: + - rules/base.yml + - rules/ruby_target.yml + - rules/style.yml + - rules/metrics.yml + - rules/performance.yml + - rules/rails.yml + - rules/minitest.yml + - rules/style_lenient.yml + AllCops: - TargetRubyVersion: 2.5 - TargetRailsVersion: 5.2 - Exclude: - - 'db/schema.rb' - - 'node_modules/**/*' - - 'vendor/**/*' + NewCops: disable Rails: Enabled: true -# Don't prefer is_a? over kind_of? -Style/ClassCheck: - Enabled: false - # Don't enforce certain methods, e.g. detect over find Style/CollectionMethods: Enabled: false -# Don't enforce documentation -Style/Documentation: - Enabled: false - -# Support both ruby19 and hash_rockets -Style/HashSyntax: - Enabled: false - -# Both double and single quotes are OK -Style/StringLiterals: - Enabled: false - # Don't enforce frozen string literals Style/FrozenStringLiteralComment: Enabled: false @@ -63,37 +47,12 @@ Layout/LineLength: Performance/Casecmp: Enabled: false -Performance/RedundantMatch: - Enabled: true - -Performance/RedundantMerge: - Enabled: true - -Rails/Blank: - UnlessPresent: false - -#Allow both ['a', 'b'], %w[a b] and %w(a b) style arrays -Style/WordArray: - Enabled: false - -Style/AndOr: - EnforcedStyle: conditionals - -Style/TernaryParentheses: - EnforcedStyle: require_parentheses_when_complex - Style/InverseMethods: Enabled: false -Layout/FirstArgumentIndentation: - EnforcedStyle: consistent - Bundler/OrderedGems: Enabled: false -Style/Alias: - EnforcedStyle: prefer_alias_method - Layout/DotPosition: Enabled: false @@ -103,9 +62,6 @@ Style/IfUnlessModifier: Style/ConditionalAssignment: Enabled: false -Style/EmptyMethod: - EnforcedStyle: expanded - Style/ParenthesesAroundCondition: Enabled: false @@ -115,10 +71,6 @@ Layout/HashAlignment: Layout/ParameterAlignment: Enabled: false -# disabled until we can configure "+" as concat sign -Style/LineEndConcatenation: - Enabled: false - Style/ParallelAssignment: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 47b952b..5cd84d9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,42 +1,102 @@ -Layout/ArgumentAlignment: - Enabled: false - -Layout/EmptyLinesAroundExceptionHandlingKeywords: - Enabled: false +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-03-29 20:21:11 UTC using RuboCop version 1.23.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. -Layout/EmptyLineAfterGuardClause: - Enabled: false +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'app/models/foreman_kubevirt/kubevirt.rb' +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space Layout/SpaceInsideHashLiteralBraces: - Enabled: false + Exclude: + - 'app/models/foreman_kubevirt/kubevirt.rb' +# Offense count: 1 Lint/RescueException: - Enabled: false + Exclude: + - 'app/models/foreman_kubevirt/kubevirt.rb' +# Offense count: 6 +# Cop supports --auto-correct. Lint/SendWithMixinArgument: - Enabled: false + Exclude: + - 'lib/foreman_kubevirt/engine.rb' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. Lint/UnusedMethodArgument: - Enabled: false + Exclude: + - 'app/models/foreman_kubevirt/kubevirt.rb' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: PreferredName. Naming/RescuedExceptionsVariableName: - Enabled: false + Exclude: + - 'Rakefile' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: **/Rakefile, **/*.rake +Rails/RakeEnvironment: + Exclude: + - 'lib/tasks/foreman_kubevirt_tasks.rake' + +# Offense count: 1 +# Configuration parameters: MinBodyLength. Style/GuardClause: - Enabled: false + Exclude: + - 'app/validators/volume_validator.rb' +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowedReceivers. Style/HashEachMethods: - Enabled: false + Exclude: + - 'app/models/foreman_kubevirt/kubevirt.rb' -Style/HashTransformKeys: - Enabled: false +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, MinBodyLength. +# SupportedStyles: skip_modifier_ifs, always +Style/Next: + Exclude: + - 'app/validators/volume_validator.rb' -Style/HashTransformValues: - Enabled: false +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'app/validators/volume_validator.rb' -Style/Next: - Enabled: false +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: . +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: percent + MinSize: 2 -Rails/RakeEnvironment: +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: Exclude: - - 'lib/tasks/foreman_kubevirt_tasks.rake' + - 'app/models/foreman_kubevirt/kubevirt.rb' + - 'test/unit/foreman_kubevirt_test.rb' diff --git a/foreman_kubevirt.gemspec b/foreman_kubevirt.gemspec index 9fd8241..bc79b5d 100644 --- a/foreman_kubevirt.gemspec +++ b/foreman_kubevirt.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.5', '< 4.0' - s.add_development_dependency('theforeman-rubocop', '~> 0.0.6') + s.add_development_dependency('theforeman-rubocop', '~> 0.1.0') s.add_dependency('fog-kubevirt', '~>1.3.3') end