Skip to content

Commit

Permalink
Replace black with ruffs formatter (minvws#2762)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeroen Dekkers <[email protected]>
Co-authored-by: Jan Klopper <[email protected]>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent 492ca1a commit f09cbdc
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 73 deletions.
12 changes: 4 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ repos:
exclude: |
/tests/
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.3.4'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.3.5'
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
Expand All @@ -72,11 +73,6 @@ repos:
- id: django-upgrade
args: [--target-version, "4.2"]

- repo: https://github.com/psf/black
rev: "24.3.0"
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
Expand Down Expand Up @@ -145,7 +141,7 @@ repos:
exclude: '^rocky/rocky/templates/admin/.*\.html$'

- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v16.3.0
rev: v16.3.1
hooks:
- id: stylelint
args: [ --fix ]
Expand Down
4 changes: 0 additions & 4 deletions boefjes/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ build-backend = "setuptools.build_meta:__legacy__"
line-length = 120
transform-concats = true

[tool.black]
target-version = ["py310", "py311"]
line-length = 120

[tool.pytest.ini_options]
env = [
"KATALOGUS_DB_URI=postgresql://postgres:postgres@ci_katalogus-db:5432/ci_katalogus",
Expand Down
4 changes: 0 additions & 4 deletions bytes/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,3 @@ pytest-env = "^1.1.3"
[build-system]
requires = ["setuptools>=65", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"

[tool.black]
target-version = ["py310", "py311"]
line-length = 120
4 changes: 0 additions & 4 deletions cveapi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[tool.black]
target-version = ["py310", "py311"]
line-length = 120

[tool.poetry]
name = "cveapi"
version = "0.0.1.dev1"
Expand Down
2 changes: 1 addition & 1 deletion keiko/keiko/keiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"\\": r"\textbackslash{}",
"\n": "\\newline%\n",
"-": r"{-}",
"\xA0": "~", # Non-breaking space
"\xa0": "~", # Non-breaking space
"[": r"{[}",
"]": r"{]}",
}
Expand Down
4 changes: 0 additions & 4 deletions keiko/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ httpx = "^0.27.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
target-version = ["py310", "py311"]
line-length = 120
4 changes: 0 additions & 4 deletions mula/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,3 @@ omit = [
"scheduler/utils/*",
"scheduler/__main__.py",
]

[tool.black]
target-version = ["py310", "py311"]
line-length = 120
4 changes: 1 addition & 3 deletions octopoes/octopoes/repositories/ooi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,7 @@ def construct_neighbour_query(cls, reference: Reference, paths: set[Path] | None
:where [[?e :xt/id _xt_id]]
}}
:in-args [["{reference}"]]
}}""".format(
reference=reference, related_fields=" ".join(segment_query_sections)
)
}}""".format(reference=reference, related_fields=" ".join(segment_query_sections))

return query

Expand Down
4 changes: 0 additions & 4 deletions octopoes/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ pytest-env = "^1.1.3"
pytest-timeout = "^2.1.0"
pytest-httpx = "^0.30.0"

[tool.black]
target-version = ["py310", "py311"]
line-length = 120

[tool.pytest.ini_options]
addopts = "--cov --cov-branch --cov-report=term-missing:skip-covered"
env = [
Expand Down
28 changes: 1 addition & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[tool.black]
target-version = ["py310", "py311"]
line-length = 120

[tool.mypy]
python_version = "3.10"
plugins = ["pydantic.mypy"]
Expand Down Expand Up @@ -31,32 +27,10 @@ paths = ["."]
fix = true

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"old",
"dist",
"node_modules",
"venv",
extend-exclude = [
"__pycache__"

]

# Same as Black.
line-length = 120

# Support Python 3.10 and higher
Expand Down
6 changes: 3 additions & 3 deletions rocky/account/forms/account_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ def __init__(self, *args, **kwargs):
self.fields["trusted_clearance_level"].disabled = True
self.fields["acknowledged_clearance_level"].label = _("Accepted clearance level")
self.fields["acknowledged_clearance_level"].required = False
self.fields["acknowledged_clearance_level"].widget.attrs[
"fixed_paws"
] = self.instance.acknowledged_clearance_level
self.fields["acknowledged_clearance_level"].widget.attrs["fixed_paws"] = (
self.instance.acknowledged_clearance_level
)
self.fields["acknowledged_clearance_level"].widget.attrs["class"] = "level-indicator-form"
if self.instance.user.is_superuser:
self.fields["trusted_clearance_level"].disabled = True
Expand Down
4 changes: 3 additions & 1 deletion rocky/katalogus/forms/plugin_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def clean(self):

# The form assigns "" and in some scenario's null to all unfilled (optional) fields
cleaned_data = {
key: value for key, value in cleaned_data.items() if value is not None and value != "" # noqa: PLC1901
key: value
for key, value in cleaned_data.items()
if value is not None and value != "" # noqa: PLC1901
}

validator = Draft202012Validator(self.plugin_schema)
Expand Down
1 change: 1 addition & 0 deletions rocky/manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys

Expand Down
4 changes: 0 additions & 4 deletions rocky/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,3 @@ max_line_length = 120
blank_line_after_tag = "load,extends,include"
# https://www.djlint.com/docs/linter/#rules
ignore = "H006,H016,H017,H030,H031"

[tool.black]
target-version = ["py310", "py311"]
line-length = 120
3 changes: 1 addition & 2 deletions rocky/tests/reports/test_web_systems_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def test_web_report_all_findings(
"Hostname.<hostname[is Website].<website[is SecurityTXT]": {
hostname.reference: [],
},
"Hostname.<hostname[is ResolvedHostname].address.<address[is IPPort]."
"<ooi[is Finding].finding_type": {
"Hostname.<hostname[is ResolvedHostname].address.<address[is IPPort].<ooi[is Finding].finding_type": {
hostname.reference: web_report_finding_types,
},
"Hostname.<hostname[is Website].certificate.<ooi[is Finding].finding_type": {
Expand Down

0 comments on commit f09cbdc

Please sign in to comment.