pronto-golang 0.0.11 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +10 -7
- data/lib/pronto/golang/tools/base.rb +4 -0
- data/lib/pronto/golang/tools/gosec.rb +10 -3
- data/lib/pronto/golang/version.rb +1 -1
- data/lib/pronto/golang.rb +6 -2
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0542e6e9b70b08409a682de22445a2a8a279b2352fed6e69bc461e3ee785aba4
|
4
|
+
data.tar.gz: bdb4f8fe3d184772a0e037f1636fa3a6487f2565f8a09fbf7d55f97c62e872ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab3887662aa406ea3ef6a1b3a2498fa1683cd5f72ed4599e1ae9aeb28e8c694a4c7ae3cc8e1b5a81d0f4ce146d9402f80a218e12b4b81c9f052f81b56a9904d2
|
7
|
+
data.tar.gz: 45c1b18511917b2fb85039b8d75770541f17cc65d38172e6f7cda5ef98b7004cfe9e05e61f855b94b98ae03079d72cda6b2688bfb4f613b5fd59f078add1b266
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Pronto runner for Golang
|
2
2
|
|
3
|
-
|
3
|
+
![Build Status](https://github.com/viafintech/pronto-golang/actions/workflows/test.yml/badge.svg) [![RubyDoc](https://img.shields.io/badge/ruby-doc-green.svg)](http://rubydoc.info/github/Barzahlen/pronto-golang)
|
4
4
|
|
5
5
|
Pronto runner for [Golang](https://golang.org) tools
|
6
6
|
|
@@ -9,10 +9,10 @@ Pronto runner for [Golang](https://golang.org) tools
|
|
9
9
|
| Tool | Install |
|
10
10
|
|----------|----------|
|
11
11
|
| go vet | - |
|
12
|
-
| golint | go
|
13
|
-
| gosec |
|
14
|
-
| staticcheck | go
|
15
|
-
| golangci-lint |
|
12
|
+
| golint | go install golang.org/x/lint/golint@latest |
|
13
|
+
| gosec | go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0 |
|
14
|
+
| staticcheck | go install honnef.co/go/tools/cmd/staticcheck@latest |
|
15
|
+
| golangci-lint | See [Install instructions](https://golangci-lint.run/usage/install/) |
|
16
16
|
|
17
17
|
## Configuring tools
|
18
18
|
|
@@ -23,12 +23,15 @@ It looks as follows:
|
|
23
23
|
tools:
|
24
24
|
<tool base command>:
|
25
25
|
enabled: true
|
26
|
-
parameters: '
|
26
|
+
parameters: '-v'
|
27
|
+
blacklisted_files: '.*\/vendor\/.*'
|
27
28
|
```
|
28
29
|
|
29
|
-
If a tool is not listed here, it will automatically be enabled
|
30
|
+
If a tool is not listed here, it will automatically be enabled.
|
30
31
|
In order to specifically disable a tool, it has to be listed and `enabled` has to be set to `false`.
|
31
32
|
If either of the keys is not provided the default will be assumed.
|
33
|
+
It is possible to pass specific parameters to the tool, which is executed with `<tool> <parameters> <file_path>`.
|
34
|
+
If is also possible to skip handling specific files by providing a pattern in `blacklisted_files`, e.g. `'.*\/vendor\/.*'` to ignore vendor. It will check every file by default.
|
32
35
|
|
33
36
|
## Implementing additional tools
|
34
37
|
|
@@ -21,6 +21,10 @@ module Pronto
|
|
21
21
|
@config.fetch('parameters', '') # Default to '' if the key is not configured
|
22
22
|
end
|
23
23
|
|
24
|
+
def blacklisted_files_regexp
|
25
|
+
@regexp ||= Regexp.new(@config.fetch('blacklisted_files', '^(?!.*)$'))
|
26
|
+
end
|
27
|
+
|
24
28
|
def available?
|
25
29
|
installed? && enabled?
|
26
30
|
end
|
@@ -5,6 +5,13 @@ require_relative '../errors'
|
|
5
5
|
module Pronto
|
6
6
|
module GolangTools
|
7
7
|
class Gosec < Base
|
8
|
+
|
9
|
+
# Accepts lines of the following format:
|
10
|
+
# [path_to_file:<line_number>] -
|
11
|
+
GOSEC_LINE_PATTERN = Regexp.new('^\[(\S+):(\d+)\] - (.+)')
|
12
|
+
|
13
|
+
ANSI_COLOR_CODING_PATTERN = Regexp.new('\e\[\d+(;\d+)?m')
|
14
|
+
|
8
15
|
def self.base_command
|
9
16
|
'gosec'
|
10
17
|
end
|
@@ -14,9 +21,9 @@ module Pronto
|
|
14
21
|
end
|
15
22
|
|
16
23
|
def parse_line(line)
|
17
|
-
|
18
|
-
|
19
|
-
if line
|
24
|
+
line = line.gsub(ANSI_COLOR_CODING_PATTERN, '')
|
25
|
+
|
26
|
+
if !GOSEC_LINE_PATTERN.match(line)
|
20
27
|
raise ::Pronto::GolangSupport::UnprocessableLine.new(line)
|
21
28
|
end
|
22
29
|
|
data/lib/pronto/golang.rb
CHANGED
@@ -34,6 +34,12 @@ module Pronto
|
|
34
34
|
messages = []
|
35
35
|
|
36
36
|
available_tools.each do |tool|
|
37
|
+
# Skip the patch if the filepath is blacklisted in the 'blacklisted_files' config
|
38
|
+
# Note: this defaults to '.*' and therefore matches everything by default
|
39
|
+
if tool.blacklisted_files_regexp.match?(escaped_path)
|
40
|
+
next
|
41
|
+
end
|
42
|
+
|
37
43
|
Open3.popen3("#{tool.command(escaped_path)}") do |stdin, stdout, stderr, wait_thr|
|
38
44
|
[stdout, stderr].each do |result_text|
|
39
45
|
while output_line = result_text.gets
|
@@ -43,8 +49,6 @@ module Pronto
|
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
46
|
-
|
47
|
-
|
48
52
|
while output_line = stderr.gets
|
49
53
|
process_line(patch, tool, output_line)
|
50
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-golang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schoknecht
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|
@@ -36,30 +36,30 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '13.0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '13.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
53
|
+
version: '3.12'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
61
|
-
description:
|
62
|
-
email: tobias.schoknecht@
|
60
|
+
version: '3.12'
|
61
|
+
description:
|
62
|
+
email: tobias.schoknecht@viafintech.com
|
63
63
|
executables: []
|
64
64
|
extensions: []
|
65
65
|
extra_rdoc_files:
|
@@ -79,11 +79,11 @@ files:
|
|
79
79
|
- lib/pronto/golang/tools/govet.rb
|
80
80
|
- lib/pronto/golang/tools/staticcheck.rb
|
81
81
|
- lib/pronto/golang/version.rb
|
82
|
-
homepage: https://github.com/
|
82
|
+
homepage: https://github.com/viafintech/pronto-golang
|
83
83
|
licenses:
|
84
84
|
- MIT
|
85
85
|
metadata: {}
|
86
|
-
post_install_message:
|
86
|
+
post_install_message:
|
87
87
|
rdoc_options: []
|
88
88
|
require_paths:
|
89
89
|
- lib
|
@@ -98,8 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
101
|
+
rubygems_version: 3.1.6
|
102
|
+
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Pronto runner for golang tools
|
105
105
|
test_files: []
|