Skip to content

STY001 multiple-modules ​

warning opt-in

A file defines more than one module or submodule.

Why ​

One module per file makes the file name tell where a module lives, keeps recompilation cascades small (every module of a file is rebuilt when any of them changes) and lets a build tool order compilation per file without false dependencies.

Reported ​

fortran
module grid
end module grid
module solver
end module solver

Preferred ​

fortran
! grid.f90
module grid
end module grid

Suppressing ​

For one occurrence, with the reason on the same line (or alone on the line before the statement):

fortran
! fobis: ignore[STY001] <why this occurrence is fine>

For the whole project, ignore = STY001 in the fobos [lint] section.

Equivalent ​

Fortitude rule S211 (see Lint Rules).