pronto-flay 0.8.0 → 0.11.1
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 +5 -5
- data/.github/CODEOWNERS +3 -0
- data/.github/workflows/checks.yml +22 -0
- data/README.md +14 -4
- data/lib/pronto/flay/version.rb +1 -1
- data/lib/pronto/flay.rb +26 -2
- data/pronto-flay.gemspec +4 -4
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ef63495669d107a5ba8a6960b2cdd9bde37714149b41000cc60dd016c0855d52
|
4
|
+
data.tar.gz: ee6fa73a905431c80d8b44dc7d55c3c83d24c648372aaf32af2c474dc866bc6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2930f2d17f894ac20873911cbc6c23797f118b15d1be1feef39c4b06663afde3076085135554480159146d9b9f571ac0a8c59b4ee72d7d5a31541c0fcf8d0ce3
|
7
|
+
data.tar.gz: a6301dd3d443bf1237797821e0550f84d922166b93b9a703294aff761c851cb740c8b5cd58b14862ed5eac99843b19d2990e6df964c81b7ce24150e2d92a4960
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Checks
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
ruby:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: rake spec
|
22
|
+
run: bundle exec rake spec
|
data/README.md
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
# Pronto runner for Flay
|
2
2
|
|
3
|
-
[](https://codeclimate.com/github/prontolabs/pronto-flay)
|
4
|
+
[](https://travis-ci.org/prontolabs/pronto-flay)
|
5
5
|
[](http://badge.fury.io/rb/pronto-flay)
|
6
|
-
[](https://gemnasium.com/prontolabs/pronto-flay)
|
7
7
|
|
8
|
-
Pronto runner for [Flay](https://github.com/seattlerb/flay), structural similarities analyzer. [What is Pronto?](https://github.com/
|
8
|
+
Pronto runner for [Flay](https://github.com/seattlerb/flay), structural similarities analyzer. [What is Pronto?](https://github.com/prontolabs/pronto)
|
9
9
|
|
10
10
|
# Configuration
|
11
11
|
|
12
12
|
Configuring excludes Using [.flayignore](https://github.com/seattlerb/flay/blob/92039b66a479f3b8a8a1204c5733e35463e66995/README.txt#L28) will work just fine with pronto-flay.
|
13
|
+
|
14
|
+
You can overwrite the default, very low mass threshold for Flay with the PRONTO_FLAY_MASS_THRESHOLD environment variable for a more sensible approach.
|
15
|
+
|
16
|
+
Severity levels for identical and similar code issues can be configured inside `.pronto.yml`:
|
17
|
+
```yaml
|
18
|
+
flay:
|
19
|
+
severity_levels:
|
20
|
+
identical: 'warning'
|
21
|
+
similar: 'warning'
|
22
|
+
```
|
data/lib/pronto/flay/version.rb
CHANGED
data/lib/pronto/flay.rb
CHANGED
@@ -3,6 +3,11 @@ require 'flay'
|
|
3
3
|
|
4
4
|
module Pronto
|
5
5
|
class Flay < Runner
|
6
|
+
DEFAULT_SEVERITY_LEVELS = {
|
7
|
+
identical: :error,
|
8
|
+
similar: :warning,
|
9
|
+
}.freeze
|
10
|
+
|
6
11
|
def run
|
7
12
|
if files.any?
|
8
13
|
flay.analyze
|
@@ -17,7 +22,11 @@ module Pronto
|
|
17
22
|
# Saving the returned Flay object at @flay so we
|
18
23
|
# can inspect it and build the messages Array.
|
19
24
|
def flay
|
20
|
-
@flay ||= ::Flay.run(
|
25
|
+
@flay ||= ::Flay.run(params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def params
|
29
|
+
[*files, '-m', mass_threshold]
|
21
30
|
end
|
22
31
|
|
23
32
|
def files
|
@@ -49,13 +58,23 @@ module Pronto
|
|
49
58
|
end
|
50
59
|
|
51
60
|
def level(hash)
|
52
|
-
same?(hash) ? :
|
61
|
+
same?(hash) ? severity_levels_config[:identical] : severity_levels_config[:similar]
|
53
62
|
end
|
54
63
|
|
55
64
|
def same?(hash)
|
56
65
|
flay.identical[hash]
|
57
66
|
end
|
58
67
|
|
68
|
+
def severity_levels_config
|
69
|
+
@severity_levels_config ||= DEFAULT_SEVERITY_LEVELS.merge(custom_severity_levels_config)
|
70
|
+
.map { |k, v| [k.to_sym, v.to_sym] }
|
71
|
+
.to_h
|
72
|
+
end
|
73
|
+
|
74
|
+
def custom_severity_levels_config
|
75
|
+
Pronto::ConfigFile.new.to_h.dig('flay', 'severity_levels') || {}
|
76
|
+
end
|
77
|
+
|
59
78
|
def message(hash)
|
60
79
|
match = same?(hash) ? 'Identical' : 'Similar'
|
61
80
|
location = nodes_for(hash).map do |node|
|
@@ -80,5 +99,10 @@ module Pronto
|
|
80
99
|
def masses
|
81
100
|
flay.masses
|
82
101
|
end
|
102
|
+
|
103
|
+
def mass_threshold
|
104
|
+
@mass_threshold ||= ENV['PRONTO_FLAY_MASS_THRESHOLD'] || Pronto::ConfigFile.new.to_h.dig('flay', 'mass_threshold') || ::Flay.default_options[:mass].to_s
|
105
|
+
end
|
106
|
+
|
83
107
|
end
|
84
108
|
end
|
data/pronto-flay.gemspec
CHANGED
@@ -10,11 +10,11 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.author = 'Mindaugas Mozūras'
|
12
12
|
s.email = 'mindaugas.mozuras@gmail.com'
|
13
|
-
s.homepage = 'http://github.
|
13
|
+
s.homepage = 'http://github.com/mmozuras/pronto-flay'
|
14
14
|
s.summary = 'Pronto runner for Flay, structural similarities analyzer'
|
15
15
|
|
16
16
|
s.licenses = ['MIT']
|
17
|
-
s.required_ruby_version = '>= 2.
|
17
|
+
s.required_ruby_version = '>= 2.3.0'
|
18
18
|
s.rubygems_version = '1.8.23'
|
19
19
|
|
20
20
|
s.files = `git ls-files`.split($RS).reject do |file|
|
@@ -32,9 +32,9 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
33
33
|
s.require_paths = ['lib']
|
34
34
|
|
35
|
-
s.add_dependency('pronto', '~> 0.
|
35
|
+
s.add_dependency('pronto', '~> 0.11.0')
|
36
36
|
s.add_dependency('flay', '~> 2.8')
|
37
|
-
s.add_development_dependency('rake', '~>
|
37
|
+
s.add_development_dependency('rake', '~> 12.0')
|
38
38
|
s.add_development_dependency('rspec', '~> 3.4')
|
39
39
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
40
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.11.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: flay
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,12 +88,14 @@ extra_rdoc_files:
|
|
88
88
|
- LICENSE
|
89
89
|
- README.md
|
90
90
|
files:
|
91
|
+
- ".github/CODEOWNERS"
|
92
|
+
- ".github/workflows/checks.yml"
|
91
93
|
- LICENSE
|
92
94
|
- README.md
|
93
95
|
- lib/pronto/flay.rb
|
94
96
|
- lib/pronto/flay/version.rb
|
95
97
|
- pronto-flay.gemspec
|
96
|
-
homepage: http://github.
|
98
|
+
homepage: http://github.com/mmozuras/pronto-flay
|
97
99
|
licenses:
|
98
100
|
- MIT
|
99
101
|
metadata: {}
|
@@ -105,15 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
107
|
requirements:
|
106
108
|
- - ">="
|
107
109
|
- !ruby/object:Gem::Version
|
108
|
-
version: 2.
|
110
|
+
version: 2.3.0
|
109
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
112
|
requirements:
|
111
113
|
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
113
115
|
version: '0'
|
114
116
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.6.10
|
117
|
+
rubygems_version: 3.0.3
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Pronto runner for Flay, structural similarities analyzer
|