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

[Doc] Add config.generators.after_generate Rails config to docs #956

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

koic
Copy link
Member

@koic koic commented Mar 17, 2023

This PR adds a Rails feature introduced by rails/rails#38870 to docs.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

README.md Outdated
module YourCoolApp
class Application < Rails::Application
config.generators.after_generate do |files|
system('bundle exec rubocop -A ' + files.join(' '), exception: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would -a have a different result for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows -A intentionally. I've added that intent to the documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be files.shelljoin instead? What if some homebrew generator spits out filenames with spaces or escape sequences?

Passing raw strings to system is scary. 😨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good cath! shelljoin would be a better choice.

@koic koic force-pushed the add_rails_tips_to_docs branch 2 times, most recently from 1b30576 to e55e26a Compare March 18, 2023 09:29
This PR adds a Rails feature introduced by rails/rails#38870 to docs.
@koic koic merged commit 735ca46 into rubocop:master Mar 22, 2023
@koic koic deleted the add_rails_tips_to_docs branch March 22, 2023 16:54
tmaier added a commit to tmaier/rubocop-rails that referenced this pull request Mar 26, 2023
Without this, the generator would exit with an error, if it found any
warning or less severe offenses.

Related to rubocop#956
tmaier added a commit to tmaier/rubocop-rails that referenced this pull request Apr 5, 2023
Files not supported by rubocop would lead to an error, which in turn would mean that the rails generate command would fail.

We are going to filter the files to ensure unsupported files are not sent to rubocop

Followup for rubocop#961 and rubocop#956
tmaier added a commit to tmaier/rubocop-rails that referenced this pull request Apr 5, 2023
Files not supported by rubocop would lead to an error, which in turn would mean that the rails generate command would fail.

We are going to filter the files to ensure unsupported files are not sent to rubocop

Follow-up for rubocop#961 and rubocop#956
tmaier added a commit to tmaier/rubocop-rails that referenced this pull request Apr 12, 2023
Previously, the 'rails generate' command would send unsupported files to
Rubocop,causing errors and failures in the process.
To fix this, we added a filter that only sends parsable
files to Rubocop.

This commit updates the documentation to reflect this change,
helping users avoid errors and complete
'rails generate' command successfully.

Follow-up to rubocop#961 and rubocop#956
tmaier added a commit to tmaier/rubocop-rails that referenced this pull request Apr 12, 2023
Previously, the 'rails generate' command would send unsupported files to
Rubocop, causing errors and failures in the process.
To fix this, we added a filter that only sends parsable
files to Rubocop.

This commit updates the documentation to reflect this change,
helping users avoid errors and complete
'rails generate' command successfully.

Follow-up to rubocop#961 and rubocop#956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants