-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Enhance Naming/MethodName cop to handle offenses within Struct members
#14325
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
Merged
bbatsov
merged 1 commit into
rubocop:master
from
viralpraxis:enhance-naming-method-name-cop-to-detect-offenses-within-struct-members
Jun 26, 2025
Merged
Enhance Naming/MethodName cop to handle offenses within Struct members
#14325
bbatsov
merged 1 commit into
rubocop:master
from
viralpraxis:enhance-naming-method-name-cop-to-detect-offenses-within-struct-members
Jun 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Your proposal seems reasonable. Looking at the specs I noticed that the cop doesn't also check for |
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jun 25, 2025
…hod` calls ref: rubocop#14325 (comment) ``` This patch enhances `Naming/MethodName` to detect these offenses: ```ruby define_method(:fooBar) {} # offense if style is `snake_case` define_method(:foo_bar) {} # offense if style is `camelCase` ```
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jun 25, 2025
…hod` calls ref: rubocop#14325 (comment) This patch enhances `Naming/MethodName` to detect these offenses: ```ruby define_method(:fooBar) {} # offense if style is `snake_case` define_method(:foo_bar) {} # offense if style is `camelCase` ```
7 tasks
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jun 26, 2025
…hod` calls ref: rubocop#14325 (comment) This patch enhances `Naming/MethodName` to detect these offenses: ```ruby define_method(:fooBar) {} # offense if style is `snake_case` define_method(:foo_bar) {} # offense if style is `camelCase` ```
bbatsov
pushed a commit
that referenced
this pull request
Jun 26, 2025
…hod` calls ref: #14325 (comment) This patch enhances `Naming/MethodName` to detect these offenses: ```ruby define_method(:fooBar) {} # offense if style is `snake_case` define_method(:foo_bar) {} # offense if style is `camelCase` ```
…mbers This patch enhances `Naming/MethodName` to detect these offenses: ```ruby Struct.new(:fooBar) # offense if style is `snake_case` Struct.new(:foo_bar) # offense if style is `camelCase` ``` Since the first argument of `Struct.new` might be a special string (`class_name`), it's ignored. See https://rubyapi.org/3.4/o/struct#method-c-new
dafcf4a to
60b0daa
Compare
|
This can be extended by also taking |
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jul 3, 2025
…hod` calls ref: rubocop#14325 (comment) This patch enhances `Naming/MethodName` to detect these offenses: ```ruby define_method(:fooBar) {} # offense if style is `snake_case` define_method(:foo_bar) {} # offense if style is `camelCase` ```
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jul 19, 2025
This is a follow-up to rubocop#14325.
7 tasks
viralpraxis
added a commit
to viralpraxis/rubocop
that referenced
this pull request
Jul 20, 2025
This is a follow-up to rubocop#14325.
5hun-s
pushed a commit
to 5hun-s/rubocop
that referenced
this pull request
Jul 21, 2025
This is a follow-up to rubocop#14325.
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch enhances
Naming/MethodNameto detect these offenses:Since the first argument of
Struct.newmight be a special string (class_name), it's ignored. See https://rubyapi.org/3.4/o/struct#method-c-newBefore submitting the PR make sure the following are checked:
master(if not - rebase it).bundle exec rake default. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.mdif the new code introduces user-observable changes. See changelog entry format for details.