Skip to content

Commit dc2d61f

Browse files
committed
Switch black & isort to use directory basis & add changelog entry
1 parent a73e22e commit dc2d61f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ be added (project-specific or globally), see the
88

99
* #469: Moved manual approval for slow tests to merge-gate.yml
1010
* #544: Added ruff to `project:fix` and `project:format` for handling unused imports
11+
* #364: Reduced output from `project:fix` and `project:format`
1112

1213
## Refactoring
1314

exasol/toolbox/nox/_format.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Iterable
4+
from pathlib import Path
45

56
import nox
67
from nox import Session
@@ -18,12 +19,12 @@
1819
_PYUPGRADE_ARGS = ("--py39-plus",)
1920

2021

21-
def _code_format(session: Session, mode: Mode, files: Iterable[str]) -> None:
22+
def _code_format(session: Session, mode: Mode, directory: Path) -> None:
2223
def command(*args: str) -> Iterable[str]:
2324
return args if mode == Mode.Fix else list(args) + ["--check"]
2425

25-
session.run(*command("isort"), *files)
26-
session.run(*command("black"), *files)
26+
session.run(*command("isort"), directory)
27+
session.run(*command("black"), directory)
2728

2829

2930
def _pyupgrade(session: Session, config: Config, files: Iterable[str]) -> None:
@@ -42,11 +43,10 @@ def fix(session: Session) -> None:
4243
py_files = python_files(PROJECT_CONFIG.root)
4344
_version(session, Mode.Fix)
4445
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
45-
_code_format(session, Mode.Fix, py_files)
46+
_code_format(session, Mode.Fix, PROJECT_CONFIG.root)
4647

4748

4849
@nox.session(name="project:format", python=False)
4950
def fmt_check(session: Session) -> None:
5051
"""Checks the project for correct formatting_code"""
51-
py_files = python_files(PROJECT_CONFIG.root)
52-
_code_format(session=session, mode=Mode.Check, files=py_files)
52+
_code_format(session=session, mode=Mode.Check, directory=PROJECT_CONFIG.root)

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ fail_under = 15
9090
line-length = 88
9191
verbose = false
9292
include = "\\.pyi?$"
93+
exclude = '''
94+
project-template/{{cookiecutter.repo_name}}/test/unit/unit_smoke_test.py
95+
'''
9396

9497
[tool.isort]
9598
profile = "black"

0 commit comments

Comments
 (0)