Skip to content

Conversation

@blozano-tt
Copy link
Contributor

@blozano-tt blozano-tt commented Jan 29, 2026

Problem

When stdin is not a TTY (e.g., in CI environments like GitHub Actions), CodeChecker fixit attempts to read and parse JSON from stdin for report filtering. If stdin is empty (which is common in CI), this fails with:

[ERROR] - JSON format error on standard input: Expecting value: line 1 column 1 (char 0)

This forces users to use workarounds like:

  • script -q -c 'CodeChecker fixit ...' /dev/null

Solution

This change reads stdin first and only attempts JSON parsing if there is actual content. Empty stdin is now treated as 'no report filter' (reports = None), which is the same behavior as when stdin is a TTY.

Changes

  • Read stdin content before attempting JSON parse
  • Only parse if content is non-empty after stripping whitespace
  • Empty stdin now behaves like TTY stdin (no filtering)

Testing

  • Tested locally with empty stdin in non-TTY context
  • Verified that piped JSON input still works correctly

Complaint

This JSON feature does not seem to be mentioned in docs, it was strange to stumble into problems it introduced.

When stdin is not a TTY (e.g., in CI environments), CodeChecker fixit
would attempt to read and parse JSON from stdin. If stdin was empty,
this would fail with 'JSON format error on standard input'.

This change reads stdin first and only attempts JSON parsing if there
is actual content. Empty stdin is now treated as 'no report filter'
(reports = None), which is the same behavior as when stdin is a TTY.

This allows 'CodeChecker fixit' to work in CI environments without
requiring workarounds like piping empty JSON arrays.
Copy link
Contributor

@bruntib bruntib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!

@bruntib bruntib merged commit a838a30 into Ericsson:master Jan 30, 2026
10 of 11 checks passed
@bruntib bruntib modified the milestones: release 6.28.0, release 6.27.2 Feb 9, 2026
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