Skip to content

Expand Fortran file-extension support #1563

Description

@huxs001

The built-in Fortran extension table in src/discover/language.c currently recognizes only:

.f03
.f08
.f90
.f95

This misses several commonly used Fortran extensions, especially in scientific and HPC codebases.

Please expand the Fortran entries to include:

.f
.F
.for
.f77
.fpp
.f90
.f95
.f03
.f08

In particular, .F is important for preprocessed Fortran source files. For example, CP2K uses .F extensively in its source tree:

https://github.com/cp2k/cp2k/tree/master/src

The uppercase .F extension is intentional: in many Fortran build systems it distinguishes source files that are passed through the C preprocessor from ordinary .f/.f90 sources.

Requested change

Update the Fortran section of src/discover/language.c to recognize at least:

/* Fortran */
{".f",   CBM_LANG_FORTRAN},
{".F",   CBM_LANG_FORTRAN},
{".for", CBM_LANG_FORTRAN},
{".f77", CBM_LANG_FORTRAN},
{".fpp", CBM_LANG_FORTRAN},
{".f90", CBM_LANG_FORTRAN},
{".f95", CBM_LANG_FORTRAN},
{".f03", CBM_LANG_FORTRAN},
{".f08", CBM_LANG_FORTRAN},

Please also add or update tests covering these extensions.

Reference: CP2K source tree, which contains extensive use of preprocessed .F Fortran sources:

https://github.com/cp2k/cp2k/tree/master/src

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlanguage-requestRequest for new language supportparsing/qualityGraph extraction bugs, false positives, missing edgespriority/normalStandard review queue; useful PR with ordinary maintainer urgency.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions