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

Update Checkstyle and JaCoCo to fix build #637

Merged
merged 6 commits into from May 19, 2022
Merged

Conversation

beatngu13
Copy link
Member

@beatngu13 beatngu13 commented May 18, 2022

Please pay attention to the commit messages, which include links to the corresponding Checkstyle release notes / PRs.

Regarding the message of the last commit, which removes validateThrows:

Remove validateThrows

Since the property allowMissingThrowsTags has been removed,
validateThrows now means you can no longer omit @throws in Javadoc.
Whenever a method declares throws, it must be documented.

Furthermore, Checkstyle authors say:

If you need to validate @throws please enable property
validateThrows but please read documentation as there some
limitations -
https://checkstyle.org/config_javadoc.html#JavadocMethod .
Old documentation is at
https://checkstyle.sourceforge.io/version/8.27/config_javadoc.html#JavadocMethod

Keeping validateThrows would cause the following 8 violations:

File /.../junit-pioneer/src/main/java/org/junitpioneer/internal/PioneerPreconditions.java

Error Description Line
Erwartetes Tag @throws für 'PreconditionViolationException'. 36
Erwartetes Tag @throws für 'PreconditionViolationException'. 50
Erwartetes Tag @throws für 'PreconditionViolationException'. 64
Erwartetes Tag @throws für 'PreconditionViolationException'. 77
Erwartetes Tag @throws für 'PreconditionViolationException'. 90
Erwartetes Tag @throws für 'PreconditionViolationException'. 103

File
/.../junit-pioneer/src/main/java/org/junitpioneer/jupiter/cartesian/CartesianMethodArgumentsProvider.java

Error Description Line
Erwartetes Tag @throws für 'Exception'. 30

File
/.../junit-pioneer/src/main/java/org/junitpioneer/jupiter/cartesian/CartesianParameterArgumentsProvider.java

Error Description Line
Erwartetes Tag @throws für 'Exception'. 33

If we want to keep validateThrows – which would be a trade-off as we are no longer able to omit @throws (allowMissingThrowsTags has been removed) – I'm happy to create a separate issue. But I would suggest to first get this PR merged, so that main is stable again.

Side note: I have added the merge-ready label by myself to see if experimentals are passing.

Proposed commit message:

