Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/cops.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Metrics/ClassLength: 400_000
20 changes: 19 additions & 1 deletion lib/cc/engine/rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
module CC
module Engine
class Rubocop
DEFAULT_REMEDIATION_POINTS = 200_000

def initialize(code, engine_config, io)
@code = code
@engine_config = engine_config || {}
Expand Down Expand Up @@ -101,7 +103,7 @@ def violation_json(violation, local_path)
check_name: "Rubocop/#{violation.cop_name}",
description: violation.message,
categories: [category(violation.cop_name)],
remediation_points: 50_000,
remediation_points: remediation_points_for(violation.cop_name),
location: {
path: local_path,
positions: violation_positions(violation.location),
Expand All @@ -128,6 +130,22 @@ def cops
RuboCop::Cop::Cop.non_rails
end
end

def remediation_points_for(cop_name)
cop_list.fetch(cop_name, DEFAULT_REMEDIATION_POINTS)
end

def cop_list
return @cop_list if @cop_list

cops_path = File.expand_path(
File.join(File.dirname(__FILE__), "../../../config/cops.yml")
)

File.open(cops_path, "r") do |file|
@cop_list = YAML.load(file.read)
end
end
end
end
end