Closed anentropic closed 7 years ago
the logic here is wrong
def run():
parser = argparse.ArgumentParser(description='Codacy coverage reporter for Python.')
parser.add_argument("-r", "--report", help="coverage report file",
default=[DEFAULT_REPORT_FILE], type=str,
action='append')
parser.add_argument("-c", "--commit", type=str, help="git commit hash")
parser.add_argument("-d", "--directory", type=str, help="git top level directory")
parser.add_argument("-v", "--verbose", help="show debug information", action="store_true")
args = parser.parse_args()
if args.verbose:
logging.Logger.setLevel(logging.getLogger(), logging.DEBUG)
if not CODACY_PROJECT_TOKEN:
logging.error("environment variable CODACY_PROJECT_TOKEN is not defined.")
exit(1)
if not args.commit:
args.commit = get_git_revision_hash()
# Explictly check ALL files before parsing any
for rfile in args.report:
if not os.path.isfile(rfile):
logging.error("Coverage report " + args.report + " not found.")
exit(1)
Firstly, the logging should be:
logging.error("Coverage report " + rfile + " not found.")
But more importantly, it is failing because my specified path has been appended to [DEFAULT_REPORT_FILE]
and the default path doesn't exist. Basically default path should only be added if no user-specified paths are supplied.
I will make a PR