Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 5bba7e0

Browse files
committed
Move get_git_directory to the beginning
and be sure that git_directory has linux seperator style too
1 parent 703ab7b commit 5bba7e0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/codacy/reporter.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def strip_prefix(line, prefix):
5353
else:
5454
return line
5555

56-
if not git_directory:
57-
git_directory = get_git_directory()
58-
5956
for source in sources:
6057
if os.path.isfile(source + "/" + filename):
6158
return strip_prefix(source, git_directory).strip("/") + "/" + filename.strip("/")
@@ -196,6 +193,12 @@ def run():
196193
if not args.report:
197194
args.report.append(DEFAULT_REPORT_FILE)
198195

196+
if args.directory:
197+
git_directory = args.directory
198+
else:
199+
git_directory = get_git_directory()
200+
git_directory.replace("\\", "/")
201+
199202
# Explictly check ALL files before parsing any
200203
for rfile in args.report:
201204
if not os.path.isfile(rfile):
@@ -205,7 +208,7 @@ def run():
205208
reports = []
206209
for rfile in args.report:
207210
logging.info("Parsing report file %s...", rfile)
208-
reports.append(parse_report_file(rfile, args.directory))
211+
reports.append(parse_report_file(rfile, git_directory))
209212

210213
report = merge_and_round_reports(reports)
211214

0 commit comments

Comments
 (0)