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

Style/FileName should accept a regex parameter #1545

Closed
lloeki opened this issue Dec 31, 2014 · 11 comments
Closed

Style/FileName should accept a regex parameter #1545

lloeki opened this issue Dec 31, 2014 · 11 comments

Comments

@lloeki
Copy link
Contributor

lloeki commented Dec 31, 2014

Homebrew has formula files with dashes, but otherwise respect the convention, while other projects may have stricter rules than the default. Having a regex parameter available to enforce one's own rules will certainly be useful.

@ixio
Copy link

ixio commented Oct 19, 2015

Same thing for Style/CommentAnnotation, I don't really like to add a colon in

TODO comment about stuff

But in order to just drop the colon from the rule it seems like my only option is to use a rubocop fork. It would be much better if the format was detailed in a regex that I could change in my .rubocop.yml conf file.

@alexdowad
Copy link
Contributor

Having a regex parameter available to enforce one's own rules will certainly be useful.

Are you looking for a "good" regex which must match, or a "bad" regex which must not match?

@alexdowad
Copy link
Contributor

Same thing for Style/CommentAnnotation, I don't really like to add a colon in
TODO comment about stuff

Hmm. If there is enough demand for this, I would code something up, but I doubt that there is. I am inclined to suggest that a custom cop would be your best bet.

Right now we don't have an official, documented API for custom cops, but there will be before long.

@alexdowad
Copy link
Contributor

Ping @lloeki.

@lloeki
Copy link
Contributor Author

lloeki commented Dec 29, 2015

The "good" one, looking for a match.

@alexdowad
Copy link
Contributor

Maintainers, what do you say?

@jonas054
Copy link
Collaborator

A positive regex for how file names should look sounds good to me.

@alexdowad
Copy link
Contributor

Should the regex be applied only to the basename? Or the entire path? Or each component of the path individually?

@jonas054
Copy link
Collaborator

Only the basename is ok for me. I think that's what we're checking today.

@alexdowad
Copy link
Contributor

Do we drop the .rb suffix (and other suffixes) before applying the regex?

@alexdowad
Copy link
Contributor

I think I know the answer. Opening PR now.

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

No branches or pull requests

4 participants