Skip to content

Commit 72b321b

Browse files
committed
fix: rename format command
1 parent 5bc8d1e commit 72b321b

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pip install -r requirements.lint.txt
8585
# Run lint
8686
inv lint
8787
# Run formatter (will tell you which files it modified)
88-
inv format
88+
inv lint --format
8989
```
9090

9191
If you get the error `ERROR:darker.git:fatal: Not a valid commit name <hash>`,

tasks.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,14 @@ def _migrate_file(url: str, filename: str):
3131

3232

3333
@task
34-
def lint(c, revision="origin/dev"):
34+
def lint(c, format=False, revision="origin/dev"):
3535
"""Lint and format.
3636
3737
Linter/formatter are automatically read from `pyproject.toml`.
3838
"""
39-
c.run(f"darker --diff --check --revision {revision} .", warn=True)
39+
diff = "--diff --check" if not format else ""
40+
c.run(f"darker {diff} --revision {revision} .", warn=True)
4041
c.run("echo '\n'")
4142
out = c.run(f"git diff -U0 {revision} | lint-diffs")
4243
if out.stdout.strip() != "=== pylint: mine=0, always=0":
4344
print(out.stdout)
44-
45-
46-
@task
47-
def format(c, revision="origin/dev"):
48-
"""Format code.
49-
50-
Linter/formatter are automatically read from `pyproject.toml`.
51-
"""
52-
c.run(f"darker --verbose --revision {revision} .", warn=True)

0 commit comments

Comments
 (0)