From e9b8ab4d75b9914613f8a914430810fda9f073f9 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Mon, 3 Oct 2022 21:40:32 +0200 Subject: [PATCH] Add pre-commit to the CI (#967) --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/pre-commit.yml | 13 +++++++++++++ .pre-commit-config.yaml | 6 +++--- CONTRIBUTING.rst | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e80c3065..10a376bb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,11 +48,11 @@ jobs: # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. - + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild @@ -61,7 +61,7 @@ jobs: # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. + # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. # - run: | diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..a809bb0a --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,13 @@ +name: "Pre-commit" + +jobs: + pre-commit: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Install + run: pip3 install pre-commit + - name: Run + run: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e6fdb94d..94e44717 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,13 +6,13 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: 'https://github.com/asottile/pyupgrade' - rev: v2.34.0 + rev: v2.37.3 hooks: - id: pyupgrade args: - '--py37-plus' - repo: 'https://github.com/psf/black' - rev: 22.6.0 + rev: 22.8.0 hooks: - id: black - repo: 'https://github.com/PyCQA/isort' @@ -20,6 +20,6 @@ repos: hooks: - id: isort - repo: 'https://github.com/pycqa/flake8' - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 2cb645c9..f5beb89a 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -66,7 +66,7 @@ botocore calls eventually called. The best way I've seen to upgrade botocore support is by performing the following: -1. Download sources of the release of botocore you're trying to upgrade to, and the version of botocore that aiobotocore is currently locked to (see setup.py) and do a folder based file comparison of the botocore folders (tools like DiffMerge are nice). +1. Download sources of the release of botocore you're trying to upgrade to, and the version of botocore that aiobotocore is currently locked to (see setup.py) and do a folder based file comparison of the botocore folders (tools like DiffMerge are nice). 2. Manually apply the relevant changes to their aiobotocore equivalent(s). Note that sometimes new functions are added which will need to be overridden (like `__enter__` -> `__aenter__`) 3. Update the "extras" in setup.py to the versions which match the botocore version you are targeting. 4. Now do a directory diff between aiobotocore and your target version botocore directory to ensure the changes were propagated.