File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 3
3
require_relative "codeclimate_diff/version"
4
4
5
5
module CodeclimateDiff
6
-
7
6
end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "colorize"
5
+
6
+ module CodeclimateDiff
7
+ class CodeclimateWrapper
8
+ def run_codeclimate ( filename = "" )
9
+ `codeclimate analyze -f json #{ filename } `
10
+ end
11
+ end
12
+ end
Original file line number Diff line number Diff line change @@ -4,11 +4,10 @@ module CodeclimateDiff
4
4
class Configuration
5
5
attr_accessor :main_branch_name
6
6
7
- #using_gitlab: true
7
+ # using_gitlab: true
8
8
9
9
# gitlab host
10
10
11
11
# project id
12
-
13
12
end
14
13
end
Original file line number Diff line number Diff line change 2
2
3
3
require "json"
4
4
require "colorize"
5
+ require_relative "./codeclimate_wrapper"
5
6
6
7
module CodeclimateDiff
7
8
class Runner
8
9
def self . generate_baseline
9
10
puts "Generating the baseline. Should take about 5 minutes..."
10
- `codeclimate analyze -f json > codeclimate_diff_baseline.json`
11
+ result = CodeclimateWrapper . new . run_codeclimate
12
+ File . write ( "codeclimate_diff_baseline.json" , result )
11
13
puts "Done!"
12
14
end
13
15
@@ -24,7 +26,7 @@ def self.calculate_issues_in_changed_files(changed_filenames)
24
26
next if filename == "codeclimate_diff.rb" # TODO: fix this file's code quality issues when we make a Gem!
25
27
26
28
puts "Analysing '#{ filename } '..."
27
- result = `codeclimate analyze -f json #{ filename } `
29
+ result = CodeclimateWrapper . new . run_codeclimate ( filename )
28
30
JSON . parse ( result ) . each do |issue |
29
31
next if issue [ "type" ] != "issue"
30
32
You can’t perform that action at this time.
0 commit comments