Skip to content

Commit

Permalink
Merge pull request #233 from DigitalNZ/rm/codeclimate-diff
Browse files Browse the repository at this point in the history
Add code quality score
  • Loading branch information
richardmatthewsdev authored Feb 26, 2024
2 parents a44cdab + ac517b2 commit 2269a0d
Show file tree
Hide file tree
Showing 10 changed files with 492 additions and 95 deletions.
30 changes: 30 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
version: "2"
plugins:
rubocop:
enabled: true
channel: rubocop-1-36-0
reek:
enabled: true

exclude_patterns:
- config/
- db/
- dist/
- features/
- public/
- "**/node_modules/"
- script/
- "**/spec/"
- "**/test/"
- "**/tests/"
- Tests/
- "**/vendor/"
- "**/*_test.go"
- "**/*.d.ts"
- "**/*.min.js"
- "**/*.min.css"
- "**/__tests__/"
- "**/__mocks__/"
- "/.gitlab/"
- coverage/ . # simple cov
2 changes: 2 additions & 0 deletions .codeclimate_diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
main_branch_name: main # defaults to main
threshold_to_run_on_all_files: 8 # when you reach a certain number of files changed, it becomes faster to analyze all files rather than analyze them one by one.
9 changes: 9 additions & 0 deletions .github/workflows/code_quality_score.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Code quality score

on:
- pull_request

jobs:
code_quality_score:
name: Code quality
uses: DigitalNZ/code_quality_score/.github/workflows/calculate-code-quality-score.yml@main
46 changes: 46 additions & 0 deletions .reek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
detectors:
IrresponsibleModule:
enabled: false

NilCheck:
enabled: false

ManualDispatch:
enabled: false

LongParameterList:
max_params: 4 # defaults to 3. You want this number realistic but stretchy so we can move it down

TooManyStatements:
max_statements: 10 # defaults to 5. You want this number realistic but stretchy so we can move it down

UtilityFunction:
public_methods_only: true

UncommunicativeVariableName:
accept:
- e

directories:
"app/controllers":
IrresponsibleModule:
enabled: false
NestedIterators:
max_allowed_nesting: 2
UnusedPrivateMethod:
enabled: false
InstanceVariableAssumption:
enabled: false
"app/helpers":
IrresponsibleModule:
enabled: false
UtilityFunction:
enabled: false
FeatureEnvy:
enabled: false
"app/mailers":
InstanceVariableAssumption:
enabled: false
"app/models":
InstanceVariableAssumption:
enabled: false
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem 'puma'
gem 'puma-metrics'
gem 'rails', '~> 7.0.4'
gem 'responders'
gem 'sidekiq', '~> 6.4.0'
gem 'sidekiq', '6.5.10'
gem 'sinatra', require: nil
gem 'supplejack_common', github: 'DigitalNZ/supplejack_common', tag: 'v2.11.1'
gem 'whenever', require: false
Expand Down Expand Up @@ -50,4 +50,5 @@ group :test, :development do
gem 'rubocop', require: false
gem 'rubocop-rails_config', require: false
gem 'rubocop-rspec', require: false
gem 'codeclimate_diff', github: 'boost/codeclimate_diff'
end
Loading

0 comments on commit 2269a0d

Please sign in to comment.