-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Make rule file_name accept the ending Extension
for extensions
#2309
Comments
Can you point to some projects that use this convention just for future reference? |
Now that you asked the question I looked it up and couldn't find many bigger projects using this naming convention. I could swear this was a thing at some point, but it seems I'm the only one using this style, for example here, there and there. Now I'm not so sure about making this the default behavior any more, we could also make it an option. But on the other hand it wouldn't hurt to allow the ending |
I'm wondering if we should support a more generic |
Sounds good to me. That would be an array of strings then, no? I'm going to implement it that way later this day and update this PR accordingly. |
The project I'm currently working on uses |
Okay, then let's add |
@marcelofabri @ornithocoder I just updated my implementation in this PR to support two new options:
For me, I would need to specify the following to get my expected behavior: file_name:
suffix_pattern: "Extensions?|\\+.*" For @ornithocoder this could be the following: file_name:
prefix_pattern: "Extension"
suffix_pattern: "" Please note that the current behavior of accepting a I think this is the most customizable solution, both allowing defining custom allowed prefixes and suffixes using regexes and additionally giving the option to turn the default suffix behavior off, if needed. |
Hi @Dschee, I am confusing about the |
Hi @dregatos, you don't need to put in the |
Thanks a lot for the help!! |
Currently the rule
file_name
shows a warning when there's a file namedBoolExtension
which looks like the following:Extensions are either named
<Type>Extension
or<Type>+MyProject
in the Swift community which I think should both be exceptions in this rule. As far as I could see, there's already an exception implemented for the latter, but not for the first.I highly recommend to make this acceptance the default behavior as in my opinion these are false positives. But we could also make this a configuration option if really need be ...
The text was updated successfully, but these errors were encountered: