Clean up code with fortitude linter?
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 8
Description
Yesterday someone turned me on to the [fortitude](https://github.com/PlasmaFAIR/fortitude) linter for Fortran, and holy cow, it's awesome. I did `fortitude check --exclude fates --statistics --output-format=concise` on our `src/` dir at b4b-dev f90f9f1, and in just a few seconds, I got this:
```
9802 S101 [*] trailing-whitespace
8062 S001 [ ] line-too-long
739 MOD011 [*] old-style-array-literal
598 C003 [ ] implicit-external-procedures
467 C061 [ ] missing-intent
389 MOD021 [*] deprecated-relational-operator
283 C081 [ ] initialisation-in-declaration
251 S071 [*] missing-double-colon
81 C121 [ ] use-all
49 C002 [ ] interface-implicit-typing
31 C131 [ ] missing-accessibility-statement
19 C072 [ ] assumed-size-character-intent
12 C141 [ ] missing-exit-or-cycle-label
7 S061 [*] unnamed-end-statement
5 OB061 [*] deprecated-character-syntax
2 C092 [ ] procedure-not-in-module
fortitude: 320 files scanned.
Number of errors: 20797
For more information about specific rules, run:
fortitude explain X001,Y002,...
[*] 11193 fixable with the `--fix` option (610 hidden fixes can be enabled with the `--unsafe-fixes` option).
```
Note that it can just go ahead and fix a bunch of these.
I think this is the answer to our "there's no good Fortran linter" problem, as it seems actively developed with a latest release of Aug. 18.
As always, the issue with a mass linting operation is the potential-to-guaranteed merge conflicts that will result. Those of us on the SE team would need to be comfortable with the idea of handling those. **This is possible now! →** ~~It would be nice if there were a way to run it in a `pre-commit` and/or Github Workflow context while ignoring unchanged lines, but I don't think it is (issue filed [here](https://github.com/PlasmaFAIR/fortitude/issues/584)). We'd have to have a discussion about how to handle that. One option would be to do the linting a little at a time—say, just a few rules per CTSM minor version release.~~
Contributor guide
Assessment
This issue has not been assessed yet.