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

Disable --by-file for CSV output #203

Closed
rohitn opened this issue Sep 24, 2020 · 4 comments
Closed

Disable --by-file for CSV output #203

rohitn opened this issue Sep 24, 2020 · 4 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@rohitn
Copy link

rohitn commented Sep 24, 2020

CSV output forces --by-file and there does not seem to be a way to disable it. Other output formats do not do this. Why is CSV special? Why not let the user choose by explicitly specifying --by-file if needed? Thanks.

@boyter
Copy link
Owner

boyter commented Sep 24, 2020

The main reason for this was I felt that if you were exporting to CSV it was because you are likely to want to run your own aggregations. Hence override.... SQL format does the same thing (although this is done to ensure it is compatible with cloc more than anything else).

I guess I see CSV and SQL occupying the same sort of niche output. Happy to be convinced otherwise though.

What use case are you anticipating where this would be desirable?

@boyter boyter closed this as completed Sep 24, 2020
@boyter boyter reopened this Sep 24, 2020
@rohitn
Copy link
Author

rohitn commented Sep 25, 2020

Hi Ben,

Thank you for the prompt response.

My use case is quite simple. There are several repositories against which I need to run scc for counts by language and integrate it into a build process. Each repository needs different scc option settings. After verifying all the settings I tried to generate CSV of the same output and was surprised that it was grouped by language and file and that the total row is missing. I would need an extra step to import the CSV into Excel or a DB, aggregate, and export as part of automating the process. There is no --not-by-file option to turn it off. Changing the behavior would be backward incompatible, not a good option.

I need this change soon, so I have forked the repo and started adding a csv-table format using func toHtmlTable as an example.

@boyter
Copy link
Owner

boyter commented Sep 28, 2020

I have no problem with making incompatible version changes :) The next version is already going to be 3.0.0 so putting this in isn't a huge issue from my perspective.

@boyter boyter added bug Something isn't working enhancement New feature or request labels Sep 28, 2020
@boyter boyter mentioned this issue Feb 23, 2021
@boyter
Copy link
Owner

boyter commented Feb 23, 2021

@rohitn This is sitting on a branch currently, but I have an example of the CSV below. Its a breaking change so scc -f csv is now by default the summary, but you can get the old logic with scc -f csv --by-file

summary.txt
by_file.txt

Note as txt because GitHub won't let me upload CSV.

@boyter boyter closed this as completed Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants