Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Commit

Permalink
always_run: this hook will now run even if there are no matching files
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Apr 4, 2022
1 parent 5ce62ca commit be256da
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: CI

on: # cf. https://github.521000.bestmunity/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
push:
branches:
- master
pull_request:
branches:
- master

jobs:
check:
name: Run check
Expand All @@ -16,16 +14,13 @@ jobs:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- name: Checkout code 🛎️
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }} 🔧
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip 🏗️
uses: actions/cache@v2
with:
Expand All @@ -36,12 +31,9 @@ jobs:
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}
${{ runner.os }}-python-${{ matrix.python-version }}-
- name: Install ⚙️
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -U -r dev-requirements.txt
pip install -U .
pip install --upgrade . -r dev-requirements.txt
- name: Running checks ☑
run: pre-commit run --all-files --verbose
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
repos:
- repo: git://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
hooks:
- id: forbid-crlf
- id: forbid-tabs
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- repo: git://github.com/pre-commit/mirrors-pylint
rev: v2.4.4
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v3.0.0a4
hooks:
- id: pylint
args:
- --rcfile=.pylintrc
- --reports=no
- repo: git://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.1.0
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.2.4
hooks:
- id: python-safety-dependencies-check
- repo: git://github.com/Lucas-C/pre-commit-hooks-bandit
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.5
hooks:
- id: python-bandit-vulnerability-check
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
types: [python]
entry: bandit_analyzer
args: [-lll, --recursive, .]
files: ''
always_run: true
pass_filenames: false
3 changes: 3 additions & 0 deletions pre_commit_hooks/bandit_analyzer.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import print_function
import sys
import bandit
from bandit.cli.main import main as bandit_cli_main


def main():
print(f"Bandit version: {bandit.__version__}")
print("Calling", " ".join(sys.argv))
try:
bandit_cli_main()
return 0
Expand Down

0 comments on commit be256da

Please sign in to comment.