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

Add 2 new rules NestedFunctionNames and UnnestedFunctionNames #522

Closed
wants to merge 1 commit into from

Conversation

su8898
Copy link
Contributor

@su8898 su8898 commented Nov 22, 2021

These rules allow configuring naming conventions for nested and unnested function names.

@su8898
Copy link
Contributor Author

su8898 commented Nov 23, 2021

@knocte thanks for the review. I've updated the PR with your suggestions. Could you please take a look?

These rules allow configuring naming conventions for nested and unnested function names.
| _ -> false

let getFunctionIdents _ =
function
Copy link
Collaborator

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?

Copy link
Contributor

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
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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?

Copy link
Contributor

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.

@knocte
Copy link
Collaborator

knocte commented Aug 3, 2022

Superseded by #564

@knocte knocte closed this Aug 3, 2022
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

Successfully merging this pull request may close these issues.

3 participants