NOAA-EMC / NCEPLIBS-g2c

This library contains C decoder/encoder routines for GRIB edition 2.
Other
18 stars 11 forks source link

trying to turn on code analysis #394

Closed edwardhartnett closed 1 year ago

edwardhartnett commented 1 year ago

Fixes #395

I would have liked to add this to the develop workflow, but it conflicts with the address santizer.

So I put the code analysis in the Intel build, since there is only one instance of the Intel build in this repo's CO.

edwardhartnett commented 1 year ago

The code scanner finds some problems I will address in a future PR. We will ignore its failure for now, but note that all the required CI workflows are passing.

This PR can be merged.

edwardhartnett commented 1 year ago

@AlexanderRichert-NOAA yes, I intend to add it everywhere across NCEPLIBS. I have not yet seen what it can do for Fortran however.

Also I intend to fix all scan errors and the require that the code scan pass for future PRs. But it might take me a few PRs to get there. ;-)

I used this code scanner in a recent refactor of my netcdf-c code. I found it useful for tightening up and cleaning up the code. Just like compiler warnings, it takes some work to get down to zero, but then the tool lurks in the background, ready to pounce on the slightest deviation from best practice in new code.

edwardhartnett commented 1 year ago

OK, no doubt it's childish, but the little red 'x' next to this PR is like fingernails on a chalkboard to me...

Let me see if I can fix some.

edwardhartnett commented 1 year ago

@AlexanderRichert-NOAA well it turns out that this code analysis tool does not support Fortran at all: https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/

From my netCDF and other code maintenance experience, I know that C is a lot easier to maintain than Fortran. This code scanner is just a small example of why.