Skip to content

Commit

Permalink
fix version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
swiknaba committed Mar 19, 2024
1 parent 34abeae commit ce5752b
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 90 deletions.
83 changes: 0 additions & 83 deletions config/cops/rails.yml

This file was deleted.

5 changes: 1 addition & 4 deletions config/dbl.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require:
- rubocop-packaging
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-sorbet

Expand All @@ -12,7 +11,6 @@ inherit_from:
- cops/metrics.yml
- cops/naming.yml
- cops/performance.yml
- cops/rails.yml
- cops/rspec.yml
- cops/style.yml
- cops/types.yml
Expand All @@ -22,7 +20,7 @@ inherit_from:
# see: https://docs.rubocop.org/rubocop/usage/caching.html
AllCops:
UseCache: true
TargetRubyVersion: 2.7.2
TargetRubyVersion: 3.0.0
NewCops: enable
Exclude:
- '**/tmp/**/*'
Expand All @@ -32,7 +30,6 @@ AllCops:
- 'actionmailbox/test/dummy/**/*'
- 'actiontext/test/dummy/**/*'
- '**/node_modules/**/*'
# Additional exclude files by rubocop-rails
- 'bin/**/*'
- 'config/**/*'
- 'db/**/*'
115 changes: 115 additions & 0 deletions lib/generators/rubocop_dbl/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class InstallGenerator < Rails::Generators::Base

def create_config_file
file_method = config_file_exists? ? :prepend : :create
content = defined?(Rails) ? config_file_content_rails : config_file_content
send :"#{file_method}_file", config_file_path, config_file_content
end

Expand All @@ -29,6 +30,120 @@ def config_file_content
inherit_gem:
rubocop-dbl:
- config/dbl.yml
# we do not want to overwrite the base-array (from rubocop-dbl), but extend it
inherit_mode:
merge:
- Exclude
AllCops:
TargetRubyVersion: 3.3.0
Exclude:
- 'sorbet/rbi/shims/**/*'
HEREDOC
end

def config_file_content
<<~HEREDOC
require:
- rubocop-rails
inherit_gem:
rubocop-dbl:
- config/dbl.yml
inherit_mode:
merge:
- Exclude
AllCops:
TargetRubyVersion: 3.3.0
Exclude:
- 'sorbet/rbi/shims/**/*'
# Defaults for this cop are found here:
# https://github.com/rubocop/rubocop-rails/blob/master/config/default.yml
#
# Add customizations below.
#
# Ensure to document why we change a default by linking the corresponding PR.
# For example:
#
# Rails/ActionFilter:
# Enabled: false
#
# @NOTE: added: "staging"
Rails/UnknownEnv:
Environments:
- production
- development
- test
- staging
# @NOTE: disabled
Rails/HttpStatus:
Enabled: false
# @NOTE: disabled
Rails/ApplicationController:
Enabled: false
#
# @NOTE: all the cops ahead are "pending" in the current default config
#
Rails/ActiveRecordCallbacksOrder:
Enabled: true
Rails/AfterCommitOverride:
Enabled: true
Rails/AttributeDefaultBlockValue:
Enabled: true
Rails/FindById:
Enabled: true
Rails/Inquiry:
Enabled: true
Rails/MailerName:
Enabled: true
Rails/MatchRoute:
Enabled: true
Rails/NegateInclude:
Enabled: true
Rails/Pluck:
Enabled: true
Rails/PluckInWhere:
Enabled: true
Rails/RenderInline:
Enabled: true
Rails/RenderPlainText:
Enabled: true
Rails/ShortI18n:
Enabled: true
EnforcedStyle: aggressive
Rails/SquishedSQLHeredocs:
Enabled: true
Rails/WhereEquals:
Enabled: true
Rails/WhereExists:
Enabled: true
Rails/WhereNot:
Enabled: true
HEREDOC
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop_dbl/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# typed: false

module RubocopDbl
VERSION = '1.2.0'.freeze
VERSION = '2.1.0'.freeze
end
3 changes: 1 addition & 2 deletions rubocop-dbl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ Gem::Specification.new do |spec|
]
spec.homepage = 'https://github.com/dbl-works/rubocop-dbl'
spec.license = 'MIT'
spec.required_ruby_version = '>= 2.7'
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'rubocop', '~> 1'
spec.add_dependency 'rubocop-ast', '~> 1'
spec.add_dependency 'rubocop-packaging', '~> 0.5'
spec.add_dependency 'rubocop-performance', '~> 1'
spec.add_dependency 'rubocop-rails', '~> 2'
spec.add_dependency 'rubocop-rspec', '~> 2'
spec.add_dependency 'rubocop-sorbet', '~> 0.6'

Expand Down

0 comments on commit ce5752b

Please sign in to comment.