Skip to content

feat: add code quality tooling (compiler warnings + static analysis) #28#30

Open
Ayush-AM wants to merge 1 commit intoopenmainframeproject:release-5.1from
Ayush-AM:feature/issue-28-quality-release-5.1
Open

feat: add code quality tooling (compiler warnings + static analysis) #28#30
Ayush-AM wants to merge 1 commit intoopenmainframeproject:release-5.1from
Ayush-AM:feature/issue-28-quality-release-5.1

Conversation

@Ayush-AM
Copy link
Copy Markdown

Summary
Closes #28

Addresses OpenSSF Best Practices quality-related recommendations from issue #28.
As requested by @alexgubanow, this PR has been re-targeted against release-5.1 instead of master.

What changed and why

Compiler Warnings:

  • Java: Enabled -Xlint:all via maven-compiler-plugin compilerArgs in pom.xml.
  • C++: Added -Wall -Wextra -Wpedantic to CXXFLAGS in cpp/envdef.mak.
  • No -Werror is used; these surface informational warnings without failing the build.

Static Analysis:

  • Java: Added the SpotBugs Maven plugin (v4.9.3.1) configured as best-effort (failOnError=false, effort=Max, threshold=Low, noClassOk=true).
  • C++: Added a lint target in cpp/Makefile that runs cppcheck.

Documentation:

  • Added QUALITY.md at the repository root documenting the tooling, how to run it locally, and establishing that it works on a best-effort basis (no SLA guarantees).

Results of Warnings Being Enabled

As requested, here are the outputs reflecting the current state of release-5.1. Given the volume, I agree we should likely open a few more issues to resolve the warnings incrementally.

Java Compiler Warnings Output (-Xlint:all)
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompresser.java:[12,10] auto-closeable resource org.openmainframeproject.tersedecompress.TerseDecompresser has a member method close() that could throw InterruptedException
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompresser.java:[77,48] redundant cast to int
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/SpackDecompresser.java:[7,1] auto-closeable resource org.openmainframeproject.tersedecompress.SpackDecompresser has a member method close() that could throw InterruptedException
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/TerseBlockReader.java:[5,1] auto-closeable resource org.openmainframeproject.tersedecompress.TerseBlockReader has a member method close() that could throw InterruptedException
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java:[36,1] documentation comment is not attached to any declaration
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java:[80,32] auto-closeable resource org.openmainframeproject.tersedecompress.TerseDecompresser has a member method close() that could throw InterruptedException
[WARNING] /tersedecompress/src/main/java/org/openmainframeproject/tersedecompress/NonSpackDecompresser.java:[7,1] auto-closeable resource org.openmainframeproject.tersedecompress.NonSpackDecompresser has a member method close() that could throw InterruptedException

(Note: There were a few more identical JavaDoc placement warnings in TerseDecompress.java elided for brevity.)

…penmainframeproject#28

Address OpenSSF Best Practices quality-related recommendations from issue openmainframeproject#28:

Compiler Warnings:
- Java: enable -Xlint:all via maven-compiler-plugin compilerArgs in pom.xml
- C++: add -Wall -Wextra -Wpedantic to CXXFLAGS in cpp/envdef.mak
- No -Werror used; warnings are informational only

Static Analysis:
- Java: add SpotBugs Maven plugin (v4.9.3.1) configured as best-effort
  (failOnError=false, effort=Max, threshold=Low, noClassOk=true)
  Run with: mvn spotbugs:check  or  mvn spotbugs:gui
- C++: add 'lint' target in cpp/Makefile that runs cppcheck
  Run with: make lint  (from cpp/ directory)

Documentation:
- Add QUALITY.md at repo root documenting:
  * enabled compiler warning flags for Java and C++
  * static analysis tools and how to run them locally
  * best-effort nature with no SLA guarantees

Verified locally:
- mvn compile: BUILD SUCCESS with Xlint warnings surfaced
- mvn spotbugs:check: BUILD SUCCESS, 55 findings reported
- C++ warning flags: syntactically valid, apply to clang++ and ibm-clang++
- make lint: wired up, requires cppcheck installation to run

Signed-off-by: Ayush Mahajan <140263932+Ayush-AM@users.noreply.github.com>
@Ayush-AM
Copy link
Copy Markdown
Author

@alexgubanow please sir have a look over this pr. If any other changes needed, feel free to tell me.

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.

1 participant