-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 implement rubocop #15
Conversation
config.generators.after_generate do |files| | ||
parsable_files = files.filter { |file| file.end_with?('.rb') } | ||
unless parsable_files.empty? | ||
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the rubocop documentation, this will autocorrect issues when using rails g
# This cop enforces that private methods are defined using | ||
# `private def` for instance methods or | ||
# `private_class_method def self` for class methods. | ||
class PrivateMethodStyle < Base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a personal preference. I like having each method inlined with the modifier. IMO this makes is more clear and future developers won't need to find the visibility modifier to make sure that new private methods are within that scope.
# frozen_string_literal: true | ||
|
||
# Load all Ruby files in the custom directory | ||
Dir[File.join(__dir__, "**/*.rb")].each { |file| require file } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensures that the custom cops are required in the .rubocop.yml
file. This is a forward fix that will make sure that any new cops are automatically included.
__dir__
Returns the canonicalized absolute path of the directory of the file from which this method is called
Documentation link
Closes #1