-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathftn_line_length_check.sh
executable file
·48 lines (44 loc) · 1.44 KB
/
ftn_line_length_check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# Copyright (C) 2020 Seth Underwood
#
# This file is part of Simple Lint.
#
# Simple Lint is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Simple Lint is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar. If not, see <https://www.gnu.org/licenses/>.
# Find all Fortran files (using the file extensions listed below) and check
# if they contain lines greater than a certain number of characters. This
# script can take one argument, a number which corresponds to the line length
# If the argument is not supplied, then use the Fortran standard length of 132.
# File extensions use:
# * .f .F
# * .f90 .F90
# * .inc .INC
# * .fh .FH
# * .for .FOR
# Check if a line length was passed in:
if test -n "$1"
then
# Check if $1 contains only numbers
case $1 in
(*[!0-9]*|'')
echo "Error: Argument given \"$1\" is not a number" 1>&2
exit 1
;;
(*)
nCol=$1
;;
esac
else
nCol=132
fi
find -O3 . -iregex ".*\.\(f\(90\)?\|inc\|fh\|for\)$" -exec grep -l ".\{$nCol\}" {} \;