Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: define optional and add missing types #8

Merged
merged 4 commits into from
Mar 11, 2024
Merged
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
79 changes: 79 additions & 0 deletions .github/.workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: PR - Lint and Test

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install poetry
run: |
python -m pip install --upgrade pip
pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"

- name: Install dependencies
run: |
poetry install
poetry run pip list

- name: Poetry check
run: |
poetry lock --check

- name: Lint with flake8
run: |
poetry run flake8 . --ignore=E501

- name: Lint with ruff
uses: chartboost/ruff-action@v1

- name: Checking format with black
run: |
poetry run black --check .

- name: Lint with pylint
run: |
poetry run pylint --disable=W,C,R,E -j 0 -rn -sn py_ocsf_models/

- name: Check types with mypy
run: |
poetry run mypy --strict py_ocsf_models/

- name: Bandit
run: |
poetry run bandit -q -lll -x './tests' -r .

- name: Safety
run: |
poetry run safety check

- name: Vulture
run: |
poetry run vulture --min-confidence 100 .

- name: Test with pytest
run: |
poetry run pytest -n auto --cov=./py_ocsf_models --cov-report=xml tests

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
15 changes: 14 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ repos:
hooks:
- id: flake8
exclude: contrib
args: ["--ignore=E266,W503,E203,E501,W605"]
args: ["--ignore=E501"]

- repo: /~https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
hooks:
# Run the linter.
- id: ruff
args: [--fix]

- repo: /~https://github.com/python-poetry/poetry
rev: 1.7.0
Expand All @@ -66,6 +73,12 @@ repos:
language: system
files: '.*\.py'

- id: mypy
name: mypy
entry: bash -c 'mypy --strict ./py_ocsf_models'
language: system
files: '.*\.py'

- id: trufflehog
name: TruffleHog
description: Detect secrets in your data.
Expand Down
Loading