# Linter doesn't lint (most of the time)

**URL:** <https://fortran-lang.discourse.group/t/linter-doesnt-lint-most-of-the-time/9143>\
**Category:** Visual Studio Code\
**Created:** [January 29, 2025, 6:35pm UTC](https://fortran-lang.discourse.group/t/linter-doesnt-lint-most-of-the-time/9143 "2025-01-29T18:35:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![radev](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@radev](https://fortran-lang.discourse.group/u/radev)\
**Post date:** [January 29, 2025, 6:35pm UTC](https://fortran-lang.discourse.group/t/linter-doesnt-lint-most-of-the-time/9143/1 "2025-01-29T18:35:06Z")

</div>

I’m sorry if this is a bit vague, but I’m not entirely sure which part of the toolchain is failing, so please bear with me.

**TL;DR: Linter doesn’t lint (most of the time).**

I have Modern Fortran set up in VSCode (actually, VSCodium) on a Windows 10 PC. I inherited a legacy project mostly written in Fixed Form/F77 though includes a bit of F90/F95, and after some initial struggle migrating from another editor, I got everything set up and working correctly in VSC. There are ~700 source files, and is compiled with gfortran with the flags: `-g -O0 -Wall -fcheck=bounds`. At the time, I was using an old version of gfortran (v8.1.0). At some point recently, I decided to update the compiler to test out some modern Fortran features, so I’ve upgraded to v14.2.0, and this is where my issues began to appear.

I am now finding that the editor will not perform live error linting anymore (as demonstrated in the GIFs on the Modern Fortran extension marketplace page). Now, nothing\* gets linted anymore; I can type some random garbage, and no error is revealed during editing (though, of course, the project would not compile for real). The few exceptions are if I _SAVE_ a source file with _CERTAIN_ illegal lines such as open blocks with no `end`, incl. `do`, `if` (only if the line contains `then`), `interface`, `associate`, to name a few that I’ve noticed. In these cases, the linter shows errors in subsequent subroutines/functions. Also, VSCode _does_ detect several “Problems” in old source files that I have never touched (no idea why the project can normally compile with these present, but that’s a separate issue).

I would really like to restore the linting functionality, but I have no idea what change exactly caused this. I upgraded the compiler, like I said, but in the last several weeks have also upgraded fortls, edited VSCode settings, and of course have been updating all VSCode extensions as updates are released. I have tried reverting to the old compiler version, and can’t get it to work now. There have been moments in the past where I managed to get things working again (IIRC), but it was all rather aimless settings tweaking. So I believe the problem here is either a VSCode configuration issue, or some sort of build/compiler issue maybe.

* * *

Here are some potentially relevant names/numbers for my setup:

- OS: Windows 10 (22H2)
- VSCodium: `v1.96.4`
- Modern Fortran extension: `v3.4.2024101621 (pre-release)`
- C/C++ extension: `v1.23.5`
- Error Lens extension: `v3.22.1`
- Last working compiler: `gfortran v8.1.0` (`i686-8.1.0-win32-dwarf-rt_v6-rev0`)
- Current compiler: `gfortran v14.2.0` `(i686-14.2.0-win32-dwarf-msvcrt-rt_v12-rev0`)
- FortLS: `v3.1.2` (Python `v3.11.3`)

And some Modern Fortran settings:

- `"C_Cpp.default.compilerPath": "C:\\compiler\\mingw_w64\\i686-14.2.0-win32-dwarf-msvcrt-rt_v12-rev0\\mingw32\\bin\\i686-w64-mingw32-gfortran.exe"`
- `"fortran.fortls.path": "C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\fortls.exe"`
- `"fortran.linter.compilerPath": "C:\\compiler\\mingw_w64\\i686-14.2.0-win32-dwarf-msvcrt-rt_v12-rev0\\mingw32\\bin\\i686-w64-mingw32-gfortran.exe"`
- `"fortran.linter.includePaths": ["${workspaceFolder}/src/incs/**"]`
- `"fortran.linter.initialize": true`
- `"fortran.linter.modOutput": "${workspaceFolder}/.mod"` (though nothing actually generates here, and previous working configs did not have any directory specified here)

Things that I know (_think_) are working:

- IntelliSense: I get hover popups, autocomplete suggestions, function signatures, etc.
- FortLS: Some few files/specific errors _ARE_ linted
- Pre-initialization: Checking the extension output, I get entries like `[build.single] Compiler query command line: <path>-gfortran.exe -fsyntax-only -cpp -ffree-line-length-none -ffixed-line-length-none --include-dirs <dirs> -J <workspace>\.mod -I<workspace>\src\incs -ffixed-form -o <workspace>\src\<...>\<filename>.for.o <workspace>\src\<...>\<filename>.for` with no visible errors

Though I may be wrong about what parts do what.

If anyone has a suggestion about what my problem could be and how to solve it, I would really appreciate any input! If I should provide additional info, just let me know.

* * *

Edit: I forgot to mention that all these issues are present on my desktop PC only. On a separate laptop, the linting works correctly! However, I’ve checked, and the extensions/settings/compiler paths there seem the same. But perhaps there’s something else I can compare between the two systems.

---

<div class="post-metadata">

**Author:** ![radev](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@radev](https://fortran-lang.discourse.group/u/radev)\
**Post date:** [January 29, 2025, 7:13pm UTC](https://fortran-lang.discourse.group/t/linter-doesnt-lint-most-of-the-time/9143/2 "2025-01-29T19:13:57Z")

</div>

Ok, in classic fashion, I managed to find the problem (this time) soon after typing out a long request for help. My system which was having the issue had (erroneous) extra arguments passed to the linter. In my case, the line in the settings file was `"fortran.linter.extraArgs": ["--include-dirs ${workspaceFolder}/src/incs"]`. Removing that argument causes the linter to function as normal again.

Hopefully someone else can get something useful out of this post, I guess. Otherwise, a mod can freely delete this thread if they like.
