-
Notifications
You must be signed in to change notification settings - Fork 72
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 2 new rules NestedFunctionNames and UnnestedFunctionNames #522
Conversation
src/FSharpLint.Core/Rules/Conventions/Naming/UnnestedFunctionNames.fs
Outdated
Show resolved
Hide resolved
a331b3f
to
ace9409
Compare
@knocte thanks for the review. I've updated the PR with your suggestions. Could you please take a look? |
src/FSharpLint.Core/Rules/Conventions/Naming/NestedFunctionNames.fs
Outdated
Show resolved
Hide resolved
ace9409
to
7711a42
Compare
src/FSharpLint.Core/Rules/Conventions/Naming/UnnestedFunctionNames.fs
Outdated
Show resolved
Hide resolved
These rules allow configuring naming conventions for nested and unnested function names.
7711a42
to
faa1b39
Compare
| _ -> false | ||
|
||
let getFunctionIdents _ = | ||
function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of using the keyword function
here, can you just write a normal function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and better to rename _
to accessibility
or _accessibility
just to see what is being ignored
if isNested args args.NodeIndex then | ||
Array.empty | ||
else | ||
getPatternIdents Accessibility.Public getFunctionIdents true pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure we want to use Accessibility.Public here? we want all functions, even private and internal ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the Accessibility.Public
is used in this case. You think it's best to add a Both
or NotApplicable
member to the Accessibility
DU?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how can this be not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing Accessibility.Public
here means we start within public scope.
So it's getFunctionIdents
function that can decide what is included based on identifier's accessibility.
Which ignores accessibility parameter, and processes all functions.
Superseded by #564 |
These rules allow configuring naming conventions for nested and unnested function names.