@@ -89,13 +89,15 @@ def create_output(self, messages: List[str]) -> str:
89
89
@click .option ('-d' , '--directory' , 'directory' , required = False , type = str )
90
90
@click .option ('-o' , '--output-file' , 'outputFilename' , required = False , type = str )
91
91
@click .option ('-f' , '--output-format' , 'outputFormat' , required = False , type = str , default = 'pretty' )
92
- def run (directory : str , outputFilename : str , outputFormat : str ) -> None :
92
+ @click .option ('-c' , '--config-file-path' , 'configFilePath' , required = False , type = str )
93
+ def run (directory : str , outputFilename : str , outputFormat : str , configFilePath : str ) -> None :
93
94
currentDirectory = os .path .dirname (os .path .realpath (__file__ ))
94
95
targetDirectory = os .path .abspath (directory or os .getcwd ())
95
96
reporter = GitHubAnnotationsReporter () if outputFormat == 'annotations' else PrettyReporter ()
96
97
messages = []
98
+ mypyConfigFilePath = configFilePath or f'{ currentDirectory } /mypy.ini'
97
99
try :
98
- subprocess .check_output (f'mypy { targetDirectory } --config-file { currentDirectory } /mypy.ini --no-color-output --no-error-summary --show-column-numbers' , stderr = subprocess .STDOUT , shell = True )
100
+ subprocess .check_output (f'mypy { targetDirectory } --config-file { mypyConfigFilePath } --no-color-output --no-error-summary --show-column-numbers' , stderr = subprocess .STDOUT , shell = True )
99
101
except subprocess .CalledProcessError as exception :
100
102
messages = exception .output .decode ().split ('\n ' )
101
103
output = reporter .create_output (messages = messages ) # type: ignore
0 commit comments