From 231781f3e4f3df00ada89a388dad5ed461b5b4e6 Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 15:13:13 +0300 Subject: [PATCH 1/6] migrate from codeclimate to qlty --- .github/workflows/ruby.yml | 155 +++++++++++++++++------------------ .qlty/.gitignore | 7 ++ .qlty/configs/.yamllint.yaml | 21 +++++ .qlty/qlty.toml | 89 ++++++++++++++++++++ 4 files changed, 194 insertions(+), 78 deletions(-) create mode 100644 .qlty/.gitignore create mode 100644 .qlty/configs/.yamllint.yaml create mode 100644 .qlty/qlty.toml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index fa6a47f..49eb21f 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,101 +1,100 @@ name: Github Testing on: [push] +permissions: + contents: read + id-token: write jobs: + bundle_audit: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2.2 + bundler-cache: true + - name: config bundler + run: | + bundle config set without 'development staging production' + bundle config set deployment 'true' + bundle env + head -n1 $(which bundle) + - name: Install bundle-audit + run: gem install bundle-audit + - name: Bundle Audit Check + run: gem exec bundle-audit check --update + test: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] - ruby: [ 2.7 ] + os: [ubuntu-24.04] + ruby: ['3.2.2'] runs-on: ${{ matrix.os }} - continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} - steps: + env: + RAILS_ENV: test + COVERAGE: true + DISABLE_SPRING: 1 - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: config bundler - run: | - bundle config set without 'development staging production' - bundle config set deployment '[secure]' - bundle env - head -n1 $(which bundle) + steps: + - uses: actions/checkout@v4 - - name: Set ENV for codeclimate (pull_request) - run: | - git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF - echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV - echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV - if: github.event_name == 'pull_request' + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true - - name: Set ENV for codeclimate (push) - run: | - echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV - echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV - if: github.event_name == 'push' + - name: config bundler + run: | + bundle config set without 'development staging production' + bundle config set deployment 'true' + bundle env + head -n1 $(which bundle) - - name: Prepare CodeClimate - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - run: | - curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter; - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build + - name: Install dependencies + run: | + gem install bundler -v '>= 2.2.10' + gem install builder + gem install nokogiri -v '~> 1.11.3' + gem install savon + gem install webmock + gem install mocha + gem install minitest -v '~> 5.14' + gem install simplecov -v '<= 0.17.1' + bundle install - - name: Run Tests - env: - RAILS_ENV: test - COVERAGE: true - DISABLE_SPRING: 1 - run: | - gem install bundler -v '>= 2.2.10' - gem install simplecov -v '<= 0.17.1' - gem install builder - gem install nokogiri -v '~> 1.11.3' - gem install savon - gem install webmock - gem install mocha - gem install minitest -v '~> 5.14' - bundle install - rake - - name: Save coverage - run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json + - name: Run Tests + run: rake - - uses: actions/upload-artifact@v3.1.3 - with: - name: coverage-${{ matrix.ruby }} - path: coverage/codeclimate.${{ matrix.ruby }}.json + - name: Setup qlty.sh + run: | + curl -sSL https://qlty.sh/install.sh | bash + export PATH="$HOME/.qlty/bin:$PATH" + qlty --version - upload_coverage: - strategy: - matrix: - os: [ ubuntu-20.04 ] - ruby: [ '2.7' ] - runs-on: ubuntu-20.04 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 + - name: Initialize qlty.sh + run: | + export PATH="$HOME/.qlty/bin:$PATH" + qlty init --no - needs: test + - name: Run qlty.sh analysis + run: | + export PATH="$HOME/.qlty/bin:$PATH" + qlty check - steps: - - name: Download test coverage reporter - run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter + - name: Upload coverage to qlty.sh + uses: qltysh/qlty-action/coverage@v1 + with: + oidc: true + files: coverage/.resultset.json - - name: Give test coverage reporter executable permissions - run: chmod +x cc-test-reporter + - uses: actions/upload-artifact@v4 + with: + name: qlty-report-${{ matrix.ruby }} + path: qlty-report.json - - uses: actions/download-artifact@v3.0.2 + - uses: actions/upload-artifact@v4 with: name: coverage-${{ matrix.ruby }} - path: coverage - - - name: Aggregate & upload results to Code Climate - run: | - ./cc-test-reporter sum-coverage coverage/codeclimate.*.json - ./cc-test-reporter upload-coverage - + path: coverage/ diff --git a/.qlty/.gitignore b/.qlty/.gitignore new file mode 100644 index 0000000..3036618 --- /dev/null +++ b/.qlty/.gitignore @@ -0,0 +1,7 @@ +* +!configs +!configs/** +!hooks +!hooks/** +!qlty.toml +!.gitignore diff --git a/.qlty/configs/.yamllint.yaml b/.qlty/configs/.yamllint.yaml new file mode 100644 index 0000000..7440066 --- /dev/null +++ b/.qlty/configs/.yamllint.yaml @@ -0,0 +1,21 @@ +extends: default + +rules: + document-start: disable + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + key-duplicates: {} + octal-values: + forbid-implicit-octal: true + line-length: disable + indentation: disable + new-line-at-end-of-file: disable + trailing-spaces: disable + brackets: disable + colons: disable + empty-lines: disable + comments: disable + braces: disable + comments-indentation: disable + commas: disable diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml new file mode 100644 index 0000000..16c309e --- /dev/null +++ b/.qlty/qlty.toml @@ -0,0 +1,89 @@ +# This file was automatically generated by `qlty init`. +# You can modify it to suit your needs. +# We recommend you to commit this file to your repository. +# +# This configuration is used by both Qlty CLI and Qlty Cloud. +# +# Qlty CLI -- Code quality toolkit for developers +# Qlty Cloud -- Fully automated Code Health Platform +# +# Try Qlty Cloud: https://qlty.sh +# +# For a guide to configuration, visit https://qlty.sh/d/config +# Or for a full reference, visit https://qlty.sh/d/qlty-toml +config_version = "0" + +exclude_patterns = [ + "*_min.*", + "*-min.*", + "*.min.*", + "**/.yarn/**", + "**/*.d.ts", + "**/assets/**", + "**/bower_components/**", + "**/build/**", + "**/cache/**", + "**/config/**", + "**/db/**", + "**/deps/**", + "**/dist/**", + "**/extern/**", + "**/external/**", + "**/generated/**", + "**/Godeps/**", + "**/gradlew/**", + "**/mvnw/**", + "**/node_modules/**", + "**/protos/**", + "**/seed/**", + "**/target/**", + "**/templates/**", + "**/testdata/**", + "**/vendor/**", "bin/", "test/", +] + +test_patterns = [ + "**/test/**", + "**/spec/**", + "**/*.test.*", + "**/*.spec.*", + "**/*_test.*", + "**/*_spec.*", + "**/test_*.*", + "**/spec_*.*", +] + +[smells] +mode = "comment" + +[smells.boolean_logic] +threshold = 4 + +[smells.file_complexity] +threshold = 55 + +[smells.return_statements] +threshold = 4 + +[smells.nested_control_flow] +threshold = 4 + +[smells.function_parameters] +threshold = 4 + +[smells.function_complexity] +threshold = 5 + +[smells.duplication] +threshold = 22 + +[[source]] +name = "default" +default = true + +[[plugin]] +name = "rubocop" + +[[plugin.fetch]] +url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop-modern.yml" +path = ".rubocop.yml" From 7393cf589edee49881448507da1db558ad305ae0 Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 15:23:28 +0300 Subject: [PATCH 2/6] removed .codeclimate.yml --- .codeclimate.yml | 16 ---------------- .github/workflows/ruby.yml | 1 - 2 files changed, 17 deletions(-) delete mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 79485cd..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "2" -prepare: - fetch: - - "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml" -plugins: - duplication: - enabled: true - config: - languages: - - ruby - rubocop: - enabled: true - channel: rubocop-0-58 -exclude_patterns: - - "bin/" - - "test/" \ No newline at end of file diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 49eb21f..c628a84 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -61,7 +61,6 @@ jobs: gem install webmock gem install mocha gem install minitest -v '~> 5.14' - gem install simplecov -v '<= 0.17.1' bundle install - name: Run Tests From 0462b5ae120e57a71fc612cb380d39d167682d90 Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 15:31:13 +0300 Subject: [PATCH 3/6] update actions/checkout to 5 --- .github/workflows/ruby.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c628a84..22e6090 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -16,8 +16,7 @@ jobs: bundler-cache: true - name: config bundler run: | - bundle config set without 'development staging production' - bundle config set deployment 'true' + bundle config set deployment 'false' bundle env head -n1 $(which bundle) - name: Install bundle-audit @@ -47,20 +46,12 @@ jobs: - name: config bundler run: | - bundle config set without 'development staging production' - bundle config set deployment 'true' + bundle config set deployment 'false' bundle env head -n1 $(which bundle) - name: Install dependencies run: | - gem install bundler -v '>= 2.2.10' - gem install builder - gem install nokogiri -v '~> 1.11.3' - gem install savon - gem install webmock - gem install mocha - gem install minitest -v '~> 5.14' bundle install - name: Run Tests From e1c45377e1dac5c5e712c42fa6c8b926a5ca2bf7 Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 15:34:34 +0300 Subject: [PATCH 4/6] updated install on workflow --- .github/workflows/ruby.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 22e6090..1574fc9 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,16 +9,18 @@ jobs: bundle_audit: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: ruby/setup-ruby@v1 with: ruby-version: 3.2.2 - bundler-cache: true - name: config bundler run: | bundle config set deployment 'false' bundle env head -n1 $(which bundle) + - name: Install dependencies + run: | + bundle install --jobs 4 --retry 3 - name: Install bundle-audit run: gem install bundle-audit - name: Bundle Audit Check @@ -37,12 +39,11 @@ jobs: DISABLE_SPRING: 1 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true - name: config bundler run: | @@ -52,7 +53,7 @@ jobs: - name: Install dependencies run: | - bundle install + bundle install --jobs 4 --retry 3 - name: Run Tests run: rake From 86587d6b402ed41ee5c55eb8345b9a73f8855fc5 Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 14 Aug 2025 15:33:57 +0300 Subject: [PATCH 5/6] rubocop-modern --- .qlty/qlty.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml index 16c309e..80084ce 100644 --- a/.qlty/qlty.toml +++ b/.qlty/qlty.toml @@ -86,4 +86,4 @@ name = "rubocop" [[plugin.fetch]] url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop-modern.yml" -path = ".rubocop.yml" +path = ".rubocop-modern.yml" From 51e4a6b31b5eddc9e771773b853e886f06c0bd3e Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 14 Aug 2025 16:49:01 +0300 Subject: [PATCH 6/6] coverage v 2 --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1574fc9..0962b3f 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -75,7 +75,7 @@ jobs: qlty check - name: Upload coverage to qlty.sh - uses: qltysh/qlty-action/coverage@v1 + uses: qltysh/qlty-action/coverage@v2 with: oidc: true files: coverage/.resultset.json