Skip to content

Commit

Permalink
Exclude RoR templates from Rubocop config - they're not interpolated …
Browse files Browse the repository at this point in the history
…by Rubocop anyway
  • Loading branch information
mateuszgorniak committed Dec 31, 2024
1 parent 10ec941 commit a501774
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ inherit_from: .rubocop_todo.yml
require: rubocop-minitest

AllCops:
Exclude:
- lib/generators/deploy_pin/**/templates/**/*.rb
NewCops: disable
TargetRubyVersion: 3.1

Expand Down
14 changes: 3 additions & 11 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-12-02 23:40:15 UTC using RuboCop version 1.69.0.
# on 2024-12-31 14:02:36 UTC using RuboCop version 1.69.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
Expand All @@ -23,16 +23,10 @@ Lint/Void:
Metrics/AbcSize:
Max: 20

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 29

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 109
Max: 105

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Expand All @@ -57,7 +51,7 @@ Security/Eval:
Exclude:
- 'lib/deploy_pin/task.rb'

# Offense count: 13
# Offense count: 11
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
Expand All @@ -73,9 +67,7 @@ Style/Documentation:
- 'lib/deploy_pin/task.rb'
- 'lib/deploy_pin/task_criteria.rb'
- 'lib/generators/deploy_pin/install/install_generator.rb'
- 'lib/generators/deploy_pin/install/templates/create_deploy_pins.rb'
- 'lib/generators/deploy_pin/task/task_generator.rb'
- 'lib/generators/deploy_pin/upgrade/templates/upgrade_deploy_pins.rb'

# Offense count: 2
Style/MixinUsage:
Expand Down
8 changes: 6 additions & 2 deletions lib/generators/deploy_pin/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ def copy_initializer
template 'deploy_pin.rb', 'config/initializers/deploy_pin.rb'
end

def migration_version
"[#{ActiveRecord::Migration.current_version}]"
def activerecord_migration_class
if ::ActiveRecord::Migration.respond_to?(:current_version)
"ActiveRecord::Migration[#{::ActiveRecord::Migration.current_version}]"
else
'ActiveRecord::Migration'
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class CreateDeployPins < ActiveRecord::Migration<%= migration_version %>
class CreateDeployPins < <%= activerecord_migration_class %>
def change
create_table :deploy_pins do |t|
t.string :uuid
Expand Down

0 comments on commit a501774

Please sign in to comment.