File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,19 @@ Example:
109
109
OK
110
110
111
111
112
+ ``upgrade ``
113
+ ^^^^^^^^^^^
114
+
115
+ Upgrade lint rules or client code to the latest version of Fixit.
116
+ Automatically applies fixes from all upgrade rules in :mod: `fixit.upgrade `.
117
+
118
+ Shortcut for ``fixit --rules fixit.upgrade fix --automatic <path> ``
119
+
120
+ .. code :: console
121
+
122
+ $ fixit upgrade [PATH ...]
123
+
124
+
112
125
``debug ``
113
126
^^^^^^^^^
114
127
Original file line number Diff line number Diff line change 15
15
16
16
from .api import fixit_paths , print_result
17
17
from .config import collect_rules , generate_config , parse_rule
18
- from .ftypes import Config , Options , Tags
18
+ from .ftypes import Config , Options , QualifiedRule , Tags
19
19
from .rule import LintRule
20
20
from .testing import generate_lint_rule_test_cases
21
21
from .util import capture
@@ -218,6 +218,21 @@ def test(ctx: click.Context, rules: Sequence[str]):
218
218
ctx .exit (1 )
219
219
220
220
221
+ @main .command ()
222
+ @click .pass_context
223
+ @click .argument ("paths" , nargs = - 1 , type = click .Path (path_type = Path ))
224
+ def upgrade (ctx : click .Context , paths : Sequence [Path ]):
225
+ """
226
+ upgrade lint rules and apply deprecation fixes
227
+
228
+ roughly equivalent to `fixit --rules fixit.upgrade fix --automatic`
229
+ """
230
+ options : Options = ctx .obj
231
+ options .rules = (QualifiedRule ("fixit.upgrade" ),)
232
+
233
+ ctx .invoke (fix , paths = paths , interactive = False )
234
+
235
+
221
236
@main .command ()
222
237
@click .pass_context
223
238
@click .argument ("paths" , nargs = - 1 , type = click .Path (exists = True , path_type = Path ))
You can’t perform that action at this time.
0 commit comments