Skip to content

Commit

Permalink
ci: switch format_checker to run in ci (closes #1582) (#1593)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rhythmrx9 committed Mar 8, 2022
1 parent 70973dd commit 7a9827e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 15 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Formatting

on:
push:
branches:
- main
paths:
- 'cve_bin_tool/checkers/__init__.py'

jobs:
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
cache: 'pip'
- name: Install cve-bin-tool
run: |
python -m pip install --upgrade wheel
python -m pip install .
- name: Run format_checkers.py
run: |
python cve_bin_tool/format_checkers.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: "chore: update checkers table"
title: "chore: update checkers table"
branch: chore-update-table
delete-branch: true
author: GitHub <noreply@github.com>
7 changes: 1 addition & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tool: ['isort', 'black', 'pyupgrade', 'flake8', 'format_checkers', 'bandit', 'gitlint']
tool: ['isort', 'black', 'pyupgrade', 'flake8', 'bandit', 'gitlint']
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -26,11 +26,6 @@ jobs:
python -m pip install --upgrade setuptools
python -m pip install --upgrade pre-commit
pre-commit install
- name: Install cve-bin-tool if needed
if: ${{ matrix.tool == 'format_checkers' }}
run: |
python -m pip install --upgrade wheel
python -m pip install .
- name: Run ${{ matrix.tool }} using pre-commit
if: ${{ matrix.tool != 'gitlint' }}
run: |
Expand Down
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ repos:
- id: bandit
args: ["-c", "bandit.conf"]

- repo: local
hooks:
- id: format_checkers
language: system
name: format_checkers
entry: python cve_bin_tool/format_checkers.py
files: "^cve_bin_tool/checkers/__init__.py"

- repo: https://github.com/jorisroovers/gitlint
rev: v0.17.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ We use [pyupgrade](https://github.com/asottile/pyupgrade) to make sure our synta

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.

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.
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.

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).

Expand Down
4 changes: 4 additions & 0 deletions cve_bin_tool/checkers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,7 @@ return following dictionary.
In most of the cases, Just providing above five class attributes will be enough.
But sometimes, you need to override this method to correctly detect version of
the product. We have done this in the checkers of `python`, `sqlite` and `kerberos`.

## Updating checker table
You do not need to run format_checkers.py to update the checker table in documentation.
A pull request with updated checker table is created automatically when a new checker is merged.

0 comments on commit 7a9827e

Please sign in to comment.