Fix issues #8 and #9 #10
Merged
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 theseparators
argument causes aTypeError
#8: FixedTypeError
when callingBaseModel.model_dump_json()
with unsupportedseparators
argumentCliRunner.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=False
settingMotivation and Context
Issue #8 was causing the CLI to crash when using
--format=json
due to Pydantic'smodel_dump_json()
method not supporting theseparators
parameter 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)
separators
argument fromBaseModel.model_dump_json()
call in__main__.py
indent=None
for compact JSON output insteadastor.to_source()
with built-inast.unparse()
for better Python 3.12+ compatibilityastor
dependency frompyproject.toml
🎨 Fixed CLI Testing Color Issues (Issue #9)
env={"NO_COLOR": "1", "TERM": "dumb"}
📊 Enhanced Testing Infrastructure
pyproject.toml
How 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
astor
dependency 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 theseparators
argument causes aTypeError
#8CliRunner.invoke()
method withcolor=False
(the default) is not properly disabling ANSI color codes in the output during CI/CD testing #9