#460: Ignoring backticks#461
#460: Ignoring backticks#461kober32 wants to merge 3 commits intosleekbyte:masterfrom kober32:jk-460-ignoring-backticks
Conversation
[constant-naming], [lower-camel-case] and [constant-k-prefix] rules are now evaluated without backticks
adityatrivedi
left a comment
There was a problem hiding this comment.
Thank you for your contribution @kober32! We are delighted to see the community step in to aid Tailor's evolution!
|
|
||
| @Test | ||
| public void testBacktickEscapedIdentifier() { | ||
| // Backticks are not part of the identifier |
There was a problem hiding this comment.
Maybe we could also test inputs like ``, single character strings, and empty strings to exercise all execution paths?
| public void enterTopLevel(TopLevelContext topLevelCtx) { | ||
| List<IdentifierContext> names = DeclarationListener.getVariableNames(topLevelCtx); | ||
| names.forEach(ctx -> verifyLowerCamelCase(Messages.VARIABLE + Messages.NAMES, ctx)); | ||
| names.forEach(ctx -> verifyLowerCamelCase(Messages.VARIABLE + Messages.NAMES, ctx, true)); |
There was a problem hiding this comment.
Can you please add some representative functional tests to ConstantNamingTest.swift and LowerCamelCaseTest.swift?
|
|
||
| private void verifyLowerCamelCase(String constructType, ParserRuleContext ctx) { | ||
| String constructName = ctx.getText(); | ||
| private void verifyLowerCamelCase(String constructType, ParserRuleContext ctx, Boolean unescapeIdentifier) { |
There was a problem hiding this comment.
considering unescapeIdentifier is only true for variable and constant names, could you please make an overloaded function verifyLowerCamelCase(constructType, ctx) that calls this function with unescapeIdentifier set to false (so we don't have to keep passing in false).
|
Hi guys. Thanks for your comments. I will update the PR asap. j. |
|
Closing this PR and tracking changes under #477. |
#460 Added util function for removing backticks (`) from variables and constants.
Using this function on
[constant-naming],[lower-camel-case], and[constant-k-prefix]rules