Move flake8 config from toml to .flake8 as flake8 does not play nice with pyproject.toml and add pre-commit hook for flake8

This commit is contained in:
Cosmin Ciocan
2024-01-12 17:45:37 +01:00
parent ee68b4025b
commit 182e3519ad
9 changed files with 31 additions and 33 deletions
+5
View File
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 79
select = F,E,W,B,B901,B902,B903
exclude = .eggs,.git,.tox,nssm,obj,out,packages,pywin32,tests,swagger_client
ignore = E722,B001,W503,E203
+15 -1
View File
@@ -22,4 +22,18 @@ repos:
rev: 23.1.0
hooks:
- id: black
args: [--line-length, "79", --experimental-string-processing]
args: ["--config", "pyproject.toml"]
# python import sorting
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-path", "pyproject.toml"]
# python check (PEP8), programming errors and code complexity
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--config", ".flake8"]
+2 -1
View File
@@ -24,7 +24,8 @@
"--config=pyproject.toml"
],
"flake8.args": [
"--toml-config=pyproject.toml"
"--config",
".flake8"
],
"isort.args": [
"--settings-path=pyproject.toml"
+1 -1
View File
@@ -1,3 +1,3 @@
from .plugin import NVCCPlugin, load_ipython_extension
from .plugin import NVCCPlugin, load_ipython_extension # noqa: F401
__version__ = "1.0.2"
+4 -4
View File
@@ -5,7 +5,7 @@ def get_parser_cuda() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description=(
"%%cuda magic that compiles and runs CUDA C++ code in this cell."
" See https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda"
" See https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda" # noqa: E501
" for usage details."
)
)
@@ -20,7 +20,7 @@ def get_parser_cuda_group_run() -> argparse.ArgumentParser:
parser.description = (
"%%cuda_group_run magic that compiles and runs source files in a given"
" group. See"
" https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-run"
" https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-run" # noqa: E501
" for usage details."
)
parser.add_argument("-g", "--group", type=str, required=True)
@@ -32,7 +32,7 @@ def get_parser_cuda_group_save() -> argparse.ArgumentParser:
description=(
"%%cuda_group_save magic that saves CUDA C++ code in this cell for"
" later compilation and execution with possibly more source files."
" See https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-save"
" See https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-save" # noqa: E501
" for usage details."
)
)
@@ -45,7 +45,7 @@ def get_parser_cuda_group_delete() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description=(
"%%cuda_group_delete magic that deletes all files in a group. See"
" https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-delete"
" https://nvcc4jupyter.readthedocs.io/en/latest/magics.html#cuda-group-delete" # noqa: E501
" for usage details."
)
)
+2 -2
View File
@@ -17,8 +17,8 @@ SHARED_GROUP_NAME = "shared"
def print_out(out: str):
for l in out.split("\n"):
print(l)
for line in out.split("\n"):
print(line)
@magics_class
-22
View File
@@ -85,28 +85,6 @@ experimental-string-processing = true
[tool.coverage.run]
branch = true
[tool.flake8]
max-line-length = 79
select = "F,E,W,B,B901,B902,B903"
exclude = [
".eggs",
".git",
".tox",
"nssm",
"obj",
"out",
"packages",
"pywin32",
"tests",
"swagger_client"
]
ignore = [
"E722",
"B001",
"W503",
"E203"
]
[tool.pyright]
include = ["src"]
exclude = [
+1 -1
View File
@@ -1 +1 @@
from .fixtures.fixtures import *
from .fixtures.fixtures import * # noqa: F401,F403
+1 -1
View File
@@ -30,7 +30,7 @@ def fixtures_path(tests_path):
@pytest.fixture(scope="session")
def sample_magic_cu_line():
# fmt: off
return '--profile --profiler-args "--metrics l1tex__t_sectors_pipe_lsu_mem_global_op_ld.sum"'
return '--profile --profiler-args "--metrics l1tex__t_sectors_pipe_lsu_mem_global_op_ld.sum"' # noqa: E501
# fmt: on