You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linting: Beyond formatting, linting helps catch potential errors and enforces coding standards. Tools like flake8 or pylint can be used alongside black and isort.
Static Analysis: Tools like mypy for type checking or bandit for finding common security issues can catch errors that are not detected by linters.
Code Coverage: Ensure that your tests cover a high percentage of your codebase with tools like coverage.py. This can be integrated to fail the build if the coverage falls below a certain threshold.
Dependency Checks: Use tools like pip-audit for Python to check for known vulnerabilities in your project dependencies.
Code Quality Metrics: Consider integrating a tool like SonarCloud or CodeClimate to keep track of technical debt and code complexity.
Documentation Checks: If you have project documentation (for example, with Sphinx), ensure it builds correctly and detect broken links.
Performance Benchmarking: If your project's performance is crucial, incorporate benchmarks to detect performance regressions.
Here's a sample snippet for a GitHub Action workflow including some of these suggestions:
name: Python CIon:
pull_request:
push:
branches:
- mainpaths:
- '**.py'jobs:
build:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v2
- name: Set up Pythonuses: actions/setup-python@v2with:
python-version: '3.8'
- name: Install dependenciesrun: | pip install -r requirements.txt pip install black isort flake8 mypy coverage
- name: Check code formatting with blackrun: black --check .
- name: Sort import statements with isortrun: isort --check-only .
- name: Lint with flake8run: flake8 .
- name: Static type-checking with mypyrun: mypy .
- name: Run pytest with coveragerun: | coverage run -m pytest coverage report --fail-under=80
- name: Check for security issues with banditrun: bandit -r .
The text was updated successfully, but these errors were encountered:
Ideas from ChatGPT:
flake8
orpylint
can be used alongsideblack
andisort
.mypy
for type checking orbandit
for finding common security issues can catch errors that are not detected by linters.coverage.py
. This can be integrated to fail the build if the coverage falls below a certain threshold.pip-audit
for Python to check for known vulnerabilities in your project dependencies.SonarCloud
orCodeClimate
to keep track of technical debt and code complexity.Here's a sample snippet for a GitHub Action workflow including some of these suggestions:
The text was updated successfully, but these errors were encountered: