-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Issue #16836: New Check HexLiteralCase #17233
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
base: master
Are you sure you want to change the base?
Conversation
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.
thanks a lot,
Please read and watch videos at Starting_Development.
Please make CI green. There are videos on CI handling.
items:
...esources/com/puppycrawl/tools/checkstyle/checks/hexliteralcase/InputHexLiteralCaseCheck.java
Outdated
Show resolved
Hide resolved
src/main/resources/com/puppycrawl/tools/checkstyle/checks/messages_ru.properties
Outdated
Show resolved
Hide resolved
src/main/java/com/puppycrawl/tools/checkstyle/checks/HexLiteralCaseCheck.java
Outdated
Show resolved
Hide resolved
src/main/java/com/puppycrawl/tools/checkstyle/checks/HexLiteralCaseCheck.java
Outdated
Show resolved
Hide resolved
91b3b7a
to
6bcc5b5
Compare
All CIs should be green. |
6bcc5b5
to
f692241
Compare
d0fe5c9
to
855949d
Compare
for the ci/semaphore created pr in checkstyle/contribution and added the pr link in description is that the correct way or am i missing something ? |
This single failure is expected for new Check. |
Please move to next phase, testing on real sources. Please review #16946 , as example of how user put config in description of PR, and triggered execution by comment #16946 (comment) |
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.
Items
* <div>Checks that hexadecimal literals are defined using uppercase letters {@code (A-F)} | ||
* rather than lowercase {@code (a-f)}. This follows the | ||
* <a href="https://cr.openjdk.org/~alundblad/styleguide/index-v6.html#toc-literals"> | ||
* OpenJDK Style Guide</a>. |
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.
We can not rely on link for description.
It might be broken soon, we need to copy all details on how bit work to Check description
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.
done
|
||
@Test | ||
public void testCheck() | ||
throws Exception { |
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.
Move this method to the end of class , to group together technical coverage of token method
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.
done
int a = 0xABC; | ||
int k = 0XCAFEBAB1; | ||
long d = 0Xf123L; // violation 'Should use uppercase hexadecimal letters.' | ||
int binaryValue = 0b1010; |
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.
For each line with violation please add kind of same line but without violation, that would be result of what vis expected refactoring from violated
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.
done
int binaryValue = 0b1010; | ||
int num = 1; | ||
|
||
|
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.
Please add way more items to testing
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.
done
class Example1 { | ||
int a = 0xabc; // violation 'Should use uppercase hexadecimal letters.' | ||
int b = 0xABC; | ||
long l = 0Xf123L; // violation 'Should use uppercase hexadecimal letters.' |
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.
All from examples guidelines should be as examples in our website
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.
done
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.
All from issue description, should be in example.
runVerifications(config, fileProcess, expected, expectedXpathQueries); | ||
} | ||
|
||
} |
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.
Please add one more, we usually ask for 3 tests for xpath
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.
done
39473cd
to
647dc3f
Compare
github, generate report |
1 similar comment
github, generate report |
You need to put link to config in PR description . |
647dc3f
to
1db13d3
Compare
GitHub, generate report |
1db13d3
to
853e11f
Compare
853e11f
to
e8c59a9
Compare
Github, generate report for configs in PR description |
Report generation failed. Please check the logs for more details. |
Issue: #16836
New HexLiteralCase check that verifies hexadecimal number literals contain only uppercase letters (A–F). If any lowercase letters are found, a violation is raised with the message:
Should use uppercase hexadecimal digit instead of ''{0}''
where {0} is replaced with that violated digits.Contribution PR link: checkstyle/contribution#950