Skip to content

Commit c1a75b6

Browse files
authored
Merge pull request #33 from internetee/codeclimate-to-qlty
Replace codeclimate with qlty
2 parents db15b46 + dc4c881 commit c1a75b6

19 files changed

+374
-147
lines changed

.codeclimate.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
version: "2"
22
prepare:
33
fetch:
4-
- "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-ruby.yml"
5-
- url: "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-rails.yml"
6-
path: ".rubocop.yml"
4+
- url: "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-ruby-modern.yml"
5+
path: ".rubocop-ruby-modern.yml"
6+
- url: "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-rails-modern.yml"
7+
path: ".rubocop-modern.yml"
78
plugins:
89
brakeman:
910
enabled: false

.github/workflows/ruby.yml

Lines changed: 35 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525

2626
- name: Set up Ruby
2727
uses: ruby/setup-ruby@v1
@@ -32,31 +32,10 @@ jobs:
3232
- name: Config bundler
3333
run: |
3434
bundle config set without 'development staging production'
35-
bundle config set deployment '[secure]'
35+
bundle config set deployment 'true'
3636
bundle env
3737
head -n1 $(which bundle)
3838
39-
- name: Set ENV for codeclimate (pull_request)
40-
run: |
41-
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF
42-
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
43-
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV
44-
if: github.event_name == 'pull_request'
45-
46-
- name: Set ENV for codeclimate (push)
47-
run: |
48-
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
49-
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
50-
if: github.event_name == 'push'
51-
52-
- name: Prepare CodeClimate
53-
env:
54-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
55-
run: |
56-
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
57-
chmod +x ./cc-test-reporter
58-
./cc-test-reporter before-build
59-
6039
- name: Run Tests
6140
env:
6241
PG_DATABASE: postgres
@@ -67,58 +46,50 @@ jobs:
6746
RAILS_ENV: test
6847
COVERAGE: true
6948
DISABLE_SPRING: 1
70-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
7149
run: |
7250
cp config/application.yml.sample config/application.yml
7351
bundle exec rake db:setup
7452
bundle exec rails assets:precompile
7553
bundle exec rspec
7654
7755
- name: Upload Capybara screenshots
78-
if: failure()
56+
if: failure() && hashFiles('tmp/capybara/**') != ''
7957
uses: actions/upload-artifact@v4.6.2
8058
with:
8159
name: capybara-screenshots
8260
path: tmp/capybara
8361

