diff --git a/.github/workflows/python_static_analysis.yml b/.github/workflows/python_static_analysis.yml deleted file mode 100644 index 00f51c1..0000000 --- a/.github/workflows/python_static_analysis.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Python Static Analysis - -on: - pull_request: - push: - branches: [main] - workflow_dispatch: - -jobs: - job: - runs-on: ubuntu-latest - - steps: - - # https://github.com/actions/setup-python - - name: Install Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Python dependencies - run: | - pip install --upgrade pip - pip install black 'black[jupyter]' flake8 isort - - # https://github.com/actions/checkout - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Run isort - run: isort --check . - - - name: Run black - run: black --check . - - - name: Run flake8 - run: flake8 diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml new file mode 100644 index 0000000..cda5891 --- /dev/null +++ b/.github/workflows/static_analysis.yml @@ -0,0 +1,35 @@ +name: Static Analysis + +on: + pull_request: + push: + branches: [main] + workflow_dispatch: + +jobs: + job: + runs-on: ubuntu-latest + + steps: + + # https://github.com/actions/setup-python + - name: Install Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Python dependencies + run: | + pip install --upgrade pip + pip install black 'black[jupyter]' flake8 isort + pip install pre-commit + + # https://github.com/actions/checkout + - name: Checkout quantifying + uses: actions/checkout@v4 + with: + path: quantifying + + - name: pre-commit + run: pre-commit run --show-diff-on-failure --color=always --all-files + working-directory: ./quantifying diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 578dd11..d8e7662 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks -exclude: \\.coverage.* default_language_version: - python: python3.9 + python: python3.11 ci: autofix_commit_msg: | @@ -16,12 +15,33 @@ ci: skip: [] submodules: false +repos: + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: destroyed-symlinks + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - --fix=no + - id: trailing-whitespace + repos: - repo: local hooks: - id: black name: "Black" - entry: black --check + entry: black language: system types: ["file", "python", "text"] @@ -33,6 +53,6 @@ repos: - id: isort name: "isort" - entry: isort --check --filter-files + entry: isort --filter-files language: system types: ["file", "python", "text"] \ No newline at end of file