Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zyadahmed
Copy link
Contributor

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.

Copy link
Member

@romani romani left a 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:

package resources.com.puppycrawl.tools.checkstyle.checks.hexliteralcase;

public class InputHexLiteralCaseCheck {
int i = 0xabc; // violation 'Should use uppercase hexadecimal digit instead of 'a, b, c'.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove instead of 'a, b, c' from message of Check, it is confusing.
Should use uppercase hexadecimal letters.

@@ -5,6 +5,7 @@ descendant.token.sum.max=Общее количество {0} превышает
descendant.token.sum.min=Общее количество {0} меньше, чем минимум {1} для ''{2}''.
final.parameter=Параметр {0} должен быть final.
forbid.escaped.unicode.char=Избегайте использования экранирующих символов Unicode.
hex.Literal=??????? ???????????? ????????????????? ????? ? ??????? ???????? ?????? ''{0}''.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use uncode.

same for others.

import com.puppycrawl.tools.checkstyle.api.TokenTypes;

/**
* <div>Checks that hexadecimal literals are defined using uppercase letters (A–F)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(A�F) lets avoid unicode here.

* </li>
* </ul>
*
* @since null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10.26.0

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be template file that will generate src/site/xdoc/checks/misc/hexliteralcase.xml ,please create it.

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.

2 participants