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

fix capture to file #61

Merged
merged 1 commit into from
Apr 20, 2024
Merged

Conversation

jeffols
Copy link
Contributor

@jeffols jeffols commented Apr 14, 2024

Problem:
combination of --format and --output results in an empty output file

Example:
flake8 --format json --output $(tty)
flake8 --format json-pretty --output $(tty)

Pre-fix:
output truncated in file

Post-fix:
expected output in file

Subclasses of base.BaseFormatter.close need to call super().close() in order to close the output file handle and flush buffered data to the output file otherwise it is lost when flake8 exist.

tests/flake8_json_reporter_test.py Outdated Show resolved Hide resolved
src/flake8_json_reporter/reporters.py Outdated Show resolved Hide resolved
Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

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

Address Anthony 's feedback

@sigmavirus24 sigmavirus24 self-requested a review April 14, 2024 23:47
@jeffols
Copy link
Contributor Author

jeffols commented Apr 15, 2024

My apologies, I was not familiar with pre-commit. TIL.

Copy link
Contributor Author

@jeffols jeffols left a comment

Choose a reason for hiding this comment

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

changes complete

@jeffols jeffols requested a review from asottile April 15, 2024 22:57
@asottile asottile force-pushed the fix-json-output-to-file branch from 1978bc4 to 081bb17 Compare April 20, 2024 17:57
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit de76154 into PyCQA:main Apr 20, 2024
3 checks passed
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.

3 participants