forked from holtgrewe/linty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·54 lines (43 loc) · 1.63 KB
/
run.py
File metadata and controls
executable file
·54 lines (43 loc) · 1.63 KB
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
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
import linty.app as la
import linty.checks as lc
import linty.indent as li
import linty.whitespace as lw
BASE_PATH = os.path.dirname(__file__)
INDENT_CONFIG = li.IndentationConfig(
brace_positions_class_struct_declaration = 'next-line',
brace_positions_function_declaration = 'next-line',
brace_positions_blocks = 'next-line',
brace_positions_blocks_in_case_statement = 'next-line',
brace_positions_switch_statement = 'next-line',
brace_positions_namespace_declaration = 'same-line',
)
WHITESPACE_CONFIG = lw.WhitespaceConfig()
AST_CHECKS = [
li.IndentationCheck(INDENT_CONFIG),
lw.WhitespaceCheck(WHITESPACE_CONFIG),
]
FILE_CHECKS = [
# ------------------------------------------------------------------------
# Text-Level Checks.
# ------------------------------------------------------------------------
# These checks are based on the text of the file only. Only simple parsing
# is done such as parsing out comments.
# All libray files must have a matching SeqAn library header.
lc.RegexpHeaderCheck(path=os.path.join(BASE_PATH, 'seqan_library.header')),
# All files must end with a newline.
lc.FileEndsWithNewlineCheck('\n'),
# No line may have trailing whitespace.
lc.NoTrailingWhitespaceCheck(),
# We only allow Unix line endings.
lc.OnlyUnixLineEndings(),
# Check TODO comments.
lc.TodoCommentChecker(),
]
def main():
return la.main(AST_CHECKS, FILE_CHECKS)
if __name__ == '__main__':
sys.exit(main())