Skip to content

Commit 2b93886

Browse files
committed
Migrate Code Climate to qlty
1 parent ccacb6f commit 2b93886

File tree

8 files changed

+136
-44
lines changed

8 files changed

+136
-44
lines changed

.codeclimate.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ on:
55
required: true
66
type: boolean
77

8+
# OIDC permissions for qlty
9+
permissions:
10+
contents: read
11+
id-token: write
12+
813
env:
914
MAIN_RUBY_VER: 3.1
1015
MAIN_OS: ubuntu
16+
1117
jobs:
1218
test:
1319
runs-on: ${{ matrix.os }}-latest
@@ -16,24 +22,27 @@ jobs:
1622
os: [ubuntu, macos, windows]
1723
ruby-version: [3.0, 3.1]
1824
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
submodules: true
22-
- name: Set up Ruby
23-
uses: ruby/setup-ruby@v1
24-
with:
25-
ruby-version: ${{ matrix.ruby-version }}
26-
bundler-cache: true
27-
- name: Run CI Build with Rake
28-
run: bundle exec rake ci
29-
- name: Publish Code Coverage
30-
uses: paambaati/[email protected]
31-
if: |
32-
inputs.code_coverage &&
33-
matrix.os == env.MAIN_OS &&
34-
matrix.ruby-version == env.MAIN_RUBY_VER &&
35-
github.event_name != 'pull_request'
36-
env:
37-
CC_TEST_REPORTER_ID: 031d4b3d619508ecf0f2d6ce8f2565d506d4cb24b6fa7ef913af274533021bee
38-
with:
39-
debug: false
25+
- uses: actions/checkout@v2
26+
with:
27+
submodules: true
28+
29+
- name: Set up Ruby
30+
uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: ${{ matrix.ruby-version }}
33+
bundler-cache: true
34+
35+
- name: Run CI Build with Rake
36+
run: bundle exec rake ci
37+
38+
- name: Publish Code Coverage
39+
- uses: qltysh/qlty-action/coverage@v2
40+
if: |
41+
inputs.code_coverage &&
42+
matrix.os == env.MAIN_OS &&
43+
matrix.ruby-version == env.MAIN_RUBY_VER &&
44+
github.event_name != 'pull_request'
45+
with:
46+
oidc: true
47+
format: simplecov
48+
files: 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/.shellcheckrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source-path=SCRIPTDIR

.qlty/qlty.toml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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/**",
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+
[[source]]
78+
name = "default"
79+
default = true
80+
81+
[[plugin]]
82+
name = "rubocop"
83+
version = "1.81.6"
84+
package_file = "Gemfile"
85+
package_filters = ["rubocop"]

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Migrated Code Climate to qlty.
810

911
## [4.5.0] - 2022-06-09
1012
### Added

Rakefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ task :parse_file do
6060
raise 'Provide path to file to parse in envionment variable F' unless ENV.key? 'F'
6161

6262
cur_dir = File.dirname(__FILE__)
63-
sh "#{cur_dir}/test/app.rb #{ENV['F']}"
63+
sh "#{cur_dir}/test/app.rb #{ENV.fetch('F', nil)}"
6464
end
6565

6666
desc 'Watch source files for changes and execute actions'
@@ -75,3 +75,10 @@ task :guard do
7575
sh 'bundle exec guard --clear'
7676
end
7777
task watch: :guard
78+
79+
desc 'Run Qlty code analysis'
80+
task :qlty do
81+
sh 'qlty smells --all'
82+
sh 'qlty metrics --all --max-depth=2 --sort complexity --limit 10'
83+
# sh "qlty lint" # Just runs rubocop, not necessary as we have a task for this already
84+
end

scripts/setup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ set -vx
55

66
gem install bundler -v 2.2.18
77
bundle install
8+
9+
# Qlty CLI tool. Ref: https://docs.qlty.sh/cli/quickstart
10+
curl https://qlty.sh | sh

0 commit comments

Comments
 (0)