Writing a linter in Fortran

That is amazing work @awvwgk and very helpful for people just getting started with toml-f and fpm (when it merges). It is a very interesting approach, using Fortran to implement a linter, instead of Javascript or some language that is slightly more feature-rich when it comes to string manipulations. Although ultimately it is the only solution that makes sense, since you don’t want to burden users with having to download node.js to use the linter.

I had a few suggestions and questions that you might want to consider.

  • Adding an option or slightly restructuring the diagnostic message to be easily parseable via regex. The message structure is already very good, but fetching the error message via regex would be hard. A good example of that is gfortran-11>= with the flag -fdiagnostic-plain-output. Having an such option would allow for code editors to parse the output of the linter to their Diagnostics console in VS Code PROBLEMS tab.
  • The other thing I would consider producing is a schema, if at all possible! Currently this can be done for TOML through JSON Schema Everywhere: Schema Validation for TOML | JSON Schema Everywhere. This would allow for passive linting of the toml file, from the code editor in addition to the existing solution. Again, specifically to VS Code, although that is feature exists in all other widely used editors (neovim, emacs), enabling that schema would look something like this and additional info here. AFAIK, TOML validation is only possible through JSON but it’s been a while since I last looked at ways of doing it.

From my understanding toml-f allows for an “extended” version of TOML syntax?? Or am I wrong in thinking that toml-f.git does not follow standard naming conventions?

2 Likes