Skip to content

Commit

Permalink
provide a rule based lint (fprettify)
Browse files Browse the repository at this point in the history
Moderated by a style file, the Fortran source code now can be
reformatted by fprettify.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
  • Loading branch information
nbehrnd committed Sep 19, 2023
1 parent ef7af0e commit f00a2fb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ default:

./executable


# Provide an optional check: if `diff` reports the computed solution and the
# reference solution file as identical, the program probably is in good shape.
check:
gfortran -O3 -c ./src/sudoku.f90
gfortran -O3 -c ./app/main.f90
Expand All @@ -24,5 +27,10 @@ check:
./executable ./test/test_in_01.txt > probe
diff -s ./probe ./test/test_out_01.txt
rm ./probe


# Assuming fprettify is available, apply the reformatter.
fprettify:
fprettify -c ./fprettify.rc --recursive ./*
# END

38 changes: 38 additions & 0 deletions fprettify.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# name: fprettify.rc
# date: [2023-09-12 Tue]

# This is a style file for fprettify (`fprettify -c fprettify.fc source.f90`)
# to compile all its parameters explicitly in one spot. The sequence of the
# entries below follows the one reported by the call of `fprettify -h` for
# fprettify version 0.3.7 published [2020-11-20 Fri].

indent=2 # This pattern is seen in gtk-fortran-gtk4, it replaces the default 3.
line-length=132
whitespace=2
whitespace-comma=True # default: None
whitespace-assignment=True # default: None

whitespace-decl=True # default: None
whitespace-relational=True # default: None
whitespace-logical=True # default: None
whitespace-plusminus=True # default: None
whitespace-multdiv=True # default: None

whitespace-print=True # default: None
whitespace-type=True # default: None
whitespace-intrinsics=True # default: None
strict-indent=True # default: None
enable-decl=True # default: None

disable-indent=False
disable-whitespace=False
enable-replacements=False # This is to substitute for example a `.gt.` by `>`.
c-relations=False
case=[0,0,0,0] # Which is: do not change to lowercase (1), or uppercase (2)
# keywords, procedures/modules, operators, constants.

strip-comments=no
disable-fypp=no
disable-indent-mod=no

# END

0 comments on commit f00a2fb

Please sign in to comment.