Skip to content

Commit

Permalink
test linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanKarlbergg committed Jul 3, 2024
1 parent 1939efc commit a33cf05
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/code-qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Code-QA

on: push

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8.18
architecture: x64
- name: Checkout
uses: actions/checkout@v4
- name: Install deps
run: |
pip install mypy==1.8.0 pylint==3.2.5 ruff==0.1.14 remotivelabs-broker>=0.1.8 pytest
- name: Run lint
run: |
cd python
make
cd -
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
*.iml
*.iml
.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8
100 changes: 100 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[tool.ruff]
line-length = 140
indent-width = 4
exclude = [
'.bzr',
'.direnv',
'.eggs',
'.git',
'.git-rewrite',
'.hg',
'.ipynb_checkpoints',
'.mypy_cache',
'.nox',
'.pants.d',
'.pyenv',
'.pytest_cache',
'.pytype',
'.ruff_cache',
'.svn',
'.tox',
'.venv',
'.vscode',
'__pypackages__',
'_build',
'buck-out',
'build',
'dist',
'node_modules',
'site-packages',
'venv',
'deps',
'binaries',
'__pycache__'
]
[tool.ruff.lint]
select = ['C901', 'E', 'W', 'F', 'RET505', 'I001', 'B034', 'EXE001', 'N', 'UP032', 'FA']
ignore = []
mccabe = { max-complexity = 14 }

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false

[tool.pylint]
ignore=[
'.bzr',
'.direnv',
'.eggs',
'.git',
'.git-rewrite',
'.hg',
'.ipynb_checkpoints',
'.mypy_cache',
'.nox',
'.pants.d',
'.pyenv',
'.pytest_cache',
'.pytype',
'.ruff_cache',
'.svn',
'.tox',
'.venv',
'.vscode',
'__pypackages__',
'_build',
'buck-out',
'build',
'dist',
'node_modules',
'site-packages',
'venv',
'deps',
'binaries',
'__pycache__'
]
recursive=true

[tool.pylint.format]
max-line-length=140
max-module-lines=1000

[tool.pylint.messages_control]
disable=['wrong-import-order',
'missing-module-docstring',
'missing-class-docstring',
'missing-function-docstring',
'duplicate-code']

[tool.mypy]
strict = true
allow_untyped_calls = true
check_untyped_defs = true
warn_return_any = true
warn_unused_ignores = true
show_error_codes = true

[[tool.mypy.overrides]]
module = "someip.*"
ignore_missing_imports = true
3 changes: 2 additions & 1 deletion python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.pyc
__pycache__
.venv
__pycache__
38 changes: 38 additions & 0 deletions python/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
MAKEFLAGS += -j4 -O
.DEFAULT_GOAL := lint

.PHONY: lint
lint: pylint mypy ruff-format ruff

.PHONY: pylint
pylint:
pylint .
@echo ""

.PHONY: mypy
mypy:
mypy . --config-file ../pyproject.toml --no-namespace-packages
@echo ""

.PHONY: ruff-format
ruff-format:
ruff format --check --diff
@echo ""

.PHONY: ruff
ruff:
ruff check
@echo ""

.PHONY: lint-fix
fix: ruff-fix ruff-format-fix

.PHONY: ruff-fix
ruff-fix:
ruff check --fix
@echo ""

.PHONY: ruff-format-fix
ruff-format-fix:
ruff format
@echo ""

0 comments on commit a33cf05

Please sign in to comment.