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

Add logic to ensure badge information (Department/Name) in CamelCase #10271

Merged
merged 4 commits into from Mar 9, 2022

Conversation

timtoronto634
Copy link
Contributor

@timtoronto634 timtoronto634 commented Nov 26, 2021

This PR enforces the badge information (Department/Name) is stored in CamelCase.

Before, the budge information can be stored in snake_case, and so I could run, for example, bundle exec rake 'new_cop[ex_snake/case]' .
This, however, creates a file lib/rubocop/cop/ex_snake/case.rb with class name in lowercase, and results in syntax error.

 class/module name must be CONSTANT (SyntaxError)

The expected behavior would be either A. return error when task is called or B. create files with CamelCase
This PR implemented B

I first fixed how the template file is prepared, but noticed that this PR is more straightforward. I recognize that the potential influence can be larger than just fixing template, but I did not find any problem so far. Also this is better solution in a sense that the badge does not expect the infos to be in snake_case.


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.

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 29, 2021

I think the change is fine, but we also need some tests that show the problem you mentioned has been solved.

@bbatsov bbatsov merged commit bfc6bfb into rubocop:master Mar 9, 2022
@timtoronto634 timtoronto634 deleted the ensure_badge_in_camelcase branch September 1, 2022 23:51
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

2 participants