diff --git a/utils/fortran_rc_default.yaml b/utils/fortran_rc_default.yaml new file mode 100644 index 0000000..a4d3b68 --- /dev/null +++ b/utils/fortran_rc_default.yaml @@ -0,0 +1,397 @@ + +# Flinter configuation file. + + +# These are all the regexp rules + +# Set active to false is you want to skip rule +# All are regexp rules, meaning you can add new rules simply by editing this file +# test your rule on https://regex101.com/ if needed + +extension: f\d* + +regexp-rules: + + intrinsics-should-be-lowercased: + message: Intrinsics keywords should be lowercased + regexp: \b({intrinsics_upper}|end(?:{blocks_upper}|{structs_upper}))\b + case-sensitive: true + active: true + + intrinsics-args-should-be-lowercased: + message: Intrinsics named argument should be lowercased + regexp: \b({named-args_upper})(?=\s*=) + case-sensitive: true + active: true + + types-should-be-lowercased: + message: Types should be lowercased + regexp: \b({types_upper})\b + case-sensitive: true + active: true + + # real-avbp-working-precision: + # message: Use AVBP working precision + # regexp: (?<=real)(?!\(\s*pr\s*\))\([^\(]*\) + # replacement: (pr) + + character-string-length: + message: Use strl or shortstrl + regexp: (?<=character)(\s*\(\s*len\s*=\s*)(?!\s*strl\b|\s*shortstrl\b)[^\(]*?(\s*\)) + + # missing-space-before-call-parameters: + # message: Missing space between subroutine name and parenthesis + # regexp: (?<=call\s)(\s*\w+)\( + # replacement: \1 ( + + # missing-space-after-call-parenthesis: + # message: Missing space after first parenthesis + # regexp: (?<=call\s)(\s*\w+\s*)\((\S) + # replacement: ( \2 + + # missing-space-before-call-parenthesis: + # message: Missing space before last parenthesis + # regexp: (?<=call\s)(\s*\w+\s*\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*(?' + - '\.lt\.' + - '<' + - '\.geq\.' + - '>=' + - '\.leq\.' + - '<=' + - '\.le\.' + - '\.ge\.' + - '\.and\.' + - '\.or\.' + + structs: + - if + - select + - case + - while + + punctuations: + - ',' + - '\)' + - ';' + + namespace_blocks: + - program + - module + + context_blocks: + - function + - subroutine + + intrinsics: + - ALLOCATABLE + - ALLOCATE + - ASSIGN + - ASSIGNMENT + - BACKSPACE + - BLOCK + - CALL + - CASE + - CLOSE + - COMMON + - CONTAINS + - CONTINUE + - CYCLE + - DATA + - DEALLOCATE + - DEFAULT + - DIMENSION + - DO + - ELSE + - ELSEWHERE + - END + - ENDFILE + - ENTRY + - EQUIVALENCE + - EXIT + - EXTERNAL + - FUNCTION + - GO + - GOTO + - IF + - IMPLICIT + - IN + - INOUT + - INQUIRE + - INTENT + - INTERFACE + - INTRINSIC + - MODULE + - NAMELIST + - NONE + - NULLIFY + - ONLY + - OPEN + - OPERATOR + - OPTIONAL + - OUT + - PARAMETER + - PAUSE + - POINTER + - PRINT + - PRIVATE + - PROCEDURE + - PROGRAM + - PUBLIC + - READ + - RECURSIVE + - RESULT + - RETURN + - REWIND + - SAVE + - SELECT + - SEQUENCE + - STOP + - SUBROUTINE + - TARGET + - THEN + - TO + - TYPE + - USE + - WHERE + - WHILE + - WRITE + # should we or not? + #- IFDEF + #- IFNDEF + + + named-args: + - ACCESS + - ACTION + - ADVANCE + - BLANK + - DELIM + - DIRECT + - EOR + - ERR + - EXIST + - FILE + - FMT + - FORM + - FORMAT + - FORMATTED + - IOLENGTH + - IOSTAT + - KIND + - LEN + - NAME + - NAMED + - NEXTREC + - NML + - NUMBER + - OPENED + - PAD + - POSITION + - READWRITE + - REC + - RECL + - SEQUENTIAL + - SIZE + - STAT + - STATUS + - UNFORMATTED + - UNIT diff --git a/utils/lint.sh b/utils/lint.sh new file mode 100644 index 0000000..222b2d8 --- /dev/null +++ b/utils/lint.sh @@ -0,0 +1,5 @@ +#!/bin/sh +for f in $(find . -type f -name "*.f90") +do + flint lint $f -r utils/fortran_rc_default.yaml +done