danger-go 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/.rubocop.yml +22 -0
- data/.travis.yml +21 -0
- data/.yardoc/checksums +4 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +45 -44
- data/README.md +2 -1
- data/docs/images/gopher.png +0 -0
- data/lib/golint/gem_version.rb +1 -1
- data/lib/golint/plugin.rb +11 -12
- data/spec/golint_spec.rb +14 -13
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5dad39736be1112c44189d56b278b5cd7557107
|
|
4
|
+
data.tar.gz: 5c7dcac83c5884358e7e3a52d41b4620dafbe455
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2bec86796c5c8abe415b7bfdf424b18269a1da6424c999d88bd7942f0c5dda0cd149e364bb3ca154d091ef3659d0fcf29394f985e9f65225a8864a8c5f8d55b4
|
|
7
|
+
data.tar.gz: 496e672811e22ab4ac20efe8193fa4b095381c604e72fa8eb10ab302e33e864226d895c2551953a53c10e5c4805d6b1c934cee3859631f262ada22ab9a56a8b5
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- 'bin/**/*'
|
|
4
|
+
- 'db/**/*'
|
|
5
|
+
- 'log/**/*'
|
|
6
|
+
- 'tmp/**/*'
|
|
7
|
+
- 'vendor/**/*'
|
|
8
|
+
- 'Guardfile'
|
|
9
|
+
DisplayCopNames: true
|
|
10
|
+
|
|
11
|
+
Metrics/LineLength:
|
|
12
|
+
Max: 120
|
|
13
|
+
|
|
14
|
+
SpaceAroundEqualsInParameterDefault:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
Metrics/BlockLength:
|
|
18
|
+
Exclude:
|
|
19
|
+
- 'Rakefile'
|
|
20
|
+
- '**/*.rake'
|
|
21
|
+
- 'spec/**/*.rb'
|
|
22
|
+
- 'test/**/*.rb'
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
|
|
3
|
+
rvm:
|
|
4
|
+
- 2.6.0
|
|
5
|
+
- 2.5.3
|
|
6
|
+
- 2.4.5
|
|
7
|
+
- 2.3.8
|
|
8
|
+
|
|
9
|
+
bundler_args: "--without documentation --path bundle"
|
|
10
|
+
|
|
11
|
+
install:
|
|
12
|
+
- gem install bundler -v '2.0.1'
|
|
13
|
+
- bundle install
|
|
14
|
+
|
|
15
|
+
after_install:
|
|
16
|
+
- rake install
|
|
17
|
+
|
|
18
|
+
script:
|
|
19
|
+
- bundle exec rake spec
|
|
20
|
+
|
|
21
|
+
sudo: required
|
data/.yardoc/checksums
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/Users/user/Desktop/danger-go/lib/danger_golint.rb e829c86e3321bf181656d19e46f386ca1fa9d2e6
|
|
2
|
+
/Users/user/Desktop/danger-go/lib/danger_plugin.rb 91e59d5cc142d21c5e68e0be029e0879a93bb5f4
|
|
3
|
+
/Users/user/Desktop/danger-go/lib/golint/gem_version.rb 3dc8e67f262afb3c0aebb0505e03057dc38e42e7
|
|
4
|
+
/Users/user/Desktop/danger-go/lib/golint/plugin.rb 767849f952b5462367f867d11dd3fcaed5ff95e3
|
data/.yardoc/complete
ADDED
|
File without changes
|
|
Binary file
|
|
Binary file
|
data/.yardoc/proxy_types
ADDED
|
Binary file
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
# Specify your gem's dependencies in danger-golint.gemspec
|
|
4
|
+
source "https://rubygems.org"
|
|
5
|
+
|
|
4
6
|
gemspec
|
|
7
|
+
|
|
8
|
+
gem "bundler"
|
|
9
|
+
gem "rake", "~> 10.0"
|
|
10
|
+
gem "guard", "~> 2.14"
|
|
11
|
+
gem "guard-rspec", "~> 4.7"
|
|
12
|
+
gem "listen", "3.0.7"
|
|
13
|
+
gem "pry", "~> 0.10"
|
|
14
|
+
gem "rspec", "~> 3.4"
|
|
15
|
+
gem "rubocop", "~> 0.49.0"
|
|
16
|
+
gem "yard", "~> 0.9.11"
|
data/Gemfile.lock
CHANGED
|
@@ -9,42 +9,43 @@ GEM
|
|
|
9
9
|
specs:
|
|
10
10
|
addressable (2.5.2)
|
|
11
11
|
public_suffix (>= 2.0.2, < 4.0)
|
|
12
|
-
ast (2.
|
|
12
|
+
ast (2.4.0)
|
|
13
13
|
claide (1.0.2)
|
|
14
14
|
claide-plugins (0.9.2)
|
|
15
15
|
cork
|
|
16
16
|
nap
|
|
17
17
|
open4 (~> 1.3)
|
|
18
|
-
coderay (1.1.
|
|
18
|
+
coderay (1.1.2)
|
|
19
19
|
colored2 (3.1.2)
|
|
20
20
|
cork (0.3.0)
|
|
21
21
|
colored2 (~> 3.1)
|
|
22
|
-
danger (
|
|
22
|
+
danger (6.0.4)
|
|
23
23
|
claide (~> 1.0)
|
|
24
24
|
claide-plugins (>= 0.9.2)
|
|
25
25
|
colored2 (~> 3.1)
|
|
26
26
|
cork (~> 0.1)
|
|
27
27
|
faraday (~> 0.9)
|
|
28
28
|
faraday-http-cache (~> 1.0)
|
|
29
|
-
git (~> 1)
|
|
30
|
-
kramdown (~>
|
|
29
|
+
git (~> 1.5)
|
|
30
|
+
kramdown (~> 2.0)
|
|
31
|
+
kramdown-parser-gfm (~> 1.0)
|
|
31
32
|
no_proxy_fix
|
|
32
33
|
octokit (~> 4.7)
|
|
33
34
|
terminal-table (~> 1)
|
|
34
35
|
danger-plugin-api (1.0.0)
|
|
35
36
|
danger (> 2.0)
|
|
36
|
-
diff-lcs (1.
|
|
37
|
-
faraday (0.
|
|
37
|
+
diff-lcs (1.3)
|
|
38
|
+
faraday (0.15.4)
|
|
38
39
|
multipart-post (>= 1.2, < 3)
|
|
39
40
|
faraday-http-cache (1.3.1)
|
|
40
41
|
faraday (~> 0.8)
|
|
41
|
-
ffi (
|
|
42
|
+
ffi (1.10.0)
|
|
42
43
|
formatador (0.2.5)
|
|
43
|
-
git (1.
|
|
44
|
-
guard (2.
|
|
44
|
+
git (1.5.0)
|
|
45
|
+
guard (2.15.0)
|
|
45
46
|
formatador (>= 0.2.4)
|
|
46
47
|
listen (>= 2.7, < 4.0)
|
|
47
|
-
lumberjack (
|
|
48
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
48
49
|
nenv (~> 0.1)
|
|
49
50
|
notiffany (~> 0.0)
|
|
50
51
|
pry (>= 0.9.12)
|
|
@@ -55,12 +56,14 @@ GEM
|
|
|
55
56
|
guard (~> 2.1)
|
|
56
57
|
guard-compat (~> 1.1)
|
|
57
58
|
rspec (>= 2.99.0, < 4.0)
|
|
58
|
-
kramdown (1.
|
|
59
|
+
kramdown (2.1.0)
|
|
60
|
+
kramdown-parser-gfm (1.0.1)
|
|
61
|
+
kramdown (~> 2.0)
|
|
59
62
|
listen (3.0.7)
|
|
60
63
|
rb-fsevent (>= 0.9.3)
|
|
61
64
|
rb-inotify (>= 0.9.7)
|
|
62
|
-
lumberjack (1.0.
|
|
63
|
-
method_source (0.
|
|
65
|
+
lumberjack (1.0.13)
|
|
66
|
+
method_source (0.9.2)
|
|
64
67
|
multipart-post (2.0.0)
|
|
65
68
|
nap (1.1.0)
|
|
66
69
|
nenv (0.3.0)
|
|
@@ -68,37 +71,36 @@ GEM
|
|
|
68
71
|
notiffany (0.1.1)
|
|
69
72
|
nenv (~> 0.1)
|
|
70
73
|
shellany (~> 0.0)
|
|
71
|
-
octokit (4.
|
|
74
|
+
octokit (4.14.0)
|
|
72
75
|
sawyer (~> 0.8.0, >= 0.5.3)
|
|
73
76
|
open4 (1.3.4)
|
|
74
|
-
parallel (1.
|
|
75
|
-
parser (2.
|
|
76
|
-
ast (~> 2.
|
|
77
|
-
powerpack (0.1.
|
|
78
|
-
pry (0.
|
|
77
|
+
parallel (1.17.0)
|
|
78
|
+
parser (2.6.2.1)
|
|
79
|
+
ast (~> 2.4.0)
|
|
80
|
+
powerpack (0.1.2)
|
|
81
|
+
pry (0.12.2)
|
|
79
82
|
coderay (~> 1.1.0)
|
|
80
|
-
method_source (~> 0.
|
|
81
|
-
|
|
82
|
-
public_suffix (2.0.5)
|
|
83
|
+
method_source (~> 0.9.0)
|
|
84
|
+
public_suffix (3.0.3)
|
|
83
85
|
rainbow (2.2.2)
|
|
84
86
|
rake
|
|
85
87
|
rake (10.5.0)
|
|
86
|
-
rb-fsevent (0.
|
|
87
|
-
rb-inotify (0.
|
|
88
|
-
ffi (
|
|
89
|
-
rspec (3.
|
|
90
|
-
rspec-core (~> 3.
|
|
91
|
-
rspec-expectations (~> 3.
|
|
92
|
-
rspec-mocks (~> 3.
|
|
93
|
-
rspec-core (3.
|
|
94
|
-
rspec-support (~> 3.
|
|
95
|
-
rspec-expectations (3.
|
|
88
|
+
rb-fsevent (0.10.3)
|
|
89
|
+
rb-inotify (0.10.0)
|
|
90
|
+
ffi (~> 1.0)
|
|
91
|
+
rspec (3.8.0)
|
|
92
|
+
rspec-core (~> 3.8.0)
|
|
93
|
+
rspec-expectations (~> 3.8.0)
|
|
94
|
+
rspec-mocks (~> 3.8.0)
|
|
95
|
+
rspec-core (3.8.0)
|
|
96
|
+
rspec-support (~> 3.8.0)
|
|
97
|
+
rspec-expectations (3.8.2)
|
|
96
98
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
97
|
-
rspec-support (~> 3.
|
|
98
|
-
rspec-mocks (3.
|
|
99
|
+
rspec-support (~> 3.8.0)
|
|
100
|
+
rspec-mocks (3.8.0)
|
|
99
101
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
100
|
-
rspec-support (~> 3.
|
|
101
|
-
rspec-support (3.
|
|
102
|
+
rspec-support (~> 3.8.0)
|
|
103
|
+
rspec-support (3.8.0)
|
|
102
104
|
rubocop (0.49.1)
|
|
103
105
|
parallel (~> 1.10)
|
|
104
106
|
parser (>= 2.3.3.1, < 3.0)
|
|
@@ -106,28 +108,27 @@ GEM
|
|
|
106
108
|
rainbow (>= 1.99.1, < 3.0)
|
|
107
109
|
ruby-progressbar (~> 1.7)
|
|
108
110
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
109
|
-
ruby-progressbar (1.
|
|
111
|
+
ruby-progressbar (1.10.0)
|
|
110
112
|
sawyer (0.8.1)
|
|
111
113
|
addressable (>= 2.3.5, < 2.6)
|
|
112
114
|
faraday (~> 0.8, < 1.0)
|
|
113
115
|
shellany (0.0.1)
|
|
114
|
-
slop (3.6.0)
|
|
115
116
|
terminal-table (1.8.0)
|
|
116
117
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
117
|
-
thor (0.
|
|
118
|
-
unicode-display_width (1.
|
|
119
|
-
yard (0.9.
|
|
118
|
+
thor (0.20.3)
|
|
119
|
+
unicode-display_width (1.5.0)
|
|
120
|
+
yard (0.9.19)
|
|
120
121
|
|
|
121
122
|
PLATFORMS
|
|
122
123
|
ruby
|
|
123
124
|
|
|
124
125
|
DEPENDENCIES
|
|
125
|
-
bundler
|
|
126
|
+
bundler
|
|
126
127
|
danger-go!
|
|
127
128
|
guard (~> 2.14)
|
|
128
129
|
guard-rspec (~> 4.7)
|
|
129
130
|
listen (= 3.0.7)
|
|
130
|
-
pry
|
|
131
|
+
pry (~> 0.10)
|
|
131
132
|
rake (~> 10.0)
|
|
132
133
|
rspec (~> 3.4)
|
|
133
134
|
rubocop (~> 0.49.0)
|
data/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<h1 align="center">danger-go</h1>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<a href="https://
|
|
3
|
+
<a href="https://travis-ci.com/KennethanCeyer/danger-go" target="_blank"><img src="https://travis-ci.com/KennethanCeyer/danger-go.svg?branch=master" alt="Build Status"></a>
|
|
4
4
|
<a href="http://rubygems.org/gems/danger-go" target="_blank"><img src="https://img.shields.io/gem/v/danger-go.svg?style=flat" alt="License"></a>
|
|
5
|
+
<a href="https://github.com/KennethanCeyer/danger-go/blob/master/LICENSE" target="_blank"><img src="http://img.shields.io/badge/license-MIT-green.svg?style=flat" alt="License"></a>
|
|
5
6
|
</p>
|
|
6
7
|
<p align="center">A Dangerfile for golang developer (golint)</p>
|
|
7
8
|
<p align="center"><img src="./docs/images/gopher.png"></p>
|
data/docs/images/gopher.png
CHANGED
|
Binary file
|
data/lib/golint/gem_version.rb
CHANGED
data/lib/golint/plugin.rb
CHANGED
|
@@ -18,13 +18,13 @@ module Danger
|
|
|
18
18
|
# @return [String]
|
|
19
19
|
attr_writer :base_dir
|
|
20
20
|
|
|
21
|
-
MARKDOWN_TEMPLATE =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
MARKDOWN_TEMPLATE = \
|
|
22
|
+
'## DangerGo found issues\n\n'\
|
|
23
|
+
'| File | Line | Column | Reason |\n'\
|
|
24
|
+
'|------|------|--------|--------|\n'.freeze
|
|
25
25
|
|
|
26
26
|
def base_dir
|
|
27
|
-
@base_dir ||
|
|
27
|
+
@base_dir || '.'
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Lints go files.
|
|
@@ -34,7 +34,7 @@ module Danger
|
|
|
34
34
|
# @return [void]
|
|
35
35
|
#
|
|
36
36
|
def lint
|
|
37
|
-
errors = lint_results.reject
|
|
37
|
+
errors = lint_results.reject(&:nil?)
|
|
38
38
|
|
|
39
39
|
return if errors.empty?
|
|
40
40
|
|
|
@@ -56,7 +56,7 @@ module Danger
|
|
|
56
56
|
def lint_results
|
|
57
57
|
bin = 'golint'
|
|
58
58
|
system 'go get -u golang.org/x/lint/golint' unless golint_installed?
|
|
59
|
-
|
|
59
|
+
run_lint(bin, base_dir)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# Run golint aginst a single dir.
|
|
@@ -69,8 +69,7 @@ module Danger
|
|
|
69
69
|
#
|
|
70
70
|
# @return [Output]
|
|
71
71
|
def run_lint(bin, dir)
|
|
72
|
-
|
|
73
|
-
`#{command} #{dir}`.split('\n')
|
|
72
|
+
`#{bin} #{dir}`.split('\n')
|
|
74
73
|
end
|
|
75
74
|
|
|
76
75
|
# Print markdown string
|
|
@@ -80,15 +79,15 @@ module Danger
|
|
|
80
79
|
# @return [string]
|
|
81
80
|
def print_markdown_table(errors=[])
|
|
82
81
|
report = errors.inject(MARKDOWN_TEMPLATE) do |out, error_line|
|
|
83
|
-
file, line, column, reason = error_line.split(
|
|
84
|
-
out
|
|
82
|
+
file, line, column, reason = error_line.split(':')
|
|
83
|
+
out + "| #{short_link(file, line)} | #{line} | #{column} | #{reason.strip.tr('\'', '`')} |\n"
|
|
85
84
|
end
|
|
86
85
|
|
|
87
86
|
markdown(report)
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
def short_link(file, line)
|
|
91
|
-
if danger.scm_provider.to_s ==
|
|
90
|
+
if danger.scm_provider.to_s == 'github'
|
|
92
91
|
return github.html_link("#{file}#L#{line}", full_path: false)
|
|
93
92
|
end
|
|
94
93
|
|
data/spec/golint_spec.rb
CHANGED
|
@@ -17,30 +17,30 @@ module Danger
|
|
|
17
17
|
|
|
18
18
|
context 'golint not installed' do
|
|
19
19
|
before do
|
|
20
|
-
allow(@golint).to receive(:`).with(
|
|
20
|
+
allow(@golint).to receive(:`).with('which golint').and_return('')
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context 'golint installed' do
|
|
25
25
|
before do
|
|
26
|
-
allow(@golint).to receive(:`).with(
|
|
26
|
+
allow(@golint).to receive(:`).with('which golint').and_return('/usr/bin/golint')
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
describe 'lint' do
|
|
30
30
|
it 'runs lint from current directory by default' do
|
|
31
|
-
expect(@golint).to receive(:`).with(
|
|
31
|
+
expect(@golint).to receive(:`).with('golint .').and_return('')
|
|
32
32
|
@golint.lint
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
it 'runs lint from a custom directory' do
|
|
36
|
-
expect(@golint).to receive(:`).with(
|
|
36
|
+
expect(@golint).to receive(:`).with('golint my/custom/directory').and_return('')
|
|
37
37
|
|
|
38
|
-
@golint.base_dir =
|
|
38
|
+
@golint.base_dir = 'my/custom/directory'
|
|
39
39
|
@golint.lint
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
it 'handles a lint with no errors' do
|
|
43
|
-
allow(@golint).to receive(:`).with(
|
|
43
|
+
allow(@golint).to receive(:`).with('golint .').and_return('')
|
|
44
44
|
@golint.lint
|
|
45
45
|
expect(@golint.status_report[:markdowns].first).to be_nil
|
|
46
46
|
end
|
|
@@ -48,19 +48,20 @@ module Danger
|
|
|
48
48
|
|
|
49
49
|
context 'when running on github' do
|
|
50
50
|
it 'handles a lint with errors count greater than threshold' do
|
|
51
|
-
lint_report =
|
|
51
|
+
lint_report = 'test.go:213:3: don\'t use underscores in Go names; var my_var should be myVar\n'
|
|
52
52
|
|
|
53
|
-
allow(@golint).to receive(:`).with(
|
|
54
|
-
allow(@dangerfile.danger).to receive(:scm_provider).and_return(
|
|
53
|
+
allow(@golint).to receive(:`).with('golint .').and_return(lint_report)
|
|
54
|
+
allow(@dangerfile.danger).to receive(:scm_provider).and_return('github')
|
|
55
55
|
allow(@dangerfile.github).to receive(:html_link)
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
.with('test.go#L213', full_path: false)
|
|
57
|
+
.and_return('fake_link_to:test.go#L213')
|
|
58
58
|
|
|
59
59
|
@golint.lint
|
|
60
60
|
|
|
61
61
|
markdown = @golint.status_report[:markdowns].first
|
|
62
|
-
expect(markdown.message).to include(
|
|
63
|
-
expect(markdown.message).to include(
|
|
62
|
+
expect(markdown.message).to include('## DangerGo found issues')
|
|
63
|
+
expect(markdown.message).to include('| fake_link_to:test.go#L213 | 213 | 3 | ' \
|
|
64
|
+
'don`t use underscores in Go names; var my_var should be myVar |')
|
|
64
65
|
end
|
|
65
66
|
end
|
|
66
67
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: danger-go
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- KennethanCeyer
|
|
@@ -158,6 +158,13 @@ extensions: []
|
|
|
158
158
|
extra_rdoc_files: []
|
|
159
159
|
files:
|
|
160
160
|
- ".gitignore"
|
|
161
|
+
- ".rubocop.yml"
|
|
162
|
+
- ".travis.yml"
|
|
163
|
+
- ".yardoc/checksums"
|
|
164
|
+
- ".yardoc/complete"
|
|
165
|
+
- ".yardoc/object_types"
|
|
166
|
+
- ".yardoc/objects/root.dat"
|
|
167
|
+
- ".yardoc/proxy_types"
|
|
161
168
|
- Gemfile
|
|
162
169
|
- Gemfile.lock
|
|
163
170
|
- Guardfile
|