From 1addd0c672c2933cc01d0710e2fad51d9327861f Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 17:31:08 +0530 Subject: [PATCH 1/6] ci: remove format_checkers from pre-commit --- .pre-commit-config.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07baea0186..b44e95e56f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: From 966a4721bed46f31d2c3ee62db24f3645d46e4e6 Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 17:34:38 +0530 Subject: [PATCH 2/6] ci: removing format_checkers from linting --- .github/workflows/linting.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bd09688807..2a423fd10a 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -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: @@ -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: | From 5dd1ecfc97bf1e504ca0dc0c8ebbc232709e1a6b Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 17:51:59 +0530 Subject: [PATCH 3/6] ci: run format_checkers if checkers are added --- .github/workflows/formatting.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/formatting.yml diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 0000000000..6341865b5b --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,23 @@ +name: Formatting + +on: + push: + 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 From bbe50680892895e128da4d8134a999c6f7600657 Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 19:12:08 +0530 Subject: [PATCH 4/6] fix: formatting --- .github/workflows/formatting.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 6341865b5b..239e84e83d 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -2,6 +2,8 @@ name: Formatting on: push: + branches: + - main paths: - 'cve_bin_tool/checkers/__init__.py' @@ -21,3 +23,11 @@ jobs: - 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-precommit-config + delete-branch: true + author: GitHub From acbddf30960d2d73ed6e3fd557680ec04ef86948 Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 19:13:35 +0530 Subject: [PATCH 5/6] fix: commit branch --- .github/workflows/formatting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 239e84e83d..2d408f0015 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -28,6 +28,6 @@ jobs: with: commit-message: "chore: update checkers table" title: "chore: update checkers table" - branch: chore-precommit-config + branch: chore-update-table delete-branch: true author: GitHub From cb4cdec3a4df547c1bdff4ccff19697bc59eddf3 Mon Sep 17 00:00:00 2001 From: rhythmrx9 Date: Mon, 7 Mar 2022 19:37:54 +0530 Subject: [PATCH 6/6] docs: updating checker table --- CONTRIBUTING.md | 2 +- cve_bin_tool/checkers/README.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 98bbaba743..b7974cfd9e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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). diff --git a/cve_bin_tool/checkers/README.md b/cve_bin_tool/checkers/README.md index aa45672951..fb1880aa23 100644 --- a/cve_bin_tool/checkers/README.md +++ b/cve_bin_tool/checkers/README.md @@ -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.