-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Style/ConstantVisibility needs ♥️ #8724
Labels
Comments
Yeah, totally agreed. Lots of room for improvement there. |
8 tasks
tejasbubane
added a commit
to tejasbubane/rubocop
that referenced
this issue
Jan 28, 2021
To not register offense for module definitions. Issue rubocop#8724
bbatsov
pushed a commit
that referenced
this issue
Feb 14, 2021
To not register offense for module definitions. Issue #8724
This was referenced Mar 6, 2021
Closed
This was referenced Mar 15, 2021
This was referenced Mar 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Style::ConstantVisibility
cop has potential but could be made much more useful.False positives: it should detect
# @api private
(or# @api public
) in the associated comment, and also detect if the parent module is itself private (either viaprivate_constant
or@api private
).Modules vs literals: it should allow a config
'ExcludeModules'
to restrict detection of literals only (EXAMPLE = 42
, and notSomeClass = Struct.new()
). Typically nested modules and classes are public, but literals should be private.Auto-correction: it should offer auto-correction. A config option like
DefaultVisibility
could make it much nicer. Values could be:'private_constant'
,'public_constant'
,'@api private'
, or'@api public'
. Autocorrector should be mindful of constants containing heredocs and/or assignments ending with comments.The text was updated successfully, but these errors were encountered: