Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: csv_as_enclosure_json.py is not calculating weight #10

Open
dominik-bln opened this issue Apr 24, 2020 · 2 comments
Open

MacOS: csv_as_enclosure_json.py is not calculating weight #10

dominik-bln opened this issue Apr 24, 2020 · 2 comments

Comments

@dominik-bln
Copy link

dominik-bln commented Apr 24, 2020

It looks like the fix introduced in #6 has problems with parsing the cloc output on MacOS. The output contains ./ at the start there and that fails to match with the other file then, e. g.:

language,filename,blank,comment,code,"github.com/AlDanial/cloc v 1.84  T=3.30 s (770.2 files/s, 63550.3 lines/s)"
YAML,./api/shareboards/lib/tests/cassettes/test_box_client_get_all_files_from_shared_item.yaml,0,0,2427
JSON,./frontend/src/translations/en.json,0,0,1990
JSON,./frontend/src/translations/de.json,0,0,1990
JSON,./frontend/src/translations/ja.json,0,0,1990

When I reintroduced the [2:] that was removed in 50348f7#diff-8b05bc8468d5386e008aa65a09d1bb29 it is working again

@dominik-bln
Copy link
Author

I installed cloc via brew install cloc, maybe this is not the correct version?

@wonderbird
Copy link
Contributor

wonderbird commented Dec 28, 2021

The same problem applies here as well. I have fixed the code as shown here: b4122e1.

Unfortunately I have seen this issue here later and thus moved my original fix to the better place in the linked commit.

Edit: Please note that my commits are based upon @HelgeCPH 's python3 migration. We are discussing them in pull request #7 .

adamtornhill added a commit that referenced this issue Dec 31, 2021
Fix issue MacOS: csv_as_enclosure_json.py is not calculating weight #10
SoulStar7116 pushed a commit to SoulStar7116/matt-script that referenced this issue Nov 15, 2024
See issue [#10](adamtornhill/maat-scripts#10)

On macOS, cloc saves file paths with leading "./" while
code-maat leaves this prefix out.

As a consequence all weights are set to 0.0 because
the normalized_weight_for(module_name) never finds
a match.

The bugfix removes a leading "./" prefix, if it exists,
when initializing a StructuralElement.

Note: This fix combines the associated bugfix on branch python3
into a single commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants