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

Fix generate_filename#36

Merged
rtfpessoa merged 2 commits intoarchived-codacy:masterfrom
IceflowRE:master
Dec 20, 2017
Merged

Fix generate_filename#36
rtfpessoa merged 2 commits intoarchived-codacy:masterfrom
IceflowRE:master

Conversation

@IceflowRE
Copy link
Copy Markdown

@IceflowRE IceflowRE commented Nov 15, 2017

I discovered some issues with the generate_filename function.

Folder structure

project
  |-- src
  |    |-- package
  |    |     \-- foo2.py
  |    \-- foo.py
  |-- data
  \-- doc

Executing generate_filename:

print(generate_filename(["/home/iceflower/project/src/"], "foo.py", "/home/iceflower/project/"))
print(generate_filename(["/home/iceflower/project/src/"], "package/foo2.py", "/home/iceflower/project/"))

Result:

src/foo.py
package/foo2.py

Expected:

src/foo.py
src/package/foo2.py

Reason:
reporter.py#L49
package/foo2.py cannot be found in the /home/iceflower/project/src/ which is obvious.
Then it will check the subfolder reporter.py#54.
But it will never found them because package/foo2.py as a filename does not exist.

Fix
Use of os.path.isfile() instead of the own function.


Other bug: the strip_prefix does not support Windows \ and Linux / separators, but the git subprocess can (will ever?) return / style, while the coverage.xml can contain the Windows style. So the prefix cannot be stripped correctly.

Fix
Replace Windows style seperator with Linux style seperators.

@rtfpessoa
Copy link
Copy Markdown

LGTM 👍

and be sure that git_directory has linux seperator style too
@IceflowRE
Copy link
Copy Markdown
Author

IceflowRE commented Nov 15, 2017

If git_directory is not available, subprocess gets not called everytime.
And be sure that git_directory has linux styled seperator too.

@IceflowRE IceflowRE mentioned this pull request Nov 15, 2017
@IceflowRE
Copy link
Copy Markdown
Author

IceflowRE commented Nov 22, 2017

Could this be merged soon? It prevents successfull/correct uploads to codacy.

@rtfpessoa rtfpessoa merged commit b33e250 into archived-codacy:master Dec 20, 2017
@rtfpessoa
Copy link
Copy Markdown

Sorry for the delay.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants