Skip to content

Commit 56f81e8

Browse files
authored
Merge pull request #434 from internetee/adding-qlty-tool
Replacing codeclimate
2 parents 516cc5c + af5d68a commit 56f81e8

File tree

5 files changed

+132
-57
lines changed

5 files changed

+132
-57
lines changed

.github/workflows/ruby.yml

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
2323
steps:
2424

25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v5
2626
- uses: ruby/setup-ruby@v1
2727
with:
2828
ruby-version: ${{ matrix.ruby }}
@@ -34,28 +34,7 @@ jobs:
3434
bundle env
3535
head -n1 $(which bundle)
3636
37-
- name: Set ENV for codeclimate (pull_request)
38-
run: |
39-
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF
40-
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
41-
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV
42-
if: github.event_name == 'pull_request'
43-
44-
- name: Set ENV for codeclimate (push)
45-
run: |
46-
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
47-
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
48-
if: github.event_name == 'push'
49-
50-
- name: Prepare CodeClimate
51-
env:
52-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
53-
run: |
54-
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
55-
chmod +x ./cc-test-reporter
56-
./cc-test-reporter before-build
57-
58-
- name: Run Tests
37+
- name: Run Tests & generate coverage
5938
env:
6039
PG_DATABASE: postgres
6140
PG_HOST: localhost
@@ -69,40 +48,17 @@ jobs:
6948
cp config/database-travis.yml config/database.yml
7049
bundle exec rake db:setup
7150
bundle exec rails test test/*
72-
- name: Save coverage
73-
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
74-
75-
- uses: actions/upload-artifact@v4.6.0
76-
with:
77-
name: coverage-${{ matrix.ruby }}
78-
path: coverage/codeclimate.${{ matrix.ruby }}.json
7951
80-
upload_coverage:
81-
strategy:
82-
fail-fast: false
83-
matrix:
84-
ruby: [ '3.0.3' ]
85-
runs-on: ubuntu-24.04
86-
87-
env:
88-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
89-
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
90-
91-
needs: test
92-
93-
steps:
94-
- name: Download test coverage reporter
95-
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter
96-
97-
- name: Give test coverage reporter executable permissions
98-
run: chmod +x cc-test-reporter
99-
100-
- uses: actions/download-artifact@v4.1.8
101-
with:
102-
name: coverage-${{ matrix.ruby }}
103-
path: coverage
52+
# ------------------------------
53+
# Qlty.sh integration
54+
# ------------------------------
55+
- name: Install qlty CLI
56+
run: |
57+
curl -LSs https://qlty.sh | bash
58+
echo "${HOME}/.qlty/bin" >> $GITHUB_PATH
10459
105-
- name: Aggregate & upload results to Code Climate
60+
- name: Upload coverage to Qlty
61+
env:
62+
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
10663
run: |
107-
./cc-test-reporter sum-coverage coverage/codeclimate.*.json -p 1
108-
./cc-test-reporter upload-coverage -r ${{ secrets.CC_TEST_REPORTER_ID }}
64+
qlty coverage publish --report-format=simplecov coverage/.resultset.json

.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: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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/**", "bin/", "config/", "db/", "vendor/", "test/",
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+
threshold = 22
79+
80+
[[source]]
81+
name = "default"
82+
default = true
83+
84+
[[plugin]]
85+
name = "rubocop"
86+
87+
[[plugin.fetch]]
88+
url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop-modern.yml"
89+
path = ".rubocop-modern.yml"

0 commit comments

Comments
 (0)