-
Notifications
You must be signed in to change notification settings - Fork 3
/
FortranQuality.py
59 lines (36 loc) · 1000 Bytes
/
FortranQuality.py
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
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: UTF-8 -*-
import sys
from argparse import ArgumentParser
sys.path.insert(0, "./src") # to import FortranQuality
from FortranQualityClass import FortranQuality
from pathlib import Path
def parse_input():
inputParser = ArgumentParser()
inputParser.add_argument(
"--path",
help=(
"Path to source directory containing Fortran files. Default is current directory."
),
)
inputParser.add_argument(
"--tab",
help=("Default tab length in the code."),
type=int,
default=3,
)
return inputParser.parse_args()
def setUpPath(args):
if args.path:
path = Path(args.path).resolve()
else:
path = Path().resolve()
if not path.is_dir():
raise NotADirectoryError(str(path))
return path
def main():
args = parse_input()
path = setUpPath(args)
program = FortranQuality(path, args.tab)
program.run()
if __name__ == "__main__":
main()