pronto-golang 0.0.11 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b73839c9ca428457695dbbc4758df2a5e0c77547e8448d36c673fa0d453a08
4
- data.tar.gz: e3a84a4ceeb6431d204e3b7cb1cf07ba5b53502ab0cb50e439b58ab4bef423a1
3
+ metadata.gz: 0542e6e9b70b08409a682de22445a2a8a279b2352fed6e69bc461e3ee785aba4
4
+ data.tar.gz: bdb4f8fe3d184772a0e037f1636fa3a6487f2565f8a09fbf7d55f97c62e872ca
5
5
  SHA512:
6
- metadata.gz: e9b797ba16cb7e265bd2fda0458fccc6bbe535a48dd41235c2e24a61d1833384c822357eaabc557d139f05e839d198909efdf6403fe64bf9ff6cbf1b55acaf98
7
- data.tar.gz: fe5375cea51db2e86bb1192ac4752597510860626ee43e04c4a4b19928fcc0bc5e5a0f57e35ca9c099aaff313c7b73403be2ae079d76396aa257cf564344af71
6
+ metadata.gz: ab3887662aa406ea3ef6a1b3a2498fa1683cd5f72ed4599e1ae9aeb28e8c694a4c7ae3cc8e1b5a81d0f4ce146d9402f80a218e12b4b81c9f052f81b56a9904d2
7
+ data.tar.gz: 45c1b18511917b2fb85039b8d75770541f17cc65d38172e6f7cda5ef98b7004cfe9e05e61f855b94b98ae03079d72cda6b2688bfb4f613b5fd59f078add1b266
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2018 Cash Payment Solutions GmbH
3
+ Copyright (c) 2023 viafintech GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pronto runner for Golang
2
2
 
3
- [![Build Status](https://travis-ci.org/Barzahlen/pronto-golang.svg?branch=master)](https://travis-ci.org/Barzahlen/pronto-golang) [![RubyDoc](https://img.shields.io/badge/ruby-doc-green.svg)](http://rubydoc.info/github/Barzahlen/pronto-golang)
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 get -u golang.org/x/lint/golint |
13
- | gosec | See [Install instructions](https://github.com/securego/gosec#install) |
14
- | staticcheck | go get -u honnef.co/go/tools/cmd/staticcheck |
15
- | golangci-lint | go get -u github.com/golangci/golangci-lint/cmd/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 with the parameters `./...`.
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
- # Accepts lines of the following format:
18
- # [path_to_file:<line_number>] -
19
- if line !~ /^\[(\S+):(\d+)\] - (.+)/
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
 
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module GolangVersion
3
- VERSION = '0.0.11'.freeze
3
+ VERSION = '0.0.13'.freeze
4
4
  end
5
5
  end
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.11
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: 2019-08-13 00:00:00.000000000 Z
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: '12.0'
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: '12.0'
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.8'
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.8'
61
- description:
62
- email: tobias.schoknecht@barzahlen.de
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/Barzahlen/pronto-golang
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.0.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: []