Skip to content

Commit 91fc339

Browse files
committed
Add common tools to project
1 parent a039787 commit 91fc339

File tree

6 files changed

+442
-10
lines changed

6 files changed

+442
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,5 @@ $RECYCLE.BIN/
283283

284284
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
285285

286+
287+
Testing/

.pre-commit-config.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
exclude: '^(\.tox|\.env|dist|\.vscode)(/|$)'
2+
repos:
3+
- repo: https://github.com/pre-commit/mirrors-prettier
4+
rev: "v3.1.0"
5+
hooks:
6+
- id: prettier
7+
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: "v5.0.0"
10+
hooks:
11+
- id: check-byte-order-marker
12+
- id: check-merge-conflict
13+
args: [--assume-in-merge]
14+
- id: check-case-conflict
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: debug-statements
18+
- id: check-added-large-files
19+
args: ["--maxkb=5000"]
20+
- id: check-toml
21+
# - id: check-json
22+
- id: mixed-line-ending
23+
args: ["--fix=lf"]
24+
- id: trailing-whitespace
25+
- id: debug-statements
26+
27+
- repo: https://github.com/charliermarsh/ruff-pre-commit
28+
rev: "v0.6.9"
29+
hooks:
30+
# Run the linter.
31+
- id: ruff
32+
args: [--fix]
33+
# Run the formatter.
34+
- id: ruff-format
35+
36+
- repo: local
37+
hooks:
38+
- id: mypy
39+
name: mypy
40+
entry: poetry run poe run-type-checks
41+
language: system
42+
types: [python]
43+
pass_filenames: false
44+
verbose: true

.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"python.testing.pytestArgs": ["python"],
33
"python.testing.unittestEnabled": false,
4-
"python.testing.pytestEnabled": true
4+
"python.testing.pytestEnabled": true,
5+
"cSpell.words": [
6+
"-DCMAKE_BUILD_TYPE",
7+
"CMAKE_BUILD_TYPE",
8+
"pygerber",
9+
"PYGPP_BUILD"
10+
]
511
}

__build__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
from __future__ import annotations
44

5+
import multiprocessing
56
import os
67
import platform
78
import subprocess
89
import sys
910
from pathlib import Path
10-
import multiprocessing
11-
1211

1312
THIS_DIR = Path(__file__).parent
1413

@@ -24,7 +23,9 @@ def __init__(self, build_type: str) -> None:
2423
def build(self) -> None:
2524
"""Build extension module."""
2625
build_directory = Path.cwd() / "build"
27-
os.environ["PATH"] += os.pathsep + os.path.dirname(sys.executable)
26+
os.environ["PATH"] += os.pathsep + os.path.dirname( # noqa: PTH120
27+
sys.executable
28+
)
2829
self.cmake(
2930
"-S",
3031
".",
@@ -45,12 +46,12 @@ def build(self) -> None:
4546

4647
def cmake(self, *arg: str) -> None:
4748
"""Run cmake command. If fails, raises CalledProcessError."""
48-
print("cmake", *arg)
49-
python_executable_directory = os.path.dirname(sys.executable)
49+
print("cmake", *arg) # noqa: T201
50+
python_executable_directory = os.path.dirname(sys.executable) # noqa: PTH120
5051

5152
if platform.system() == "Windows":
5253
cmake_executable = python_executable_directory + os.path.sep + "cmake.exe"
53-
elif platform.system() == "Linux":
54+
elif platform.system() == "Linux": # noqa: SIM114
5455
cmake_executable = python_executable_directory + os.path.sep + "cmake"
5556
elif platform.system() == "Darwin":
5657
cmake_executable = python_executable_directory + os.path.sep + "cmake"
@@ -69,9 +70,9 @@ def cmake(self, *arg: str) -> None:
6970
)
7071

7172

72-
print(sys.argv)
73+
print(sys.argv) # noqa: T201
7374

7475
if "--no-root" in sys.argv:
75-
print("Skipping building of root package.")
76+
print("Skipping building of root package.") # noqa: T201
7677
else:
7778
Builder(os.environ.get("PYGPP_BUILD", "DEBUG")).build()

poetry.lock

Lines changed: 162 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)