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

Use theforeman-rubocop gem #74

Merged
merged 1 commit into from
Apr 5, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
rubocop:
name: Rubocop
uses: theforeman/actions/.github/workflows/rubocop.yml@v0
with:
command: bundle exec rubocop --parallel --format github

test:
name: Ruby
Expand Down
11 changes: 5 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
AllCops:
TargetRubyVersion: 2.5
TargetRailsVersion: 6.0
inherit_from: .rubocop_todo.yml

Style/Documentation:
Enabled: false
inherit_gem:
theforeman-rubocop:
- default.yml

Metrics:
Enabled: false
Expand All @@ -21,4 +20,4 @@ Style/ClassAndModuleChildren:
Enabled: false

Style/StringLiterals:
Enabled: false
Enabled: false
140 changes: 140 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-04-02 08:55:39 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.

# Offense count: 53
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_argument, with_fixed_indentation
Layout/ArgumentAlignment:
Exclude:
- 'app/controllers/api/v2/webhook_templates_controller.rb'
- 'app/controllers/concerns/foreman_webhooks/controller/parameters/webhook.rb'
- 'app/services/foreman_webhooks/webhook_service.rb'
- 'app/views/api/v2/webhooks/show.json.rabl'
- 'config/routes.rb'
- 'lib/foreman_webhooks/engine.rb'

# Offense count: 4
# Cop supports --auto-correct.
Minitest/RefuteFalse:
Exclude:
- 'test/controllers/api/v2/webhook_templates_controller_test.rb'
- 'test/controllers/api/v2/webhooks_controller_test.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: **/test/**/*
Rails/AssertNot:
Exclude:
- 'test/controllers/api/v2/webhook_templates_controller_test.rb'
- 'test/controllers/api/v2/webhooks_controller_test.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers.
# Whitelist: find_by_sql
# AllowedMethods: find_by_sql
# AllowedReceivers: Gem::Specification
Rails/DynamicFindBy:
Exclude:
- 'test/controllers/api/v2/webhook_templates_controller_test.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include, IgnoredMethods.
# Include: app/models/**/*.rb
# IgnoredMethods: order, limit, select, lock
Rails/FindEach:
Exclude:
- 'app/models/webhook.rb'

# Offense count: 1
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/webhook_template.rb'

# Offense count: 2
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Exclude:
- 'app/models/webhook.rb'
- 'app/models/webhook_template.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
Rails/Present:
Exclude:
- 'app/controllers/concerns/foreman_webhooks/controller/parameters/webhook.rb'
- 'app/services/foreman_webhooks/webhook_service.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'lib/tasks/foreman_webhooks_tasks.rake'

# Offense count: 2
# Cop supports --auto-correct.
Rails/RedundantForeignKey:
Exclude:
- 'app/models/webhook.rb'
- 'app/models/webhook_template.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, Include.
# SupportedStyles: assert_not, refute
# Include: **/test/**/*
Rails/RefuteMethods:
Exclude:
- 'test/controllers/api/v2/webhook_templates_controller_test.rb'
- 'test/models/webhook_test.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'app/controllers/api/v2/webhook_templates_controller.rb'
- 'app/controllers/api/v2/webhooks_controller.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
Exclude:
- 'config/routes.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral:
Exclude:
- 'lib/foreman_webhooks/engine.rb'

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'app/lib/foreman_webhooks/renderer/scope/webhook_template.rb'
- 'app/models/webhook.rb'
- 'app/services/foreman_webhooks/webhook_service.rb'
- 'db/migrate/20200907232758_rename_webhook_permissions.rb'
- 'test/unit/foreman_webhooks/webhook_service_test.rb'
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ source 'https://rubygems.org'

gemspec

group :test do
gem 'rubocop'
gem 'rubocop-minitest'
gem 'rubocop-performance'
gem 'rubocop-rails'
end
gem 'theforeman-rubocop', '~> 0.1.0'
Loading