codeclimate-engine-rb 0.3.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/README.md +4 -0
- data/codeclimate_engine.gemspec +2 -2
- data/lib/cc_engine/config.rb +1 -1
- data/lib/cc_engine/issue.rb +38 -11
- data/lib/cc_engine/location/line_range.rb +8 -6
- data/lib/cc_engine/location/position.rb +9 -7
- data/lib/cc_engine/position/grid.rb +6 -6
- data/lib/cc_engine/position/offset.rb +7 -5
- data/lib/cc_engine/version.rb +1 -1
- metadata +17 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 96bfcb4a51e27a6ecd8ae91d51a199ee12a0fc2150f241fba3adaecc2533bf2d
|
4
|
+
data.tar.gz: 953e685ef59776ad00b8caefe1902a4cd8f6c77d919d02d8ba513edad16cbbdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4d1a6cbaa5b8dce90e17386bf701bb78d6174057e3d58ea1cebc60e03805683c5c63e8ce04dfbb8ed0e99e735341dcadd353bd49bbb2362c081de3f6d3293cb
|
7
|
+
data.tar.gz: a84b3c0821b6ee29417106c847bbac103b635df98b75858377e578d8999eca66d6af1066192c415f220262375138279fa96d72fe4afb543e35c7f15b3e6cb8e9
|
data/.rspec
CHANGED
data/README.md
CHANGED
@@ -61,6 +61,10 @@ Code Climate requires that each issue is terminated with a null character.
|
|
61
61
|
Calling `render` on an issue will output the issue's JSON, followed by a null
|
62
62
|
character.
|
63
63
|
|
64
|
+
## Code Climate engines using this gem
|
65
|
+
|
66
|
+
* [Reek](https://docs.codeclimate.com/docs/reek)
|
67
|
+
|
64
68
|
## Development
|
65
69
|
|
66
70
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/codeclimate_engine.gemspec
CHANGED
@@ -12,15 +12,15 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.summary = "JSON issue formatter for the Code Climate engine"
|
14
14
|
spec.homepage = "https://github.com/andyw8/codeclimate-engine-rb"
|
15
|
+
spec.licenses = ["MIT"]
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
17
18
|
spec.bindir = "exe"
|
18
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
20
|
spec.require_paths = ["lib"]
|
20
21
|
|
21
|
-
spec.add_development_dependency "bundler", "
|
22
|
+
spec.add_development_dependency "bundler", ">= 1.9", "< 3.0"
|
22
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
24
|
spec.add_development_dependency "rspec", "~> 3.3"
|
24
|
-
spec.add_dependency "virtus", "~> 1.0"
|
25
25
|
end
|
26
26
|
# rubocop:enable Metrics/LineLength
|
data/lib/cc_engine/config.rb
CHANGED
data/lib/cc_engine/issue.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
require "virtus"
|
2
1
|
require "json"
|
3
2
|
|
4
3
|
module CCEngine
|
5
4
|
class Issue
|
6
|
-
include Virtus.model(strict: true)
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
def initialize(
|
7
|
+
check_name:,
|
8
|
+
description:,
|
9
|
+
categories:,
|
10
|
+
location:,
|
11
|
+
remediation_points:,
|
12
|
+
content:,
|
13
|
+
fingerprint:
|
14
|
+
)
|
15
|
+
@check_name = check_name
|
16
|
+
@description = description
|
17
|
+
@categories = categories
|
18
|
+
@location = location
|
19
|
+
@remediation_points = remediation_points
|
20
|
+
@content = content
|
21
|
+
@fingerprint = fingerprint
|
22
|
+
end
|
14
23
|
|
15
24
|
def render
|
16
25
|
to_hash.to_json + "\0"
|
@@ -27,7 +36,7 @@ module CCEngine
|
|
27
36
|
description: description,
|
28
37
|
categories: categories,
|
29
38
|
location: location.to_hash
|
30
|
-
}.merge(remediation_points_hash).merge(content_hash)
|
39
|
+
}.merge(remediation_points_hash).merge(content_hash).merge(fingerprint_hash)
|
31
40
|
end
|
32
41
|
|
33
42
|
private
|
@@ -44,10 +53,28 @@ module CCEngine
|
|
44
53
|
return {} unless content
|
45
54
|
|
46
55
|
{
|
47
|
-
|
48
|
-
|
56
|
+
content: {
|
57
|
+
body: content
|
49
58
|
}
|
50
59
|
}
|
51
60
|
end
|
61
|
+
|
62
|
+
def fingerprint_hash
|
63
|
+
return {} unless fingerprint
|
64
|
+
|
65
|
+
{
|
66
|
+
fingerprint: fingerprint
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
attr_reader :check_name,
|
73
|
+
:description,
|
74
|
+
:categories,
|
75
|
+
:location,
|
76
|
+
:remediation_points,
|
77
|
+
:content,
|
78
|
+
:fingerprint
|
52
79
|
end
|
53
80
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require "virtus"
|
2
|
-
|
3
1
|
module CCEngine
|
4
2
|
module Location
|
5
3
|
class LineRange
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
def initialize(path:, line_range:)
|
5
|
+
@path = path
|
6
|
+
@line_range = line_range
|
7
|
+
end
|
10
8
|
|
11
9
|
def to_hash
|
12
10
|
{
|
@@ -17,6 +15,10 @@ module CCEngine
|
|
17
15
|
}
|
18
16
|
}
|
19
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :path, :line_range
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
require "virtus"
|
2
|
-
|
3
1
|
module CCEngine
|
4
2
|
module Location
|
5
3
|
class Position
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
def initialize(path:, start_position:, end_position:)
|
5
|
+
@path = path
|
6
|
+
@start_position = start_position
|
7
|
+
@end_position = end_position
|
8
|
+
end
|
11
9
|
|
12
10
|
def to_hash
|
13
11
|
{
|
@@ -18,6 +16,10 @@ module CCEngine
|
|
18
16
|
}
|
19
17
|
}
|
20
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :path, :start_position, :end_position
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require "virtus"
|
2
|
-
|
3
1
|
module CCEngine
|
4
2
|
module Position
|
5
3
|
class Grid
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
def initialize(line:, column:)
|
5
|
+
@line = line
|
6
|
+
@column = column
|
7
|
+
end
|
10
8
|
|
11
9
|
def to_hash
|
12
10
|
{
|
@@ -14,6 +12,8 @@ module CCEngine
|
|
14
12
|
column: column
|
15
13
|
}
|
16
14
|
end
|
15
|
+
|
16
|
+
attr_reader :line, :column
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,17 +1,19 @@
|
|
1
|
-
require "virtus"
|
2
|
-
|
3
1
|
module CCEngine
|
4
2
|
module Position
|
5
3
|
class Offset
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
def initialize(offset:)
|
5
|
+
@offset = offset
|
6
|
+
end
|
9
7
|
|
10
8
|
def to_hash
|
11
9
|
{
|
12
10
|
offset: offset
|
13
11
|
}
|
14
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :offset
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/cc_engine/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-engine-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Waite
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.9'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.9'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,21 +58,7 @@ dependencies:
|
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '3.3'
|
55
|
-
|
56
|
-
name: virtus
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
|
-
description:
|
61
|
+
description:
|
70
62
|
email:
|
71
63
|
- github.aw@andywaite.com
|
72
64
|
executables: []
|
@@ -95,9 +87,10 @@ files:
|
|
95
87
|
- lib/cc_engine/version.rb
|
96
88
|
- lib/codeclimate_engine.rb
|
97
89
|
homepage: https://github.com/andyw8/codeclimate-engine-rb
|
98
|
-
licenses:
|
90
|
+
licenses:
|
91
|
+
- MIT
|
99
92
|
metadata: {}
|
100
|
-
post_install_message:
|
93
|
+
post_install_message:
|
101
94
|
rdoc_options: []
|
102
95
|
require_paths:
|
103
96
|
- lib
|
@@ -112,10 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
105
|
- !ruby/object:Gem::Version
|
113
106
|
version: '0'
|
114
107
|
requirements: []
|
115
|
-
|
116
|
-
|
117
|
-
signing_key:
|
108
|
+
rubygems_version: 3.1.6
|
109
|
+
signing_key:
|
118
110
|
specification_version: 4
|
119
111
|
summary: JSON issue formatter for the Code Climate engine
|
120
112
|
test_files: []
|
121
|
-
has_rdoc:
|