diff --git a/.github/actions/commit-range/action.yml b/.github/actions/commit-range/action.yml index 17eb5b647..7331dda2b 100644 --- a/.github/actions/commit-range/action.yml +++ b/.github/actions/commit-range/action.yml @@ -1,3 +1,4 @@ +--- # Copyright (c) 2022, Eindhoven University of Technology - CST Robotics Group # BDS 3-Clause License (see ./LICENSE.md) @@ -13,7 +14,8 @@ runs: - name: Commit range id: commit-range env: - commit_list: ${{ toJson(github.event.commits) }} # Doing this inside run doesn't work because of piping + # Doing this inside run doesn't work because of piping: + commit_list: ${{ toJson(github.event.commits) }} run: | if [ "${GITHUB_EVENT_NAME}" == "push" ] then @@ -26,7 +28,9 @@ runs: NEWEST=$(echo "${commit_list}" | jq 'last.id' | tr -d '"') OLDEST_PARENTS=($(git show --no-patch --format="%P" ${OLDEST})) NUMBER_OLDEST_PARENTS=${#OLDEST_PARENTS[@]} - COMMIT_RANGE="${OLDEST}^${NUMBER_OLDEST_PARENTS}...${NEWEST}" # Take second parent if possible, see https://stackoverflow.com/a/2222920 + # Take second parent if possible, + # see https://stackoverflow.com/a/2222920: + COMMIT_RANGE="${OLDEST}^${NUMBER_OLDEST_PARENTS}...${NEWEST}" fi elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ] then diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b3af0463c..b0b493dac 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,12 +1,13 @@ +--- name: build -on: +on: # yamllint disable-line rule:truthy push: branches: - - master + - master pull_request: branches: - - master + - master jobs: @@ -17,22 +18,22 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - macos-latest + - ubuntu-latest + - macos-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: cachix/install-nix-action@v16 - with: - nix_path: nixpkgs=channel:nixos-21.11 - - name: Run tests in nix-shell - run: | - nix-shell --pure --run ' - python -m venv venv - venv/bin/pip install -e '.[isort,test]' - venv/bin/pytest - ' ./default.nix + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: cachix/install-nix-action@v16 + with: + nix_path: nixpkgs=channel:nixos-21.11 + - name: Run tests in nix-shell + run: | + nix-shell --pure --run ' + python -m venv venv + venv/bin/pip install -e '.[isort,test]' + venv/bin/pytest + ' ./default.nix build: @@ -41,37 +42,38 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest - - windows-latest - - macos-latest + - ubuntu-latest + - windows-latest + - macos-latest python-version: - - '3.6' - - '3.7' - - '3.8' - - '3.9' - - '3.10' + - '3.6' + - '3.7' + - '3.8' + - '3.9' + - '3.10' constraints: [''] include: - - os: ubuntu-latest - python-version: '3.7' - constraints: '--constraint constraints-oldest.txt' - - os: ubuntu-latest - python-version: '3.10' - constraints: '--constraint constraints-future.txt' + - os: ubuntu-latest + python-version: '3.7' + constraints: '--constraint constraints-oldest.txt' + - os: ubuntu-latest + python-version: '3.10' + constraints: '--constraint constraints-future.txt' steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v2 + with: + fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade 'pip>=20.3' # strict dependency resolution added in pip 20.3 - pip install -e '.[isort,test]' ${{ matrix.constraints }} - - name: Test with pytest - run: | - pytest + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + # strict dependency resolution added in pip 20.3 + python -m pip install --upgrade 'pip>=20.3' + pip install -e '.[isort,test]' ${{ matrix.constraints }} + - name: Test with pytest + run: | + pytest diff --git a/.github/workflows/test-future.yml b/.github/workflows/test-future.yml index 84dc3afff..6458e1232 100644 --- a/.github/workflows/test-future.yml +++ b/.github/workflows/test-future.yml @@ -1,27 +1,29 @@ +--- name: test-future # This workflow detects breakage against upcoming releases of dependencies # even in the absence of activity in Darker's own repository. -on: +on: # yamllint disable-line rule:truthy schedule: - - cron: "05 20 * * 6" + - cron: "05 20 * * 6" jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - ref: 'master' - fetch-depth: 0 - - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade 'pip>=20.3' # strict dependency resolution added in pip 20.3 - pip install -e '.[isort,test]' --constraint constraints-future.txt - - name: Test with pytest - run: | - pytest + - uses: actions/checkout@v2 + with: + ref: 'master' + fetch-depth: 0 + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install dependencies + run: | + # strict dependency resolution added in pip 20.3 + python -m pip install --upgrade 'pip>=20.3' + pip install -e '.[isort,test]' --constraint constraints-future.txt + - name: Test with pytest + run: | + pytest diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml index 5b9db4683..2ec753fc8 100644 --- a/.github/workflows/yaml-lint.yml +++ b/.github/workflows/yaml-lint.yml @@ -1,3 +1,4 @@ +--- name: Yaml Lint on: [push] # yamllint disable-line rule:truthy jobs: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2a63dc99..f4b0f5dfe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,22 +1,23 @@ +--- # See https://pre-commit.com for more information repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.3.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files -- repo: https://github.com/akaihola/darker + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/akaihola/darker rev: master hooks: - - id: darker + - id: darker args: [--isort] additional_dependencies: - black~=21.8b0 - isort~=5.9 -- repo: https://github.com/Lucas-C/pre-commit-hooks-markup + - repo: https://github.com/Lucas-C/pre-commit-hooks-markup rev: v1.0.1 hooks: - - id: rst-linter + - id: rst-linter args: [--allow-raw] diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 764295a63..99cd12320 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,8 @@ +--- - id: darker name: darker - description: "Black reformatting to Python files only in regions changed since last commit" + description: >- + Black reformatting to Python files only in regions changed since last commit entry: "darker -r :PRE-COMMIT:" language: python language_version: python3 diff --git a/.sourcery.yaml b/.sourcery.yaml index 70a55eec9..dafc20def 100644 --- a/.sourcery.yaml +++ b/.sourcery.yaml @@ -1,2 +1,3 @@ +--- ignore: - - 'test_*.py' # parameterized tests would trigger Length and Working Memory detection + - 'test_*.py' # parameterized tests trigger Length & Working Memory detection diff --git a/action.yml b/action.yml index 3c8b88477..c6849dfc3 100644 --- a/action.yml +++ b/action.yml @@ -1,11 +1,12 @@ +--- name: "Darker" description: "Apply Black, isort and linters to modified lines only." author: "Antti Kaihola and contributors to Darker" inputs: options: - description: - "Options passed to Darker. Use `darker --help` to see available options. Default: - '--check --diff'" + description: >- + Options passed to Darker. Use `darker --help` to see available options. + Default: '--check --diff' required: false default: "--check --diff" src: @@ -17,9 +18,9 @@ inputs: required: false default: "1.4.0" revision: - description: - 'Git revision range to compare when determining modified lines. ' - 'Determined automatically if omitted.' + description: >- + Git revision range to compare when determining modified lines. + Determined automatically if omitted. required: false branding: color: "black" @@ -54,7 +55,8 @@ runs: echo $entrypoint | python3 fi env: - # TODO: Remove once https://github.com/actions/runner/issues/665 is fixed. + # TODO: Remove once https://github.com/actions/runner/issues/665 is + # fixed. INPUT_OPTIONS: ${{ inputs.options }} INPUT_SRC: ${{ inputs.src }} INPUT_VERSION: ${{ inputs.version }}