Skip to content

Commit

Permalink
rename ruff config file
Browse files Browse the repository at this point in the history
  • Loading branch information
JHalbauer committed Oct 22, 2024
1 parent e263242 commit b18a2db
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 58 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ jobs:
pip3 install ruff==${{ inputs.ruff-version }}
ruff --version
- name: Configure ruff
if: ${{ hashFiles('pyproject.toml') == '' }}
if: ${{ hashFiles('ruff.toml') == '' }}
run: |
echo "pyproject.toml does not exists. Will be downloaded."
wget https://raw.githubusercontent.com/mundialis/github-workflows/main/linting-config-examples/pyproject.toml
echo "ruff.toml does not exists. Will be downloaded."
wget https://raw.githubusercontent.com/mundialis/github-workflows/main/linting-config-examples/ruff.toml
- name: Lint with ruff
run: |
ruff check --config pyproject.toml .
ruff check --config ruff.toml .
super-linter:
name: super-linter
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions linting-config-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ same way and place them in your directory root to adjust.
`pylint --rc-file=.pylintrc_allowed_to_fail .`

## ruff
ruff contains rules inspired by black, flake8, pylint and more and is extremely fast in linting and formatting Python code. Simply add a pyproject.toml config file to the root of your repository.
See example here or visit [official documentation](https://docs.astral.sh/ruff/). `ruff check --config pyproject.toml .`
ruff contains rules inspired by black, flake8, pylint and more and is extremely fast in linting and formatting Python code. Simply add a ruff.toml config file to the root of your repository.
See example here or visit [official documentation](https://docs.astral.sh/ruff/). `ruff check --config ruff.toml .`

## superlinter
Superlinter is a wrapper for many different linters. Each has a different way to be configured.
Expand Down
45 changes: 0 additions & 45 deletions linting-config-examples/pyproject.toml

This file was deleted.

44 changes: 44 additions & 0 deletions linting-config-examples/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Ruff configuration file: ruff.toml

# Define the required version for Ruff
required-version = ">=0.7.0"

line-length = 79

# Specify directories or files to be excluded from Ruff linting, in addition to default exclusions
extend-exclude = [
".git",
"__pycache__",
".env",
".venv",
"env",
"venv",
"ENV",
"env.bak",
"venv.bak",
"ctypes",
"pydispatch",
]

# Uncomment the following sections as needed

# [format]
# Format settings for Ruff (quote-style and indent-style)
# quote-style = "double"
# indent-style= "tab"

# [lint]
# Define linting rules selection and ignore list
# select = [
# "A", # flake8-builtins (A)
# "COM", # flake8-commas
# "PL", # Pylint
# ]
# ignore = [
# "E402", # module-import-not-at-top-of-file
# "E501", # line-too-long
# ]

# [lint.per-file-ignores]
# Define file-specific linting rule ignores
# "lib_dop/r_dop_import_lib.py" = ["ERA001", "PLR2004"]
14 changes: 7 additions & 7 deletions pre_commit_hooks/linting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ echo
echo "flake8: `flake8 --version`"
echo "pylint: `pylint --version`"
echo "black: `black --version`"
echo "black: `ruff --version`"
echo "ruff: `ruff --version`"

########
# lint #
Expand Down Expand Up @@ -192,19 +192,19 @@ if [ $RUN_RUFF != "FALSE" ]
then
echo
echo "RUFF:"
if test -f "pyproject.toml"
if test -f "ruff.toml"
then
echo "pyproject.toml exists"
echo "ruff.toml exists"
else
# Same behaviour as in workflow
echo "pyproject.toml does not exists. Will be downloaded."
wget https://raw.githubusercontent.com/mundialis/github-workflows/main/linting-config-examples/pyproject.toml
echo "ruff.toml does not exists. Will be downloaded."
wget https://raw.githubusercontent.com/mundialis/github-workflows/main/linting-config-examples/ruff.toml
fi
ruff check --config pyproject.toml .
ruff check --config ruff.toml .
if [ $? -ne 0 ]
then
RETURNCODE=1
FAILINGSTEP="$FAILINGSTEP RUFF (run 'ruff check --config pyproject.toml .')"
FAILINGSTEP="$FAILINGSTEP RUFF (run 'ruff check --config ruff.toml .')"
fi
else
echo
Expand Down

0 comments on commit b18a2db

Please sign in to comment.