Merged
Conversation
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix JSON output formatting and CLI testing issues in CI/CD environments
This PR addresses two critical issues that were preventing proper functionality:
BaseModel.model_dump_json()with theseparatorsargument causes aTypeError#8: FixedTypeErrorwhen callingBaseModel.model_dump_json()with unsupportedseparatorsargumentCliRunner.invoke()method withcolor=False(the default) is not properly disabling ANSI color codes in the output during CI/CD testing #9: Fixed ANSI color codes appearing in CLI test output despitecolor=FalsesettingMotivation and Context
Issue #8 was causing the CLI to crash when using
--format=jsondue to Pydantic'smodel_dump_json()method not supporting theseparatorsparameter that was added in a previous PR.Issue #9 was causing test failures in CI/CD environments (particularly GitHub Actions) where Typer's
CliRunner.invoke()with Rich integration was still emitting ANSI color codes despitecolor=False, making string assertions fail.Changes Made
🔧 Fixed JSON Output (Issue #8)
separatorsargument fromBaseModel.model_dump_json()call in__main__.pyindent=Nonefor compact JSON output insteadastor.to_source()with built-inast.unparse()for better Python 3.12+ compatibilityastordependency frompyproject.toml🎨 Fixed CLI Testing Color Issues (Issue #9)
env={"NO_COLOR": "1", "TERM": "dumb"}📊 Enhanced Testing Infrastructure
pyproject.tomlHow Has This Been Tested?
Breaking Changes
None. All changes are backward compatible and improve existing functionality.
Types of changes
Checklist
Additional context
These fixes improve the stability and reliability of the codeanalyzer tool, particularly in automated environments. The removal of the
astordependency in favor of Python's built-inast.unparse()also reduces external dependencies while maintaining the same functionality with better Python 3.12+ support.Related Issues:
BaseModel.model_dump_json()with theseparatorsargument causes aTypeError#8CliRunner.invoke()method withcolor=False(the default) is not properly disabling ANSI color codes in the output during CI/CD testing #9