All Projects → cphyc → fortran-linter

cphyc / fortran-linter

Licence: other
A simple fortran syntax checker, including automatic fixing of the code.

Programming Languages

python
139335 projects - #7 most used programming language
emacs lisp
2029 projects
fortran
972 projects

Labels

Projects that are alternatives of or similar to fortran-linter

megalinter
🦙 Mega-Linter analyzes 48 languages, 22 formats, 19 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
Stars: ✭ 534 (+3460%)
Mutual labels:  linter
stylelint-processor-glamorous
💄 Lint glamorous and related css-in-js with stylelint
Stars: ✭ 18 (+20%)
Mutual labels:  linter
selective
Statically find HTML anti patterns using CSS Selectors
Stars: ✭ 15 (+0%)
Mutual labels:  linter
dustmite
A linter for DustJS templates
Stars: ✭ 14 (-6.67%)
Mutual labels:  linter
mouette
🐦 [WIP] Lint your MongoDB.
Stars: ✭ 12 (-20%)
Mutual labels:  linter
vscode-protolint
A protobuf linter for visual studio code
Stars: ✭ 31 (+106.67%)
Mutual labels:  linter
quick-lint-js
quick-lint-js finds bugs in JavaScript programs
Stars: ✭ 575 (+3733.33%)
Mutual labels:  linter
elint
A easy way to lint your code
Stars: ✭ 38 (+153.33%)
Mutual labels:  linter
automutate
Applies waves of mutations provided by other tools, such as linters or codemods.
Stars: ✭ 13 (-13.33%)
Mutual labels:  linter
Format.cmake
💅 Stylize your code! Automatic clang-format and cmake-format targets for CMake.
Stars: ✭ 94 (+526.67%)
Mutual labels:  linter
illuaminate
Very WIP static analysis for Lua
Stars: ✭ 21 (+40%)
Mutual labels:  linter
durationcheck
Go linter to detect erroneous multiplication of duration values
Stars: ✭ 28 (+86.67%)
Mutual labels:  linter
JSONCustomLintr
Library to allow creation, running, and reporting of custom lint rules for JSON files
Stars: ✭ 19 (+26.67%)
Mutual labels:  linter
clj-kondo.lsp
Clj-kondo language server and VSCode extension: https://marketplace.visualstudio.com/items?itemName=borkdude.clj-kondo
Stars: ✭ 17 (+13.33%)
Mutual labels:  linter
standard-packages
List of packages that use `standard`
Stars: ✭ 32 (+113.33%)
Mutual labels:  linter
golintui
A simple terminal UI for Go linters
Stars: ✭ 73 (+386.67%)
Mutual labels:  linter
eslint-config
An ESLint shareable config that I used in my projects
Stars: ✭ 15 (+0%)
Mutual labels:  linter
elvis core
The core of an Erlang linter
Stars: ✭ 43 (+186.67%)
Mutual labels:  linter
splinter
Simple pattern-based linter 🐀
Stars: ✭ 31 (+106.67%)
Mutual labels:  linter
cfn-lint-action
GitHub Action for interacting with CloudFormation Linter
Stars: ✭ 41 (+173.33%)
Mutual labels:  linter

Fortran linter

This linter works on a line-by-line basis to enforce some rules regarding the format of Fortran files.

The linter does not ship with any grammar and is solely based on regular expressions. This allows to easily add new rules, but this implies some limitations. For example, continued lines (using &) cannot be parsed or nested parenthesis are a nightmare to fix.

Installation

There are 2 ways of installing the linter. The recommended one is through pip

pip install fortran-linter

The other way is to clone this repository and install it from the local copy:

git clone https://github.com/cphyc/fortran-syntax.git
cd fortran-syntax
pip install .

Please note that depending on your installation, you may have to add sudo to the pip install line. This is due to the fact that the package is shipped with a script fortran-linter. For some installation, the creation of this file may require root access.

Usage

This tool checks for fortran syntax against a few rules. To print a list of all the warnings for a file, run:

fortran-linter myfile.f90 --syntax-only

To try to fix the warnings in place, do:

fortran-linter myfile.f90 -i

The original file will be backup'ed into myfile.f90.orig. All the safe fixes will be done and stored in the file myfile.f90.

For more help, you can type

fortran-linter -h

Rules

Currently, the following things are enforced:

  • Punctuation should be followed by a space, this include ,, ; and ).
  • Binary operators (==, +, ...) should be surrounded by spaces
  • The following special characters are surrounded by at least one space: ::, =.
  • A line should not exceed 120 characters (this is somehow already extreme). The maximum line length can be controlled from the CLI.
  • One should use use mpi instead of include "mpif.h". Note that this is not fixed by default as it may break codes where include "mpif.h" follows and implicit none statement.
  • Spaces are preferred over tabs, trailing whitespaces are cleaned.
  • Warnings are raised if you use real(8) :: foo. One should rather use integer, parameter :: dp = selected_real_kind(15); real(dp) :: foo or use iso_fortran_env; real(real64) :: foo

TODO list

  • ship on pip
  • add more rules (this one will never end)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].