From 691a6afc9e7ec78f71fc791e2e462c37609cbbe7 Mon Sep 17 00:00:00 2001 From: Kostiantyn Goloveshko Date: Thu, 29 Jun 2023 16:10:51 +0300 Subject: [PATCH] Linters fixups --- .github/workflows/prerelease-checks.yml | 3 ++- .github/workflows/release-github.yml | 3 ++- .github/workflows/release-java.yml | 3 ++- .github/workflows/release-javascript.yml | 5 ++-- .github/workflows/release-ruby.yml | 3 ++- .github/workflows/test-go.yml | 5 ++-- .github/workflows/test-java.yml | 3 ++- .github/workflows/test-javascript.yml | 31 ++++++++++++------------ .github/workflows/test-ruby.yml | 23 +++++++++--------- go/Makefile | 2 +- go/README.md | 12 ++++----- java/scripts/check-jar.sh | 2 +- javascript/.eslintrc.json | 2 +- javascript/.prettierrc.json | 2 +- javascript/package.cjs.json | 2 +- javascript/tsconfig.build-cjs.json | 2 +- scripts/fail-if-dirty | 1 - testdata/JetBrainsSpace.txt | 2 +- 18 files changed, 57 insertions(+), 49 deletions(-) diff --git a/.github/workflows/prerelease-checks.yml b/.github/workflows/prerelease-checks.yml index 70dac573..7756342c 100644 --- a/.github/workflows/prerelease-checks.yml +++ b/.github/workflows/prerelease-checks.yml @@ -1,6 +1,7 @@ +--- name: Pre-release checks -on: +on: # yamllint disable-line rule:truthy workflow_call: jobs: diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 392c0802..477c4bc1 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -1,6 +1,7 @@ +--- name: Release on github -on: +on: # yamllint disable-line rule:truthy push: branches: - release/* diff --git a/.github/workflows/release-java.yml b/.github/workflows/release-java.yml index af584446..af31cc1f 100644 --- a/.github/workflows/release-java.yml +++ b/.github/workflows/release-java.yml @@ -1,6 +1,7 @@ +--- name: Release maven package -on: +on: # yamllint disable-line rule:truthy push: branches: - release/* diff --git a/.github/workflows/release-javascript.yml b/.github/workflows/release-javascript.yml index 977f661f..558b7667 100644 --- a/.github/workflows/release-javascript.yml +++ b/.github/workflows/release-javascript.yml @@ -1,10 +1,11 @@ +--- name: Release ci-environment npm module -on: +on: # yamllint disable-line rule:truthy push: branches: - release/* - + jobs: pre-release-check: diff --git a/.github/workflows/release-ruby.yml b/.github/workflows/release-ruby.yml index 527033ce..58a22274 100644 --- a/.github/workflows/release-ruby.yml +++ b/.github/workflows/release-ruby.yml @@ -1,6 +1,7 @@ +--- name: Release ci-environment ruby gem -on: +on: # yamllint disable-line rule:truthy push: branches: - release/* diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index dfe4d174..e4ada6a4 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -1,5 +1,6 @@ +--- name: test-go -on: +on: # yamllint disable-line rule:truthy push: branches: - main @@ -13,7 +14,7 @@ jobs: test: strategy: matrix: - go-version: [ 1.17.x, 1.18.x ] + go-version: ["1.17.x", "1.18.x"] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/.github/workflows/test-java.yml b/.github/workflows/test-java.yml index 53180d3a..d9578b64 100644 --- a/.github/workflows/test-java.yml +++ b/.github/workflows/test-java.yml @@ -1,6 +1,7 @@ +--- name: test-java -on: +on: # yamllint disable-line rule:truthy push: branches: - main diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index ae12505c..c341de94 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -1,6 +1,7 @@ +--- name: test-javascript -on: +on: # yamllint disable-line rule:truthy push: branches: - main @@ -26,17 +27,17 @@ jobs: node-version: '16.x' steps: - - name: set git core.autocrlf to 'input' - run: git config --global core.autocrlf input - - uses: actions/checkout@v3 - - name: with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - cache-dependency-path: javascript/package-lock.json - - run: npm install-ci-test - working-directory: javascript - - run: npm run eslint-fix - working-directory: javascript - - run: ./scripts/fail-if-dirty + - name: set git core.autocrlf to 'input' + run: git config --global core.autocrlf input + - uses: actions/checkout@v3 + - name: with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + cache-dependency-path: javascript/package-lock.json + - run: npm install-ci-test + working-directory: javascript + - run: npm run eslint-fix + working-directory: javascript + - run: ./scripts/fail-if-dirty diff --git a/.github/workflows/test-ruby.yml b/.github/workflows/test-ruby.yml index 1361c4ed..7d3a5ea8 100644 --- a/.github/workflows/test-ruby.yml +++ b/.github/workflows/test-ruby.yml @@ -1,6 +1,7 @@ +--- name: test-ruby -on: +on: # yamllint disable-line rule:truthy push: branches: - main @@ -26,14 +27,14 @@ jobs: ruby: '3.0' steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + working-directory: ruby + - name: bundle exec rake working-directory: ruby - - name: bundle exec rake - working-directory: ruby - run: bundle exec rake - - run: ./scripts/fail-if-dirty + run: bundle exec rake + - run: ./scripts/fail-if-dirty diff --git a/go/Makefile b/go/Makefile index 79304252..6ff0aebb 100644 --- a/go/Makefile +++ b/go/Makefile @@ -1,7 +1,7 @@ copy-template: cp ../CiEnvironments.json CiEnvironments.json -test: copy-template +test: copy-template @echo "running all tests" @go install ./... @go fmt ./... diff --git a/go/README.md b/go/README.md index d233ebec..472f3192 100644 --- a/go/README.md +++ b/go/README.md @@ -8,18 +8,18 @@ To embed the templates for the ci-environment go module, we'll use go:embed to i ## Template Expressions ### Simple Environment Variables -Many are simple replacements of environment variables. E.g, for Azure DevOps, the URI is simply the value of the `${BUILD_BUILDURI}` environment variable. +Many are simple replacements of environment variables. E.g, for Azure DevOps, the URI is simply the value of the `${BUILD_BUILDURI}` environment variable. ### Multiple Environment Variables and/or Constants -For others, it is a combination of multiple enviroment variables and constants. E.g., for Github Actions, the URI is the combination of `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`. +For others, it is a combination of multiple enviroment variables and constants. E.g., for Github Actions, the URI is the combination of `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`. ### Expression Syntax -Still for others, there is some additional processing of values that can be found in environment variables. In these cases, the value in the template consists of three parts: the environment variable to be used, the regex expression (including capture groups) to to used to derive the final value, and the template to be applied using the value(s) from those -capture groups. +Still for others, there is some additional processing of values that can be found in environment variables. In these cases, the value in the template consists of three parts: the environment variable to be used, the regex expression (including capture groups) to to used to derive the final value, and the template to be applied using the value(s) from those +capture groups. -E.g., the Git remote template for CodeShip has a value of `${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}`. The sections of this expression are delineated by unescaped slashes. So the three parts are the `CI_PULL_REQUEST` environment variable, the regex of `(.*)\\/pull\\/\\d+`, and the template of `\\1.git`. +E.g., the Git remote template for CodeShip has a value of `${CI_PULL_REQUEST/(.*)\\/pull\\/\\d+/\\1.git}`. The sections of this expression are delineated by unescaped slashes. So the three parts are the `CI_PULL_REQUEST` environment variable, the regex of `(.*)\\/pull\\/\\d+`, and the template of `\\1.git`. -So in this example, the URL in the CI_PULL_REQUEST environment variable will have everything prior to `pull/\d+` in a capture group, then the first (and only in this example) capture group is prepended to the literal `.git`. So if the CI_PULL_REQUEST envrionment variable were `https://github.com/owner/repo/pull/42`, then the value of `https://github.com/owner/repo` would be part of that first capture group, and then the resulting value will be `https://github.com/owner/repo.git`. +So in this example, the URL in the CI_PULL_REQUEST environment variable will have everything prior to `pull/\d+` in a capture group, then the first (and only in this example) capture group is prepended to the literal `.git`. So if the CI_PULL_REQUEST envrionment variable were `https://github.com/owner/repo/pull/42`, then the value of `https://github.com/owner/repo` would be part of that first capture group, and then the resulting value will be `https://github.com/owner/repo.git`. Or as explained in ARCHITECTURE.md: >The expression syntax for environment variables can use the form `${variable/pattern/replacement}`, similar to [bash parameter substitution](https://tldp.org/LDP/abs/html/parameter-substitution.html), but inspired from [sed's s command](https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html) which provides support for capture group back-references in the replacement. diff --git a/java/scripts/check-jar.sh b/java/scripts/check-jar.sh index 22ae0666..a47a3d9a 100755 --- a/java/scripts/check-jar.sh +++ b/java/scripts/check-jar.sh @@ -21,4 +21,4 @@ check_jar() { find . -name "*.jar" | while read jar; do check_jar "${jar}" -done \ No newline at end of file +done diff --git a/javascript/.eslintrc.json b/javascript/.eslintrc.json index f7c01ed2..09029597 100644 --- a/javascript/.eslintrc.json +++ b/javascript/.eslintrc.json @@ -44,4 +44,4 @@ } } ] -} \ No newline at end of file +} diff --git a/javascript/.prettierrc.json b/javascript/.prettierrc.json index 8e95b098..0e9e3a77 100644 --- a/javascript/.prettierrc.json +++ b/javascript/.prettierrc.json @@ -3,4 +3,4 @@ "semi": false, "singleQuote": true, "printWidth": 100 -} \ No newline at end of file +} diff --git a/javascript/package.cjs.json b/javascript/package.cjs.json index 7156107e..b731bd61 100644 --- a/javascript/package.cjs.json +++ b/javascript/package.cjs.json @@ -1 +1 @@ -{"type": "commonjs"} \ No newline at end of file +{"type": "commonjs"} diff --git a/javascript/tsconfig.build-cjs.json b/javascript/tsconfig.build-cjs.json index a643dd48..da76f4bb 100644 --- a/javascript/tsconfig.build-cjs.json +++ b/javascript/tsconfig.build-cjs.json @@ -5,4 +5,4 @@ "target": "ES5", "module": "CommonJS", }, -} \ No newline at end of file +} diff --git a/scripts/fail-if-dirty b/scripts/fail-if-dirty index cad7407e..e1c0845f 100755 --- a/scripts/fail-if-dirty +++ b/scripts/fail-if-dirty @@ -8,4 +8,3 @@ if [[ ! -z "${diff}" ]]; then >&2 echo "${diff}" exit 1 fi - diff --git a/testdata/JetBrainsSpace.txt b/testdata/JetBrainsSpace.txt index e50f531d..4e630694 100644 --- a/testdata/JetBrainsSpace.txt +++ b/testdata/JetBrainsSpace.txt @@ -4,4 +4,4 @@ JB_SPACE_API_URL=jetbrains.space JB_SPACE_PROJECT_KEY=ij JB_SPACE_GIT_REPOSITORY_NAME=intellij JB_SPACE_GIT_REVISION=057f8fe233b17629af084064c2a7b8d1dbb795ad -JB_SPACE_GIT_BRANCH=main \ No newline at end of file +JB_SPACE_GIT_BRANCH=main