84-
- name: Save coverage
85-
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
86-
87-
- uses: actions/upload-artifact@v4.6.2
88-
with:
89-
name: coverage-${{ matrix.ruby }}
90-
path: coverage/codeclimate.${{ matrix.ruby }}.json
91-
92-
upload_coverage:
93-
strategy:
94-
fail-fast: false
95-
matrix:
96-
os: [ ubuntu-24.04 ]
97-
ruby: [ '3.4.4' ]
98-
runs-on: ubuntu-24.04
99-
100-
env:
101-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
102-
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
103-
104-
needs: test
105-
106-
steps:
107-
- name: Download test coverage reporter
108-
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter
109-
110-
- name: Give test coverage reporter executable permissions
111-
run: chmod +x cc-test-reporter
112-
113-
- uses: actions/download-artifact@v4.3.0
114-
with:
115-
name: coverage-${{ matrix.ruby }}
116-
path: coverage
62+
- name: Install qlty CLI
63+
run: |
64+
curl -LSs https://qlty.sh | bash
65+
echo "${HOME}/.qlty/bin" >> $GITHUB_PATH
11766
118-
- name: Aggregate & upload results to Code Climate
67+
- name: Upload coverage to Qlty
68+
env:
69+
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
11970
run: |
120-
./cc-test-reporter sum-coverage coverage/codeclimate.*.json
121-
./cc-test-reporter upload-coverage
71+
if [ -d "coverage" ]; then
72+
echo "Coverage directory found:"
73+
ls -la coverage/
74+
if [ -f "coverage/lcov.info" ]; then
75+
echo "Found LCOV info file, uploading to qlty..."
76+
qlty coverage publish --format=lcov coverage/lcov.info
77+
elif [ -d "coverage/lcov" ]; then
78+
echo "Found LCOV directory, combining files..."
79+
cat coverage/lcov/*.lcov > coverage/coverage.lcov
80+
qlty coverage publish --format=lcov coverage/coverage.lcov
81+
elif [ -f "coverage/coverage.lcov" ]; then
82+
qlty coverage publish --format=lcov coverage/coverage.lcov
83+
else
84+
echo "No LCOV coverage file found. Available files:"
85+
find coverage/ -type f -name "*.lcov" -o -name "*.info" -o -name "*.json" -o -name "*.xml"
86+
echo "Please check what coverage format your test runner generates"
87+
exit 1
88+
fi
89+
else
90+
echo "No coverage directory found. Skipping coverage upload."
91+
echo "This is normal if coverage is not configured or tests failed."
92+
fi
12293
12394
security_scan:
12495
runs-on: ubuntu-24.04
@@ -127,7 +98,7 @@ jobs:
12798
matrix:
12899
ruby: ['3.4.4']
129100
steps:
130-
- uses: actions/checkout@v4
101+
- uses: actions/checkout@v5
131102
- name: Set up Ruby
132103
uses: ruby/setup-ruby@v1
133104
with:
@@ -136,7 +107,7 @@ jobs:
136107
- name: Config bundler
137108
run: |
138109
bundle config set without 'development staging production'
139-
bundle config set deployment '[secure]'
110+
bundle config set deployment 'true'
140111
bundle env
141112
head -n1 $(which bundle)
142113
- name: Scan for security vulnerabilities
@@ -145,3 +116,4 @@ jobs:
145116
bin/importmap audit
146117
bundle exec bundler-audit --update
147118
bin/brakeman --no-pager
119+
continue-on-error: true

.qlty/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*
2+
!configs
3+
!configs/**
4+
!hooks
5+
!hooks/**
6+
!qlty.toml
7+
!.gitignore

.qlty/configs/.hadolint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignored:
2+
- DL3008

.qlty/configs/.yamllint.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extends: default
2+
3+
rules:
4+
document-start: disable
5+
quoted-strings:
6+
required: only-when-needed
7+
extra-allowed: ["{|}"]
8+
key-duplicates: {}
9+
octal-values:
10+
forbid-implicit-octal: true
11+
line-length: disable
12+
indentation: disable
13+
new-line-at-end-of-file: disable
14+
trailing-spaces: disable
15+
brackets: disable
16+
colons: disable
17+
empty-lines: disable
18+
comments: disable
19+
braces: disable
20+
comments-indentation: disable
21+
commas: disable

.qlty/qlty.toml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# This file was automatically generated by `qlty init`.
2+
# You can modify it to suit your needs.
3+
# We recommend you to commit this file to your repository.
4+
#
5+
# This configuration is used by both Qlty CLI and Qlty Cloud.
6+
#
7+
# Qlty CLI -- Code quality toolkit for developers
8+
# Qlty Cloud -- Fully automated Code Health Platform
9+
#
10+
# Try Qlty Cloud: https://qlty.sh
11+
#
12+
# For a guide to configuration, visit https://qlty.sh/d/config
13+
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
14+
config_version = "0"
15+
16+
exclude_patterns = [
17+
"*_min.*",
18+
"*-min.*",
19+
"*.min.*",
20+
"**/.yarn/**",
21+
"**/*.d.ts",
22+
"**/assets/**",
23+
"**/bower_components/**",
24+
"**/build/**",
25+
"**/cache/**",
26+
"**/config/**",
27+
"**/db/**",
28+
"**/deps/**",
29+
"**/dist/**",
30+
"**/extern/**",
31+
"**/external/**",
32+
"**/generated/**",
33+
"**/Godeps/**",
34+
"**/gradlew/**",
35+
"**/mvnw/**",
36+
"**/node_modules/**",
37+
"**/protos/**",
38+
"**/seed/**",
39+
"**/target/**",
40+
"**/templates/**",
41+
"**/testdata/**",
42+
"**/vendor/**", "app/models/", "app/javascript", "bin/", "config/", "db/", "test/", "spec/", "vendor/", "CHANGELOG.md",
43+
]
44+
45+
test_patterns = [
46+
"**/test/**",
47+
"**/spec/**",
48+
"**/*.test.*",
49+
"**/*.spec.*",
50+
"**/*_test.*",
51+
"**/*_spec.*",
52+
"**/test_*.*",
53+
"**/spec_*.*",
54+
]
55+
56+
[smells]
57+
mode = "comment"
58+
59+
[smells.boolean_logic]
60+
threshold = 4
61+
62+
[smells.file_complexity]
63+
threshold = 55
64+
65+
[smells.return_statements]
66+
threshold = 4
67+
68+
[smells.nested_control_flow]
69+
threshold = 4
70+
71+
[smells.function_parameters]
72+
threshold = 4
73+
74+
[smells.function_complexity]
75+
threshold = 5
76+
77+
[smells.duplication]
78+
enabled = true
79+
threshold = 20
80+
81+
[[source]]
82+
name = "default"
83+
default = true
84+
85+
[[plugin]]
86+
name = "rubocop"
87+
drivers = [
88+
"lint",
89+
]
90+
91+
[[plugin.fetch]]
92+
url = "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-ruby-modern.yml"
93+
path = ".rubocop-ruby-modern.yml"
94+
95+
[[plugin.fetch]]
96+
url = "https://raw.githubusercontent.com/internetee/style-guide/master/.rubocop-rails-modern.yml"
97+
path = ".rubocop-modern.yml"

Gemfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source "https://rubygems.org"
22

33
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4-
gem "rails", "~> 8.0.2"
4+
gem "rails", "~> 8.0.2.1"
55
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
66
gem "propshaft"
77
# Use postgresql as the database for Active Record
@@ -70,6 +70,10 @@ group :test do
7070
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
7171
gem "capybara"
7272
gem "selenium-webdriver"
73+
74+
# Code coverage
75+
gem "simplecov", require: false
76+
gem "simplecov-lcov", require: false
7377
end
7478

7579
gem "dartsass-rails", "~> 0.5.1"
@@ -85,3 +89,7 @@ gem 'ransack'
8589
gem 'positioning'
8690

8791
gem 'friendly_id', '~> 5.4.0'
92+
93+
# Security updates
94+
gem 'nokogiri', '>= 1.18.9'
95+
gem 'thor', '>= 1.4.0'

0 commit comments

Comments
 (0)