Skip to content

Commit

Permalink
Fold fmt_check session into lint
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthagen committed Dec 11, 2023
1 parent 41a0074 commit 1eda803
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
strategy:
matrix:
job:
- { nox-session: fmt_check, poetry-groups: "lint" }
- { nox-session: lint, poetry-groups: "lint" }
# type_check needs main and test dependencies for inline type annotations.
- { nox-session: type_check, poetry-groups: "type_check,main,test" }
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ To automatically format code, run:
(fact) $ nox -s fmt
```

To verify code has been formatted, such as in a CI job:

```bash
(fact) $ nox -s fmt_check
```

## Type Checking

[Type annotations](https://docs.python.org/3/library/typing.html) allows developers to include
Expand Down
21 changes: 12 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import List

import nox
from nox import parametrize
from nox_poetry import Session, session

nox.options.error_on_external_run = True
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["fmt_check", "lint", "type_check", "test", "docs"]
nox.options.sessions = ["lint", "type_check", "test", "docs"]


@session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
Expand All @@ -33,14 +35,15 @@ def fmt(s: Session) -> None:


@session(venv_backend="none")
def fmt_check(s: Session) -> None:
s.run("ruff", "check", ".", "--select", "I")
s.run("ruff", "format", "--check", ".")


@session(venv_backend="none")
def lint(s: Session) -> None:
s.run("ruff", "check", ".")
@parametrize(
"commands",
[
["ruff", "check", "."],
["ruff", "format", "--check", "."],
],
)
def lint(s: Session, commands: List[str]) -> None:
s.run(*commands)


@session(venv_backend="none")
Expand Down

0 comments on commit 1eda803

Please sign in to comment.