1
- """Update conda packages on binstars with latest versions"""
1
+ """
2
+ Linter for diferite script types.
3
+ """
2
4
from __future__ import print_function
3
5
4
6
import argparse
15
17
".py" : (["pylint" , "-rn" ], "flake8" , "pep8" ),
16
18
".sh" : (["shellcheck" , "-x" ], "bashate" ),
17
19
}
20
+ EXCLUDE = ('.' , '..' , '.venv' , '.git' , '.tox' , 'dist' , 'doc' )
18
21
CONFIG = {"whitelist" : set ()}
19
22
CONFIG_PATH = os .path .expanduser ("~/.cache/build/config.yml" )
20
23
@@ -137,7 +140,7 @@ def scripts(root):
137
140
while files_queue :
138
141
root = files_queue .pop ()
139
142
for files in os .listdir (root ):
140
- if files in ( '.' , '..' ) :
143
+ if files in EXCLUDE :
141
144
continue
142
145
file_path = os .path .join (root , files )
143
146
if os .path .isfile (file_path ):
@@ -151,6 +154,8 @@ def get_argparser():
151
154
parser = argparse .ArgumentParser ()
152
155
parser .add_argument ("--file_type" , default = None , choices = CHECKS .keys (),
153
156
dest = "file_type" , help = "What file type to check." )
157
+ parser .add_argument ("--root" , default = os .getenv ("TRAVIS_BUILD_DIR" ),
158
+ dest = "root" , help = "The root directory." )
154
159
return parser
155
160
156
161
@@ -167,7 +172,7 @@ def main():
167
172
args .file_type : CHECKS [args .file_type ]
168
173
}
169
174
170
- for script in scripts (os . path . curdir ):
175
+ for script in scripts (args . root ):
171
176
script_type = script [- 3 :]
172
177
if script_type not in checks :
173
178
continue
0 commit comments