Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,23 @@ on:
types: [created]

jobs:
lint:
lint-pre-commit:
runs-on: ubuntu-latest
name: pre-commit
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: pre-commit
run: |
pip install pre-commit
pre-commit run -a

lint-quality:
needs: lint-pre-commit

if: github.ref == 'refs/heads/master'

permissions:
Expand Down Expand Up @@ -55,6 +71,8 @@ jobs:
continue-on-error: true

build:
needs: lint-pre-commit

runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
exclude: |
(?x)^(
tests/test_data/.*|
examples/.*|
py3gpp/codes/.*
)$

repos:
- repo: "https://github.com/psf/black"
rev: "23.3.0"
hooks:
- id: "black"
args: [--line-length=120]

- repo: "https://github.com/pycqa/isort"
rev: "5.12.0"
hooks:
- id: "isort"
args:
- "--profile=black"

- repo: "https://github.com/pycqa/flake8"
rev: "6.0.0"
hooks:
- id: "flake8"
args: [--max-line-length=120]

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v4.4.0"
hooks:
- id: "trailing-whitespace"
- id: "mixed-line-ending"
args:
- "--fix=lf"
- id: "end-of-file-fixer"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ See Matlab documentation of equivalent function
## Formatting
* Screen width 120
* spaces on each side of math operators like +-*/
* run `pre-commit run -a` before any push. Otherwise PR will be rejected
## Testing
* Each function must have a hard-coded test that can run on CI
* Each function should have a Matlab test that can run on a machine with Matlab license
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pylint
anybadge
pytest
pytest-xdist
importlib_resources
importlib_resources
pre-commit