Skip to content
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

Java source normalization (fixes #516) #631

Open
wants to merge 3 commits into
base: integration
Choose a base branch
from

Conversation

svanteschubert
Copy link
Contributor

I have fixed the same problem today for the ODF Toolkit: tdf/odftoolkit#50

Using the Google Java Formatter:
https:/google/google-java-format

Capsulated by the following Maven plugin:
https:/Cosium/maven-git-code-format
adding a pre-commit-hook for checking the Java code.

You might reproduce the patch by:

  1. Add the plugin to the pom.xml (as in the first commit)
  2. Start manual formatting on the sources by command line via:
    mvn -X git-code-format:format-code -Dgcf.globPattern=**/*
    There will be half a dozen problems with comments of unused imports within the Java imports, which breaks the formatting, but after the manual fixes, you will come to my patch.

NOTE: The ODF Toolkit is using in addition to the above Java formatter a whitespace formatter for the text files:
https://ec4j.github.io/editorconfig-maven-plugin/

See in https:/tdf/odftoolkit/blob/master/pom.xml#L257
and its configs:
https:/tdf/odftoolkit/blob/master/.editorconfig

@codecov
Copy link

codecov bot commented Jun 27, 2020

Codecov Report

Merging #631 into integration will increase coverage by 0.05%.
The diff coverage is 58.31%.

Impacted file tree graph

@@                Coverage Diff                @@
##             integration     #631      +/-   ##
=================================================
+ Coverage          45.63%   45.69%   +0.05%     
  Complexity          1046     1046              
=================================================
  Files                 57       57              
  Lines               9149     8783     -366     
  Branches            1687     1679       -8     
=================================================
- Hits                4175     4013     -162     
+ Misses              4424     4225     -199     
+ Partials             550      545       -5     
Impacted Files Coverage Δ Complexity Δ
...u/harvard/hul/ois/jhove/AnalogDigitalFlagType.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../edu/harvard/hul/ois/jhove/ByteArrayXMPSource.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...du/harvard/hul/ois/jhove/CoreMessageConstants.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../edu/harvard/hul/ois/jhove/CountedInputStream.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../src/main/java/edu/harvard/hul/ois/jhove/Dump.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...java/edu/harvard/hul/ois/jhove/JhoveException.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../main/java/edu/harvard/hul/ois/jhove/MacStuff.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ain/java/edu/harvard/hul/ois/jhove/ModuleBase.java 51.27% <ø> (+0.24%) 74.00 <0.00> (ø)
...ain/java/edu/harvard/hul/ois/jhove/ModuleInfo.java 57.14% <ø> (ø) 1.00 <0.00> (ø)
...a/edu/harvard/hul/ois/jhove/NisoImageMetadata.java 75.99% <ø> (ø) 182.00 <0.00> (ø)
... and 76 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47f077f...43264c1. Read the comment docs.

@svanteschubert
Copy link
Contributor Author

Please note, that this normalization step causes a lot of noise to prevent noise in the future.
You might want to consider to merge other pull requests prior, or the pull requests have to do the normalization themselves (fixes all the import problems). Perhaps those import problems should be separated first? Your call :-)

@carlwilson carlwilson self-assigned this Apr 7, 2022
@carlwilson carlwilson added bug A product defect that needs fixing P3 Low priority bugs labels Apr 7, 2022
@carlwilson
Copy link
Member

Now we're back up and running properly, I'm interested. I'll look to reproduce this once 1.26 is out of the door.

@carlwilson carlwilson added this to the JHOVE 1.28 milestone Nov 30, 2022
@carlwilson carlwilson removed this from the JHOVE 1.28 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A product defect that needs fixing P3 Low priority bugs
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants