I am using Pylint on a project and would like to use it as a step of our continuos integration, I want that every time that missin-final-newline message is happend it will exit(1). My code just walk through all the paths and pylint all over files:
def get_all_py_paths() -> List:
"""
Iterate over all directories and get the full path of .py files.
:return: list of absolute .py paths
"""
logging.info('Run get all path function')
file_paths = []
for root, _, files in os.walk('../'):
for filename in files:
if filename.endswith('.py') and '__init__' not in filename:
filepath = os.path.join(root, filename)
file_paths.append(filepath)
return file_paths
if __name__ == '__main__':
files_path = get_all_py_paths()
results = lint.Run(PYLINT_PARAMS + files_path, do_exit=False)
print(results.option_groups)
pylint_score = results.linter.stats['global_note']
if pylint_score < THRESHOLD:
exit(1)
i added to the pylintrc file:
fail-on=missing-final-newline
and
enable=c-extension-no-member, missing-final-newline
but also with the fail-on it still just warning and not exit(1). There is a way to add something to pylint conf something to make missing-final-newline to exit(1) if it happend?