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
Identifier name #5140
Open
mredig
wants to merge
17
commits into
realm:main
Choose a base branch
from
mredig:identifier-name
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Identifier name #5140
+406
−138
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fix) identifier name can now handle backtick escaped names (refactor) remove deprecated values from tests
but default is now to actually evaluate function name lengths
additional values it should not be
both length and non alphanumeric character evaluation was being ignored in the previous code. also use it to allow for older behavior in both cases
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors
identifier_name
to use the newerSwiftSyntaxRule
protocol to enable a new option to disable minimum variable length within short closures.Basically, I want to be able to make these kinds of closures:
or
As a side effect, the first test I ran showed that the previous rule's code didn't evaluate functions for a couple promises from the rule's description:
As stated there, function names should be limited to alphanumeric characters, start with a lowercase character, and not be too long or too short. (Okay, so as I'm writing this, I see that only
Variable names
is specifically called out for length limitations, but wouldn't we want that on functions too? If we want to adjust that, I'll happily do so, just not tonight!)Anyways, I defaulted to what the description says (or at least what I thought it said until a moment ago), but added a configuration option to revert to the older behavior.