Skip to content

Conversation

zyadahmed
Copy link
Contributor

@zyadahmed zyadahmed commented Jun 16, 2025

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.

New module config:
https://gist.githubusercontent.com/zyadahmed/8e0dfa0fc6f3a178fa0c18f3f7fac452/raw/77a0d5b0cfa7c9c965eadbbea5d0fb0d873090b9/gistfile1.txt

Contribution PR link: checkstyle/contribution#950

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:

@zyadahmed zyadahmed force-pushed the HexLiteralCase branch 4 times, most recently from 91b3b7a to 6bcc5b5 Compare June 24, 2025 21:24
@romani
Copy link
Member

romani commented Jun 25, 2025

All CIs should be green.
Please reply "done" to each comment as you finished addressing it

@zyadahmed
Copy link
Contributor Author

All CIs should be green. Please reply "done" to each comment as you finished addressing it

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 ?

@romani
Copy link
Member

romani commented Jun 27, 2025

This single failure is expected for new Check.
This is unfortunate until we fix #7304

@romani
Copy link
Member

romani commented Jun 27, 2025

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)

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.

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>.
Copy link
Member

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

Copy link
Contributor Author

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 {
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

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

Copy link
Contributor Author

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;


Copy link
Member

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

Copy link
Contributor Author

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.'
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

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);
}

}
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@zyadahmed zyadahmed force-pushed the HexLiteralCase branch 2 times, most recently from 39473cd to 647dc3f Compare June 27, 2025 12:10
@zyadahmed
Copy link
Contributor Author

github, generate report

1 similar comment
@zyadahmed
Copy link
Contributor Author

github, generate report

@romani
Copy link
Member

romani commented Jun 27, 2025

You need to put link to config in PR description .
Please read https://github.com/checkstyle/contribution/tree/master/checkstyle-tester#generation-examples
New module config:

@zyadahmed
Copy link
Contributor Author

GitHub, generate report

@zyadahmed zyadahmed force-pushed the HexLiteralCase branch 2 times, most recently from 853e11f to e8c59a9 Compare June 28, 2025 21:46
@zyadahmed
Copy link
Contributor Author

Github, generate report for configs in PR description

Copy link
Contributor

Report generation failed. Please check the logs for more details.

Link: https://github.com/checkstyle/checkstyle/actions/runs/15948633638

@zyadahmed
Copy link
Contributor Author

@romani can you help in remaing steps if possible

@romani
Copy link
Member

romani commented Jul 20, 2025

you need to create in Gist config file that contains your new Check , and put in PR description after New module config:.
see example at #16489 , #17075
after that triggering report will work.
please rebase on latest code, a lot was changed in last 3 weeks, we are on jdk17 now.

@zyadahmed
Copy link
Contributor Author

@romani hello romani i added Gist config and rebase but it seems something wrong with new jdk version apprecaite your support and sorry for long pr

@romani
Copy link
Member

romani commented Sep 11, 2025

[ERROR] XdocsPagesTest.generateXdocContent:283 » NullPointer

Please debug this test, it is not a test actually, it is generator of xdoc files. You might need to update your documentation on Check to comply with our new rules on it.
Just look how it is done in sibling checks and in same way

@zyadahmed
Copy link
Contributor Author

Github, generate report

@zyadahmed
Copy link
Contributor Author

Github, generate report for configs in PR description

Copy link
Contributor

Report generation failed. Please check the logs for more details.

Link: https://github.com/checkstyle/checkstyle/actions/runs/17653228519

@zyadahmed
Copy link
Contributor Author

Github, generate report

1 similar comment
@zyadahmed
Copy link
Contributor Author

Github, generate report

@zyadahmed
Copy link
Contributor Author

GitHub, generate website

@zyadahmed zyadahmed requested a review from romani September 12, 2025 08:25
@zyadahmed
Copy link
Contributor Author

Github, generate report for configs in PR description

Copy link
Contributor

Report generation failed. Please check the logs for more details.

Link: https://github.com/checkstyle/checkstyle/actions/runs/17675862817

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