-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add option to select specific fixer to run #333
Conversation
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.
please add changelog note, and update the readme to include fixer names
i'll review this properly later
src/django_upgrade/data.py
Outdated
ast_funcs: ASTCallbackMapping = defaultdict(list) | ||
for fixer in FIXERS: | ||
# TODO: is this where we want to do the name extraction? |
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.
no
tests/test_main.py
Outdated
if changed: | ||
assert result == 1 | ||
assert out == "from django.core.paginator import Paginator\n" | ||
else: | ||
assert result == 0 | ||
assert out == input_ |
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.
I don't like conditional tests, it makes the test code too complicated. can we instead have two test functions, one, for the "changes expected case", one for the "no changes expected"?
5cd0bc6
to
01f3766
Compare
updated. i did find myself wishing for a command that could output a list of all available fixers but that's a bit tricky due to the current argparse structure so left that for now |
This comment was marked as spam.
This comment was marked as spam.
01f3766
to
d5bbe25
Compare
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.
Thank you for starting this @davidszotten. I deferred reviewing because I want this to come in not as a piecemeal feature, but fully formed so it covers most use cases.
I have just rebased the branch and plan to continue work later. I think we should still add the following:
- Rename the option to
--only
, since it selects only some fixers (or some other suggestion?) - Add an opposing
--skip
option to skip named fixers. This would users work around when one fixer makes bad changes in their code base. - Add a
--list-fixers
option to list the fixers. - Documentation for all the above.
d5bbe25
to
7871d2c
Compare
Hi, all. I was just wondering what the current state of this PR is? I can't tell if it's currently with David, Adam, or looking for volunteers to implement the additions mentioned above (happy to volunteer if it's the latter). This feature would have come in useful recently as I upgraded a few projects to 5.0. |
I'm not actively working on it and it doesn't seem like David is either. If you want to make a new PR extending this one with the remaining pieces that I listed, I'd be glad of the help. |
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
Sorry for the spam ☝🏻 I forgot I'd referenced this PR early on in my WIP PR description. 😬 |
* Add ability to run specific fixers with ``--only <fixer_name>`` * Add ability to skip specific fixers with ``--skip <fixer_name>`` * Add ability to list all possible fixers with ``--list-fixers`` Thanks to Gav O'Connor in `PR #TODO <TODO>`__. Thanks to David Szotten in `PR adamchainz#333 <https://github.com/adamchainz/django-upgrade/pull/333>`__.
Done in #443. |
Add
--fixer foo
option (can be repeated) to only run specific fixers. Fixes #278