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 966c58a
Show file tree
Hide file tree
Showing 7 changed files with 187 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
21 changes: 21 additions & 0 deletions =0.1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Requirement already satisfied: mypy in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (1.8.0)
Requirement already satisfied: remotivelabs-broker in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (0.1.16)
Requirement already satisfied: pytest in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (7.4.4)
Requirement already satisfied: typing-extensions>=4.1.0 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from mypy) (4.9.0)
Requirement already satisfied: mypy-extensions>=1.0.0 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from mypy) (1.0.0)
Requirement already satisfied: tomli>=1.1.0 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from mypy) (2.0.1)
Requirement already satisfied: grpc-stubs~=1.53.0.5 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (1.53.0.5)
Requirement already satisfied: grpcio~=1.44 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (1.60.0)
Requirement already satisfied: mypy-protobuf~=3.3.0 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (3.3.0)
Requirement already satisfied: grpc-interceptor~=0.14 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (0.15.4)
Requirement already satisfied: requests~=2.21 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (2.31.0)
Requirement already satisfied: protobuf<=3.20.1,>=3.19.0 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (3.20.1)
Requirement already satisfied: types-protobuf~=4.24.0.20240106 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from remotivelabs-broker) (4.24.0.20240106)
Requirement already satisfied: packaging in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from pytest) (23.2)
Requirement already satisfied: iniconfig in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from pytest) (2.0.0)
Requirement already satisfied: pluggy<2.0,>=0.12 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from pytest) (1.3.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from pytest) (1.2.0)
Requirement already satisfied: idna<4,>=2.5 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from requests~=2.21->remotivelabs-broker) (3.6)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from requests~=2.21->remotivelabs-broker) (3.3.2)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from requests~=2.21->remotivelabs-broker) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/johan/.pyenv/versions/3.8.18/lib/python3.8/site-packages (from requests~=2.21->remotivelabs-broker) (2023.11.17)
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 966c58a

Please sign in to comment.