Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
uses: ./.github/actions/python-environment

- name: Run format check
run: poetry run -- nox -s project:format
run: poetry run -- nox -s format:check

Build-Packages:
name: Build Package Check
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s project:fix
entry: poetry run -- nox -s format:fix
stages: [ pre-commit ]

- repo: local
Expand Down Expand Up @@ -39,4 +39,4 @@ repos:
- id: end-of-file-fixer
stages: [ pre-commit ]
- id: trailing-whitespace
stages: [ pre-commit ]
stages: [ pre-commit ]
4 changes: 4 additions & 0 deletions doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Unreleased

## Refactoring

* #606: Renamed nox session `project:fix` more aptly to `format:fix` and `project:format` to `format:check`
4 changes: 2 additions & 2 deletions doc/user_guide/features/formatting_code/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ deterministic manner.
+--------------------+------------------+------------------------------------+
| Nox session | CI Usage | Action |
+====================+==================+====================================+
| ``project:fix`` | No | Applies code formatting changes |
| ``format:fix`` | No | Applies code formatting changes |
+--------------------+------------------+------------------------------------+
| ``project:format`` | ``checks.yml`` | Checks that current code does not |
| ``format:check`` | ``checks.yml`` | Checks that current code does not |
| | | need to be re-formatted |
+--------------------+------------------+------------------------------------+

Expand Down
10 changes: 5 additions & 5 deletions doc/user_guide/features/formatting_code/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
Troubleshooting
===============

Formatting still fails after running ``project:fix``
Formatting still fails after running ``format:fix``
----------------------------------------------------

If when you execute:

#. Run ``project:fix``
#. Run ``project:format``
#. Run ``format:fix``
#. Run ``format:check``

you receive an error from ``project:format`` (i.e. ``isort`` or ``black``), it it
you receive an error from ``format:check`` (i.e. ``isort`` or ``black``), it it
likely that you need to update your configuration to align with
:ref:`formatting_configuration`.

Expand Down Expand Up @@ -44,7 +44,7 @@ might want to ignore automatically applied formatting.
+-----------------------+--------------------------------+-----------------------+


In the ``checks.yml``, ``project:format`` wants me to reformat code I did not modify
In the ``checks.yml``, ``format:check`` wants me to reformat code I did not modify
------------------------------------------------------------------------------------

This is likely due to one of our tools (i.e. ``black``) being upgraded. Within the
Expand Down
6 changes: 3 additions & 3 deletions doc/user_guide/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ For example, if test execution isn't performed in the standard way (e.g., :code:
from exasol.toolbox.nox.tasks import * # pylint: disable=wildcard-import disable=unused-wildcard-import

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["project:fix"]
nox.options.sessions = ["format:fix"]

@nox.session(name="project:fix", python=False)
@nox.session(name="format:fix", python=False)
def my_project_fix_overwrite(session) -> None:
"""Runs all automated fixes on the code base"""

Expand All @@ -75,7 +75,7 @@ For example, if test execution isn't performed in the standard way (e.g., :code:
from exasol.toolbox.nox._shared import python_files

py_files = [f"{file}" for file in python_files(PROJECT_CONFIG.root)]
print("The original 'project:fix' task has been taken hostage by this overwrite")
print("The original 'format:fix' task has been taken hostage by this overwrite")
print("Files:\n{files}".format(files="\n".join(py_files))


Expand Down
10 changes: 5 additions & 5 deletions exasol/toolbox/nox/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ def command(*args: str) -> Iterable[str]:
session.run(*command("ruff", "check"), *files)


@nox.session(name="project:fix", python=False)
def fix(session: Session) -> None:
"""Runs all automated fixes on the code base"""
@nox.session(name="format:fix", python=False)
def fix_format(session: Session) -> None:
"""Runs all automated format fixes on the code base"""
py_files = python_files(PROJECT_CONFIG.root)
_version(session, Mode.Fix)
_pyupgrade(session, config=PROJECT_CONFIG, files=py_files)
_ruff(session, mode=Mode.Fix, files=py_files)
_code_format(session, Mode.Fix, py_files)


@nox.session(name="project:format", python=False)
def fmt_check(session: Session) -> None:
@nox.session(name="format:check", python=False)
def check_format(session: Session) -> None:
"""Checks the project for correct formatting"""
py_files = python_files(PROJECT_CONFIG.root)
_ruff(session, mode=Mode.Check, files=py_files)
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/nox/_package_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""
ATTENTION:
This file is generated by exasol/toolbox/nox/_package_version.py when using:
* either "poetry run -- nox -s project:fix"
* either "poetry run -- nox -s format:fix"
* or "poetry run -- nox -s version:check -- --fix"
Do not edit this file manually!
If you need to change the version, do so in the pyproject.toml, e.g. by using
Expand Down
4 changes: 2 additions & 2 deletions exasol/toolbox/nox/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"check",
"clean_docs",
"coverage",
"fix",
"fix_format",
"integration_tests",
"lint",
"open_docs",
Expand All @@ -22,7 +22,7 @@
# ruff: noqa F401
from exasol.toolbox.nox._format import (
_code_format,
fix,
fix_format,
)

# fmt: off
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
uses: exasol/python-toolbox/.github/actions/python-environment@v3

- name: Run format check
run: poetry run -- nox -s project:format
run: poetry run -- nox -s format:check

Build-Packages:
name: Build Package Check
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from exasol.toolbox.nox.tasks import *

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["project:fix"]
nox.options.sessions = ["format:fix"]
2 changes: 1 addition & 1 deletion exasol/toolbox/templates/pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s project:fix
entry: poetry run -- nox -s format:fix

- repo: local
hooks:
Expand Down
2 changes: 1 addition & 1 deletion exasol/toolbox/version.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from exasol.toolbox.nox.tasks import * # pylint: disable=wildcard-import disable=unused-wildcard-import

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["project:fix"]
nox.options.sessions = ["format:fix"]


# entry point for debugging
Expand Down
76 changes: 38 additions & 38 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
types: [ python ]
pass_filenames: false
language: system
entry: poetry run -- nox -s project:fix
entry: poetry run -- nox -s format:fix
stages: [ pre-commit ]

- repo: local
Expand Down Expand Up @@ -39,4 +39,4 @@ repos:
- id: end-of-file-fixer
stages: [ pre-commit ]
- id: trailing-whitespace
stages: [ pre-commit ]
stages: [ pre-commit ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""ATTENTION:
This file is generated by exasol/toolbox/nox/_package_version.py when using:
* either "poetry run -- nox -s project:fix"
* either "poetry run -- nox -s format:fix"
* or "poetry run -- nox -s version:check -- --fix"
Do not edit this file manually!
If you need to change the version, do so in the pyproject.toml, e.g. by using
Expand Down
2 changes: 1 addition & 1 deletion project-template/{{cookiecutter.repo_name}}/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from exasol.toolbox.nox.tasks import *

# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = ["project:fix"]
nox.options.sessions = ["format:fix"]
Loading