pronto-sorbet 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +11 -0
- data/lib/pronto/sorbet.rb +49 -0
- data/lib/pronto/sorbet/version.rb +5 -0
- data/pronto-sorbet.gemspec +30 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 39e7278ac221b56c9bd7fd8e7db2f215e7e7a30d87170fd6aaae78528578ee1d
|
4
|
+
data.tar.gz: db6c085b18e0d30503899e897edc5353e2b74efa39b876a5ea15f8c58d7915db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 33b885243ddb749e397e3f7b9d058e669357c542ea06f01eeb153bc0a7e8a6ac4e2b47f73675b1ba32a121619f98791d455abbcb26f5763921515e1880b9ae02
|
7
|
+
data.tar.gz: 94bf6a1c8bfc37645bd1fe0082da3a8237d9a3cc0c8790b893e8223a053cf7668bde6d70cd9de3e9802b65310e9e5430b9683887aac791b62b239dd8f36b5c71
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Ashish Kulkarni
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Pronto runner for Brakeman
|
2
|
+
|
3
|
+
Pronto runner for [Sorbet](https://sorbet.org/), a static type checker for [Ruby](https://www.ruby-lang.org/). [What is Pronto?](https://github.com/prontolabs/pronto)
|
4
|
+
|
5
|
+
## Contributing
|
6
|
+
|
7
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/teamsimplepay/pronto-sorbet.
|
8
|
+
|
9
|
+
## License
|
10
|
+
|
11
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require 'pronto'
|
3
|
+
require 'pronto/sorbet/version'
|
4
|
+
|
5
|
+
module Pronto
|
6
|
+
module Sorbet
|
7
|
+
class Runner < ::Pronto::Runner
|
8
|
+
SEVERITY = :warning
|
9
|
+
|
10
|
+
def sorbet_executable
|
11
|
+
@sorbet_executable ||= begin
|
12
|
+
path = `git config pronto.sorbet`.strip
|
13
|
+
!path.empty? && File.executable?(path) ? path : 'srb'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def sorbet_errors
|
18
|
+
Dir.chdir(repo_path) do
|
19
|
+
output, _ = Open3.capture2e(sorbet_executable, 'tc')
|
20
|
+
|
21
|
+
output.split("\n")[0..-2].slice_after { |l| l.strip.empty? }.map do |lines|
|
22
|
+
filename, line, message = lines.first.split(':', 3)
|
23
|
+
{ filename: filename, line: line.to_i, message: message.lstrip,
|
24
|
+
details: lines[1..-1].join("\n").rstrip }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
rescue SystemCallError
|
28
|
+
[]
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
return [] unless ruby_patches.any?
|
33
|
+
|
34
|
+
sorbet_errors.map do |error|
|
35
|
+
patch = ruby_patches.find do |patch|
|
36
|
+
patch.new_file_full_path.relative_path_from(repo_path).to_s == error[:filename]
|
37
|
+
end
|
38
|
+
next if patch.nil?
|
39
|
+
|
40
|
+
line = patch.added_lines.find { |l| l.new_lineno == error[:line] } || patch.added_lines.first
|
41
|
+
next if line.nil?
|
42
|
+
|
43
|
+
Message.new(line.patch.delta.new_file[:path], line, SEVERITY,
|
44
|
+
"#{error[:message]}\n#{error[:details]}", nil, self.class)
|
45
|
+
end.compact
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "pronto/sorbet/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pronto-sorbet"
|
8
|
+
spec.version = Pronto::Sorbet::VERSION
|
9
|
+
spec.authors = ["Ashish Kulkarni"]
|
10
|
+
spec.email = ["opensource@simplepay.cloud"]
|
11
|
+
|
12
|
+
spec.summary = "Pronto runner for Sorbet, a static type checker for Ruby"
|
13
|
+
spec.homepage = "https://github.com/teamsimplepay/pronto-sorbet"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.required_ruby_version = '>= 2.5.0'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency('pronto', '~> 0.10.0')
|
26
|
+
spec.add_runtime_dependency('sorbet', '~> 0.5.0')
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pronto-sorbet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ashish Kulkarni
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pronto
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sorbet
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.5.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.5.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- opensource@simplepay.cloud
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- lib/pronto/sorbet.rb
|
81
|
+
- lib/pronto/sorbet/version.rb
|
82
|
+
- pronto-sorbet.gemspec
|
83
|
+
homepage: https://github.com/teamsimplepay/pronto-sorbet
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 2.5.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.0.6
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Pronto runner for Sorbet, a static type checker for Ruby
|
106
|
+
test_files: []
|