Skip to content

Commit

Permalink
Enable class and module children cop (#549)
Browse files Browse the repository at this point in the history
https://docs.rubocop.org/rubocop/cops_style.html#styleclassandmodulechildren

there was some discussion in the ruby guild meeting and in slack

https://ackama.slack.com/archives/CTXRR56JD/p1715895284411699

we eventually agreed it was better for consistency

and also for it's a rubocop default and people expect the autocorrect to
happen

Co-authored-by: Eoin Kelly <[email protected]>
  • Loading branch information
robotdana and eoinkelly authored Aug 31, 2024
1 parent ef8d04a commit 4a1ed87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ Rails/Output:
Style/BarePercentLiterals:
EnforcedStyle: percent_q

Style/ClassAndModuleChildren:
Enabled: false

Style/DoubleNegation:
Enabled: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
# Copied from
# https://github.com/rails/rails/blob/main/activestorage/app/controllers/active_storage/base_controller.rb
# :nocov:
class ActiveStorage::BaseController < ActionController::Base # rubocop:disable Rails/ApplicationController
include ActiveStorage::SetCurrent
module ActiveStorage
class BaseController < ActionController::Base # rubocop:disable Rails/ApplicationController
include ActiveStorage::SetCurrent

protect_from_forgery with: :exception
protect_from_forgery with: :exception

before_action :authenticated?
before_action :authenticated?

self.etag_with_template_digest = false
self.etag_with_template_digest = false

private
private

# ActiveStorage defaults to security via obscurity approach to serving links
# If this is acceptable for your use case then this authenticable test can be
# removed. If not then code should be added to only serve files appropriately.
# https://edgeguides.rubyonrails.org/active_storage_overview.html#proxy-mode
def authenticated?
raise StandardError, "No authentication is configured for ActiveStorage"
# ActiveStorage defaults to security via obscurity approach to serving links
# If this is acceptable for your use case then this authenticable test can be
# removed. If not then code should be added to only serve files appropriately.
# https://edgeguides.rubyonrails.org/active_storage_overview.html#proxy-mode
def authenticated?
raise StandardError, "No authentication is configured for ActiveStorage"
end
end
end
# :nocov:
3 changes: 0 additions & 3 deletions variants/backend-base/rubocop.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,6 @@ Rails/Output:
Style/BarePercentLiterals:
EnforcedStyle: percent_q

Style/ClassAndModuleChildren:
Enabled: false

Style/DoubleNegation:
Enabled: false

Expand Down

0 comments on commit 4a1ed87

Please sign in to comment.