Reattempt at committing #939
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linter | |
on: | |
pull_request: | |
push: | |
branches: ["master", "main"] | |
jobs: | |
flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
- name: Run flake8 for critical errors | |
run: | | |
# Fail the build for the following critical errors: | |
# E9** syntax, io, or indentation error | |
# F63* syntax error in assertion, comparison, or print | |
# F7** syntax error in loops or functions | |
# F82* undefined variables | |
# Currently still excluding some files in Informatics that import from rdkit! | |
flake8 molSimplify --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=fragment_classes.py,frag_functionalizer.py,bridge_functionalizer.py | |
- name: Run full flake8 linter | |
run: | | |
# Will never fail the build because of the --exit-zero flag but gives a report of the "code quality" | |
flake8 molSimplify --count --statistics --max-complexity 15 --max-line-length=127 --exit-zero | |
- name: Report Status | |
# Slack notifications only on the main repo | |
if: ${{ github.event_name != 'pull_request' && github.repository == 'hjkgrp/molSimplify' && job.status == 'failure'}} | |
#uses: ravsamhq/notify-slack-action@v1 | |
uses: 8398a7/action-slack@v3 | |
with: | |
fields: message,commit,author,workflow,job,took | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK}} | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mypy types-setuptools types-PyYAML types-requests types-tensorflow types-beautifulsoup4 pandas-stubs PyQt5-stubs | |
- name: Typecheck with mypy | |
run: | | |
mypy --ignore-missing-imports molSimplify | |
- name: Report Status | |
# Slack notifications only on the main repo | |
if: ${{ github.event_name != 'pull_request' && github.repository == 'hjkgrp/molSimplify' && job.status == 'failure'}} | |
#uses: ravsamhq/notify-slack-action@v1 | |
uses: 8398a7/action-slack@v3 | |
with: | |
fields: message,commit,author,workflow,job,took | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK}} | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required |