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

Improve process output handling and streamline cloc JSON parsing #66

Merged

Conversation

mcdonnnj
Copy link
Contributor

This pull request improves how the scraper.util.execute() function handles process output. With this improved output handling we can also streamline processing the JSON output of the cloc command in the scraper.util.git_repo_to_sloc() function.

Since we already redirect stderr to stdout ine the Popen() call we do
not need the output of stderr from communicate() method. Additionally
we explicitly decode the bytes returned from the communicate() method
as a UTF-8 string. Using str() to type coerce the value results in a
bytes string literal instead of an appropriate UTF-8 str value.
Now that the returned value of the execute() function is a UTF-8 string
we do not need to perform any pre-processing before we use the
json.loads() function.
@IanLee1521 IanLee1521 merged commit bdffe18 into LLNL:main Aug 29, 2022
@mcdonnnj mcdonnnj deleted the improvement/improve_cloc_output_processing branch August 29, 2022 17:36
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

Successfully merging this pull request may close these issues.

2 participants