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
Dry run mode #72
Dry run mode #72
Conversation
README.md
Outdated
@@ -42,6 +42,8 @@ optional arguments: | |||
--no-multiline convert only single line expressions | |||
-ll LINE_LENGTH, --line-length LINE_LENGTH | |||
for expressions spanning multiple lines, convert only if the resulting single line will fit into the line length limit. Default value is 88 characters. | |||
-n, --dry-run Do not change the file in-place. Useful when running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why -n? I am using the first letter as a short-hand for each flag; -d would be more consistent (and intuitive imo)
src/flynt/cli.py
Outdated
"--dry-run", | ||
action="store_true", | ||
default=False, | ||
help="Do not change the file in-place. Useful when running as a linting process." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's useful to elaborate that it MUST be used with --fail-on-change, otherwise flynt just does nothing and returns nothing or potentially fails.
Thanks for your contribution!
|
Thanks for the feedback! Does this looks reasonable to you?
For example on the CI of https://github.com/yt-project/yt, this produces
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thumbs up on picking up the diff part as well. I didn't know there was a stdlib module for handling this!
I have tried this and it works nicely. Ready to merge it, with the small comment about readme - now that we print diff the --dry-run
became useful on it's own.
src/flynt/cli.py
Outdated
"--dry-run", | ||
action="store_true", | ||
default=False, | ||
help="Do not change the file in-place. Useful when running as a linting process." | ||
help="Do not change the file in-place. Note that this must be used in " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When suggesting this change, I didn't consider we will end up implementing printing diff. Now it's more relevant to state that proposed diff will be printed to stdout, and --dry-run because useful on it's own without --fail-on-change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fixed now.
Thanks! merged. |
Do you think it would be possible to issue a release (v.50.0)? |
This adds a dry-run mode and fixes #48.