Skip to content

Conversation

@WolframPfeifer
Copy link
Member

This is a refined version of #3498. It removes the Eclipse formatter version lock (not needed any more, since the bug in the formatter has been fixed). In addition, it adds a small Java utility that can be used to merge two XML code style files.

New tool for merging Eclipse code style files: Every few versions, the Eclipse formatter comes with a few new options for configuration. It was a very annoying to find out which keys are missing in the style file scripts/tools/checkstyle/keyCodeStyle.xml, so this PR adds a small tool to merge two such files. It resides in the same directory as the style file.

The easiest way to add the new options to our style file is to open the Eclipse GUI and export the style (in this example to scripts/tools/checkstyle/eclipse.xml). The styles could then be merged like this:

cd scripts/tools/checkstyle
cp keyCodeStyle.xml keyCodeStyle_old.xml
# optionally, the flag --overwriteValues can be used to replace all the old values with those set in eclipse.xml
java CodeStyleMerger.java keyCodeStyle_old.xml eclipse.xml keyCodeStyle.xml

Afterwards, since the tool makes sure to sort the entries by the keys, it can be easily seen via git diff keyCodeStyle.xml what has changes. Optionally, you can now set the values of the new keys (by manually editing the file).

In contrast to #3498, the formatter is configured to not touch code blocks in comments.

Intended Change

  • removes formatter version lock
  • adds tool for merging style files
  • slightly changes style (disable formatting of code blocks in comments/JavaDoc)
  • applies the new style

Type of pull request

  • New feature (non-breaking change which adds functionality)
  • There are changes to the deployment/CI infrastructure (gradle, github, ...): Small change of the code style
  • Other: There is a new tool for developers

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

@WolframPfeifer WolframPfeifer requested a review from wadoon December 5, 2024 16:55
@WolframPfeifer WolframPfeifer self-assigned this Dec 5, 2024
@WolframPfeifer WolframPfeifer added Feature New feature or request Deployment Infrastructure Changes to the Github configurations, repository or other non-source stuff 🛠 Maintenance Code quality and related things w/o functional changes Ignore in Changelog If given, a PR will not be considered for Changelog generation. Use this on unimportant stuff. labels Dec 5, 2024
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2024

@wadoon wadoon added this pull request to the merge queue Dec 5, 2024
Merged via the queue into main with commit 1b3f51f Dec 5, 2024
10 checks passed
@wadoon wadoon deleted the pfeifer/codeStyleMerger branch December 5, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deployment Feature New feature or request Ignore in Changelog If given, a PR will not be considered for Changelog generation. Use this on unimportant stuff. Infrastructure Changes to the Github configurations, repository or other non-source stuff 🛠 Maintenance Code quality and related things w/o functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants