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

check50._api.run returns stdout+stderr #247

Open
pazz opened this issue Jan 25, 2021 · 0 comments
Open

check50._api.run returns stdout+stderr #247

pazz opened this issue Jan 25, 2021 · 0 comments
Assignees

Comments

@pazz
Copy link
Contributor

pazz commented Jan 25, 2021

Hi!
I've recently noticed some unexpected behaviour when running check50_.api.run on some command that outputs both to stdout (which I want as string) and stderr (which I want to ignore). I get both.

I am running this command:

 java -jar /home/pazz/.local/lib/python3.9/site-packages/check50_checkstyle/lib/checkstyle-8.39-all.jar -c naming-conventions.xml -f xml *.java

where the output on stdout is some XML report that I parse:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="8.39">
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/EmptyGUI.java">
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/Gui.java">
<error line="3" column="42" severity="error" message="Array brackets at illegal position." source="com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck"/>
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/LabelFrame.java">
</file>
<file name="/home/pazz/repo/teaching/2021-COMP122/content/lectures/code/l9a/NoLayout.java">
</file>
</checkstyle>

plus a summary (which I cannot suppress)

Checkstyle ends with 1 errors.

When I run this using the check50 API i get the concatenation as sole string result:

<?xml version="1.0" encoding="UTF-8"?>\n<checkstyle version="8.39">\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/EmptyGUI.java">\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/Gui.java">\n<error line="3" column="42" severity="error" message="Array brackets at illegal position." source="com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck"/>\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/LabelFrame.java">\n</file>\n<file name="/tmp/tmpd2chxmcv/checkstyle_naming_conventings/NoLayout.java">\n</file>\n</checkstyle>\nCheckstyle ends with 1 errors.\n

A hotfix for me is to append " 2>/dev/null" to the command, but this is obviously ugly and may only work as long as check50 uses a shell to interpret these commands.

Question/feature request: can we have a parameter to _api.run that allows to supress stdout?

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