@@ -107,44 +107,44 @@ def pytest(context, local=INVOKE_LOCAL):
107107
108108
109109@task (help = {"local" : "Run locally or within the Docker container" })
110- def black (context , local = INVOKE_LOCAL ):
110+ def black (context , path = "." , local = INVOKE_LOCAL ):
111111 """Run black to check that Python files adherence to black standards."""
112- exec_cmd = "black --check --diff ."
112+ exec_cmd = "black {path}" . format ( path = path )
113113 run_cmd (context , exec_cmd , local )
114114
115115
116116@task (help = {"local" : "Run locally or within the Docker container" })
117- def flake8 (context , local = INVOKE_LOCAL ):
117+ def flake8 (context , path = "." , local = INVOKE_LOCAL ):
118118 """Run flake8 code analysis."""
119- exec_cmd = "flake8 ."
119+ exec_cmd = "flake8 {path}" . format ( path = path )
120120 run_cmd (context , exec_cmd , local )
121121
122122
123123@task (help = {"local" : "Run locally or within the Docker container" })
124- def pylint (context , local = INVOKE_LOCAL ):
124+ def pylint (context , path = "." , local = INVOKE_LOCAL ):
125125 """Run pylint code analysis."""
126- exec_cmd = 'find . -name "*.py" | xargs pylint'
126+ exec_cmd = 'find {path} -name "*.py" | xargs pylint' . format ( path = path )
127127 run_cmd (context , exec_cmd , local )
128128
129129
130130@task (help = {"local" : "Run locally or within the Docker container" })
131- def yamllint (context , local = INVOKE_LOCAL ):
131+ def yamllint (context , path = "." , local = INVOKE_LOCAL ):
132132 """Run yamllint to validate formatting adheres to NTC defined YAML standards."""
133- exec_cmd = "yamllint ."
133+ exec_cmd = "yamllint {path}" . format ( path = path )
134134 run_cmd (context , exec_cmd , local )
135135
136136
137137@task (help = {"local" : "Run locally or within the Docker container" })
138- def pydocstyle (context , local = INVOKE_LOCAL ):
138+ def pydocstyle (context , path = "." , local = INVOKE_LOCAL ):
139139 """Run pydocstyle to validate docstring formatting adheres to NTC defined standards."""
140- exec_cmd = "pydocstyle ."
140+ exec_cmd = "pydocstyle {path}" . format ( path = path )
141141 run_cmd (context , exec_cmd , local )
142142
143143
144144@task (help = {"local" : "Run locally or within the Docker container" })
145- def bandit (context , local = INVOKE_LOCAL ):
145+ def bandit (context , path = "." , local = INVOKE_LOCAL ):
146146 """Run bandit to validate basic static code security analysis."""
147- exec_cmd = "bandit --recursive ./ --configfile .bandit.yml"
147+ exec_cmd = "bandit --recursive ./{path} --configfile .bandit.yml" . format ( path = path )
148148 run_cmd (context , exec_cmd , local )
149149
150150
@@ -156,14 +156,14 @@ def cli(context):
156156
157157
158158@task (help = {"local" : "Run locally or within the Docker container" })
159- def tests (context , local = INVOKE_LOCAL ):
159+ def tests (context , path = "." , local = INVOKE_LOCAL ):
160160 """Run all tests for this repository."""
161- black (context , local )
162- flake8 (context , local )
163- pylint (context , local )
164- yamllint (context , local )
165- pydocstyle (context , local )
166- bandit (context , local )
167- pytest (context , local )
161+ black (context , path , local )
162+ flake8 (context , path , local )
163+ pylint (context , path , local )
164+ yamllint (context , path , local )
165+ pydocstyle (context , path , local )
166+ bandit (context , path , local )
167+ pytest (context , path , local )
168168
169169 print ("All tests have passed!" )
0 commit comments