Update Checkstyle from 7.8.2 to 10.2 (#637)

This PR updates Checkstyle to the most recent version and removes
deleted/replaced/changed properties. In addition, JaCoCo is updated.

Both updates support Java 18, which fixes the currently failing build.

# Deleted

`allowMissingThrowsTags` and `allowUndeclaredRTE`:

>properties `allowMissingThrowsTags`, `allowUndeclaredRTE` [...] should
>be just removed from configs.
>Behavior will change as there will be less violations in code, such
>properties did not work well so their removal should be ok, as there
>will be less false-positives.

See:

* https://checkstyle.sourceforge.io/releasenotes.html#Release_8.21
* https://github.com/checkstyle/checkstyle/issues/6703

# Replaced

`allowMissingJavadoc`:

Replaced by
[`MissingJavadocMethod`](https://checkstyle.org/config_javadoc.html#MissingJavadocMethod).
That is, missing Javadoc is now allowed by default.

See:

* https://checkstyle.sourceforge.io/releasenotes.html#Release_8.28
* https://github.com/checkstyle/checkstyle/issues/7329

# Changed

`allowMissingThrowsTags`:

`validateThrows` now means we can no longer omit `@throws` in Javadoc.
Whenever a method declares `throws`, it must be documented.

Furthermore, Checkstyle authors say:

>If you need to validate `@throws` please enable property
>`validateThrows` but please read documentation as there some
>limitations -
>https://checkstyle.org/config_javadoc.html#JavadocMethod .
>Old documentation is at
>https://checkstyle.sourceforge.io/version/8.27/config_javadoc.html#JavadocMethod

See:

* https://checkstyle.sourceforge.io/releasenotes.html#Release_8.21
* https://github.com/checkstyle/checkstyle/issues/6703

---

PR: #637

PR checklist

The following checklist shall help the PR's author, the reviewers and maintainers to ensure the quality of this project.
It is based on our contributors guidelines, especially the "writing code" section.
It shall help to check for completion of the listed points.
If a point does not apply to the given PR's changes, the corresponding entry can be simply marked as done.

Documentation (general)

  • There is documentation (Javadoc and site documentation; added or updated)
  • There is implementation information to describe why a non-obvious source code / solution got implemented
  • Site documentation has its own .adoc file in the docs folder, e.g. docs/report-entries.adoc
  • Site documentation in .adoc file references demo in src/demo/java instead of containing code blocks as text
  • Only one sentence per line (especially in .adoc files)
  • Javadoc uses formal style, while sites documentation may use informal style

Documentation (new extension)

  • The docs/docs-nav.yml navigation has an entry for the new extension
  • The package-info.java contains information about the new extension

Code

  • Code adheres to code style, naming conventions etc.
  • Successful tests cover all changes
  • There are checks which validate correct / false usage / configuration of a functionality and there are tests to verify those checks
  • Tests use AssertJ or our own PioneerAssert (which are based on AssertJ)

Contributing

  • A prepared commit message exists
  • The list of contributions inside README.md mentions the new contribution (real name optional)

>properties `allowMissingThrowsTags`, `allowUndeclaredRTE` [...] should
>be just removed from configs.
>Behavior will change as there will be less violations in code, such
>properties did not work well so their removal should be ok, as there
>will be less false-positives.

See:

* https://checkstyle.sourceforge.io/releasenotes.html#Release_8.28
* checkstyle/checkstyle#7329
Since the property `allowMissingThrowsTags` has been removed,
`validateThrows` now means you can no longer omit `@throws` in Javadoc.
Whenever a method declares `throws`, it must be documented.

Furthermore, Checkstyle authors say:

>If you need to validate `@throws` please enable property
>`validateThrows but please read documentation as there some
>limitations -
>https://checkstyle.org/config_javadoc.html#JavadocMethod .
>Old documentation is at
>https://checkstyle.sourceforge.io/version/8.27/config_javadoc.html#JavadocMethod
@beatngu13 beatngu13 added the full-build Triggers full build suite on PR label May 18, 2022
@beatngu13 beatngu13 requested a review from nipafx May 18, 2022 17:31
@Michael1993
Copy link
Member

Michael1993 commented May 18, 2022

Looks okay to me, we can continue tweaking Checkstyle from a successful build as a baseline.

To handle Java 18 bytecode (version 62).
@beatngu13
Copy link
Member Author

I just updated JaCoCo too. The previous build errors shadowed:

[...]
Caused by: java.io.IOException: Error while instrumenting sun/text/resources/cldr/ext/FormatData_de.
        at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrumentError(Instrumenter.java:160)
        at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:110)
        at org.jacoco.agent.rt.internal_3570298.CoverageTransformer.transform(CoverageTransformer.java:92)
        ... 39 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 62
        at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:196)
        at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:177)
        at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:163)
        at org.jacoco.agent.rt.internal_3570298.core.internal.instr.InstrSupport.classReaderFor(InstrSupport.java:280)
        at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:76)
        at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:108)
        ... 40 more

@beatngu13 beatngu13 changed the title Update Checkstyle and fix build Update Checkstyle and JaCoCo to fix build May 18, 2022
@nipafx nipafx merged commit b6a19c1 into main May 19, 2022
@nipafx nipafx deleted the lab/update-checkstyle branch May 19, 2022 11:31
Bukama pushed a commit that referenced this pull request Jun 5, 2022
This PR documents the use of transitive dependencies
Pioneer related on.

related: #637
PR: #646
Bukama pushed a commit to Bukama/junit-pioneer that referenced this pull request Sep 20, 2022
…oneer#646)

This PR documents the use of transitive dependencies
Pioneer related on.

related: junit-pioneer#637
PR: junit-pioneer#646
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-build Triggers full build suite on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants