Skip to content

Commit 7a9827e

Browse files
authored
ci: switch format_checker to run in ci (closes #1582) (#1593)
* closes #1582 * ci: remove format_checkers from pre-commit * ci: removing format_checkers from linting * ci: run format_checkers if checkers are added * fix: formatting * fix: commit branch * docs: updating checker table
1 parent 70973dd commit 7a9827e

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed

.github/workflows/formatting.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Formatting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'cve_bin_tool/checkers/__init__.py'
9+
10+
jobs:
11+
formatting:
12+
name: Formatting
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v2
17+
with:
18+
cache: 'pip'
19+
- name: Install cve-bin-tool
20+
run: |
21+
python -m pip install --upgrade wheel
22+
python -m pip install .
23+
- name: Run format_checkers.py
24+
run: |
25+
python cve_bin_tool/format_checkers.py
26+
- name: Create Pull Request
27+
uses: peter-evans/create-pull-request@v3
28+
with:
29+
commit-message: "chore: update checkers table"
30+
title: "chore: update checkers table"
31+
branch: chore-update-table
32+
delete-branch: true
33+
author: GitHub <[email protected]>

.github/workflows/linting.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
tool: ['isort', 'black', 'pyupgrade', 'flake8', 'format_checkers', 'bandit', 'gitlint']
15+
tool: ['isort', 'black', 'pyupgrade', 'flake8', 'bandit', 'gitlint']
1616
steps:
1717
- uses: actions/checkout@v2
1818
with:
@@ -26,11 +26,6 @@ jobs:
2626
python -m pip install --upgrade setuptools
2727
python -m pip install --upgrade pre-commit
2828
pre-commit install
29-
- name: Install cve-bin-tool if needed
30-
if: ${{ matrix.tool == 'format_checkers' }}
31-
run: |
32-
python -m pip install --upgrade wheel
33-
python -m pip install .
3429
- name: Run ${{ matrix.tool }} using pre-commit
3530
if: ${{ matrix.tool != 'gitlint' }}
3631
run: |

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ repos:
2626
- id: bandit
2727
args: ["-c", "bandit.conf"]
2828

29-
- repo: local
30-
hooks:
31-
- id: format_checkers
32-
language: system
33-
name: format_checkers
34-
entry: python cve_bin_tool/format_checkers.py
35-
files: "^cve_bin_tool/checkers/__init__.py"
36-
3729
- repo: https://github.com/jorisroovers/gitlint
3830
rev: v0.17.0
3931
hooks:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ We use [pyupgrade](https://github.com/asottile/pyupgrade) to make sure our synta
237237

238238
We also have a spell checker set up to help us avoid typos in documentation. The [spelling actions readme file](https://github.com/intel/cve-bin-tool/tree/main/.github/actions/spelling) gives more information including how to add new words to the dictionary if needed.
239239

240-
We also have a tool to help make sure that new checkers are added to the tables in our documentation. [The format_checkers code is here](https://github.com/intel/cve-bin-tool/blob/main/cve_bin_tool/format_checkers.py), if you're curious.
240+
We also have a tool to help make sure that new checkers are added to the tables in our documentation, this is automatically done with github actions. [The format_checkers code is here](https://github.com/intel/cve-bin-tool/blob/main/cve_bin_tool/format_checkers.py), if you're curious.
241241

242242
You can view all the config files for GitHub Actions (what we use for Continuous Integration (CI)) in [the .github/workflows directory](https://github.com/intel/cve-bin-tool/tree/main/.github/workflows).
243243

cve_bin_tool/checkers/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,7 @@ return following dictionary.
428428
In most of the cases, Just providing above five class attributes will be enough.
429429
But sometimes, you need to override this method to correctly detect version of
430430
the product. We have done this in the checkers of `python`, `sqlite` and `kerberos`.
431+
432+
## Updating checker table
433+
You do not need to run format_checkers.py to update the checker table in documentation.
434+
A pull request with updated checker table is created automatically when a new checker is merged.

0 commit comments

Comments
 (0)