-
Notifications
You must be signed in to change notification settings - Fork 83
Add support of ignore comment on the top of the file #291
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
Conversation
fsouza
left a comment
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.
Thanks for contributing!
README.md
Outdated
|
|
||
| To ignore the file, you can also add a comment to the top of the file: | ||
| ```python | ||
| # autoflake: ignore |
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.
can you make it skip_file instead?
It's more explicit. ignore can be a bit vague (is it ignoring the next line? the whole file?)
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.
Replaced with skip_file, thank you!
autoflake.py
Outdated
| if not source: | ||
| return source | ||
|
|
||
| if source.lstrip().startswith(IGNORE_COMMENT): |
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.
can you please make sure this works with shebangs too?
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.
sorry, what do you mean by shebangs?
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.
Something like:
#!/usr/bin/env python3
# autoflake: skip_file
...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.
Done, thank you!
3f2ec11 to
ba134f9
Compare
ba134f9 to
adeed89
Compare
fsouza
left a comment
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.
Thanks for contributing!
Autoflake can now ignore files with the
# autoflake: ignorecomment on top.Closes #97