fhir-data-pipes icon indicating copy to clipboard operation
fhir-data-pipes copied to clipboard

Enable a static code analyzer for null-checking and other common issues

Open bashir2 opened this issue 1 year ago • 4 comments
trafficstars

We have experimented with some static code analyzers like SonarQube (e.g., in #704, #706, #707) but these are not adequate, especially for catching NullPointerExceptions. Also we have some @Nullable annotations throughout the code but we don't have a robust null-check static code analyzer that can benefit from these annotations. With release 1.0.0 of Jspecify it makes sense to move our null-check annotations to Jspecify and enable a tool like NullAway on our code. This requires Error Prone which will help catching more issues at compile time.

An early experiment shows over 370 ErrorProne/NullAway warnings, so we should probably fix this issue in multiple phases (e.g., by module).

bashir2 avatar Nov 19 '24 06:11 bashir2

Here are the total ErrorProne/Nullaway/JavaStyleGuide static code analyzer warnings broken down by module (462 total).

------------ Pipelines ------------

Pipelines Common Module

  • [x] Implementation code - 85 Warnings
  • [ ] Test code - 72 Warnings

Pipelines Batch Module

  • [x] Implementation code - 50 Warnings
  • [x] Test code - 59 Warnings

Pipelines Controller Module

  • [x] Implementation code - 97 Warnings
  • [x] Test code - 8 Warnings

------------ Bunsen ------------

Bunsen Core Module

  • [x] Implementation code - 33 Warnings
  • [x] Test code - 6 Warnings

Bunsen Core R4 Module

  • [x] Implementation code - 4 Warnings
  • [x] Test code - 2 Warnings

Bunsen Core STU3 Module

  • [x] Implementation code - 3 Warnings
  • [x] Test code - 0 Warnings

Bunsen Avro Module

  • [x] Implementation code - 30 Warnings
  • [x] Test code - 13 Warnings

ndegwamartin avatar Sep 19 '25 07:09 ndegwamartin

Thanks @ndegwamartin for the breakdown. It would be nice to see how many of the production code warnings are from NullAway.

bashir2 avatar Sep 24 '25 15:09 bashir2

Thanks @ndegwamartin for the breakdown. It would be nice to see how many of the production code warnings are from NullAway.

Check out the comment here - https://github.com/google/fhir-data-pipes/issues/1474#issuecomment-3357265412

ndegwamartin avatar Oct 01 '25 16:10 ndegwamartin

Reopening this until all sub-issues are resolved.

bashir2 avatar Oct 30 '25 15:10 bashir2