Skip to content

Commit

Permalink
test linting
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanKarlbergg committed Apr 17, 2024
1 parent 1939efc commit 8894d7e
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/code-qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Code-QA

on: push

jobs:
mypy:
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 mypy
run: |
pip install mypy remotivelabs-broker>=0.1.8 pytest
- name: Run mypy
run: |
mypy python --no-namespace-packages
ruff-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: "python"

ruff-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: "python"
args: format --check --diff

pylint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
architecture: x64
- name: Install pylint
run: |
pip install pylint
- name: Run pylint
run: pylint python
34 changes: 34 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[MAIN]
py-version=3.8
ignore=.venv

good-names-rgxs=__,.*__.*

[DESIGN]
max-args=7
max-attributes=11


[FORMAT]
max-line-length=140
max-module-lines=1000


[MESSAGES CONTROL]
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
use-implicit-booleaness-not-comparison-to-string,
use-implicit-booleaness-not-comparison-to-zero,
missing-function-docstring,
missing-class-docstring,
missing-module-docstring,
logging-fstring-interpolation,
broad-exception-raised,
too-few-public-methods,
cell-var-from-loop
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.8
76 changes: 76 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Exclude a variety of commonly ignored directories.
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__'
]

line-length = 140
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[lint]
select = ["C901", "E", "W", "F", "RET505", "I001", "B034", "EXE001", "N", "UP032", "FA"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
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__

0 comments on commit 8894d7e

Please sign in to comment.