pronto-flay 0.11.0 → 0.11.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/.github/dependabot.yml +6 -0
- data/.github/workflows/checks.yml +6 -2
- data/.github/workflows/push_gem.yml +32 -0
- data/README.md +12 -3
- data/lib/pronto/flay/version.rb +1 -1
- data/lib/pronto/flay.rb +27 -3
- data/pronto-flay.gemspec +2 -2
- metadata +20 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 632d110a9944c806e14e8bc6daf14fa43fa20c1a16fb82b6abebe3457949e44b
|
4
|
+
data.tar.gz: 801b8be52cd71ce1a20b81b651910edf10f8167025851d5a204c5b5f0637bb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76d3da054039bcc3bede29ec7380008231bcc7155ec4d391d4e91c71814e7616b37e899f9a9a02fe01e1840dc365034dac65f0ec62e41ae50cb3e8f35ed053c
|
7
|
+
data.tar.gz: 3a6e543e494a600116f2fae2683acdc09fbbf3bbde3f049c4751feb17ccd78fa4cf3cbff06e68e80521bb921d690464e4f83207359da810ea17aa3c24371383d
|
@@ -11,9 +11,13 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
|
14
|
+
ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
|
15
|
+
fail-fast: false
|
15
16
|
steps:
|
16
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v4
|
18
|
+
- name: use older path_expander version
|
19
|
+
if: matrix.ruby == '2.3' || matrix.ruby == '2.4'
|
20
|
+
run: echo "gem 'path_expander', '1.1.1'" > Gemfile.local
|
17
21
|
- uses: ruby/setup-ruby@v1
|
18
22
|
with:
|
19
23
|
ruby-version: ${{ matrix.ruby }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Publish gem to rubygems.org
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- 'v*'
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: read
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
push:
|
13
|
+
if: github.repository == 'prontolabs/pronto-flay'
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: write
|
18
|
+
id-token: write
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
|
22
|
+
with:
|
23
|
+
egress-policy: audit
|
24
|
+
|
25
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
26
|
+
|
27
|
+
- uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.0
|
28
|
+
with:
|
29
|
+
bundler-cache: true
|
30
|
+
ruby-version: '3.4'
|
31
|
+
|
32
|
+
- uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
|
data/README.md
CHANGED
@@ -1,12 +1,21 @@
|
|
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
3
|
[](http://badge.fury.io/rb/pronto-flay)
|
6
|
-
[](https://github.com/prontolabs/pronto-flay/actions/workflows/checks.yml)
|
5
|
+
[](https://codeclimate.com/github/prontolabs/pronto-flay)
|
7
6
|
|
8
7
|
Pronto runner for [Flay](https://github.com/seattlerb/flay), structural similarities analyzer. [What is Pronto?](https://github.com/prontolabs/pronto)
|
9
8
|
|
10
9
|
# Configuration
|
11
10
|
|
12
11
|
Configuring excludes Using [.flayignore](https://github.com/seattlerb/flay/blob/92039b66a479f3b8a8a1204c5733e35463e66995/README.txt#L28) will work just fine with pronto-flay.
|
12
|
+
|
13
|
+
You can overwrite the default, very low mass threshold for Flay with the PRONTO_FLAY_MASS_THRESHOLD environment variable for a more sensible approach.
|
14
|
+
|
15
|
+
Severity levels for identical and similar code issues can be configured inside `.pronto.yml`:
|
16
|
+
```yaml
|
17
|
+
flay:
|
18
|
+
severity_levels:
|
19
|
+
identical: 'warning'
|
20
|
+
similar: 'warning'
|
21
|
+
```
|
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
|
@@ -38,7 +47,7 @@ module Pronto
|
|
38
47
|
|
39
48
|
def patch_for_node(node)
|
40
49
|
ruby_patches.find do |patch|
|
41
|
-
patch.new_file_full_path == node.file
|
50
|
+
patch.new_file_full_path.to_s == node.file.to_s
|
42
51
|
end
|
43
52
|
end
|
44
53
|
|
@@ -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,12 +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.com/
|
13
|
+
s.homepage = 'http://github.com/prontolabs/pronto-flay'
|
14
14
|
s.summary = 'Pronto runner for Flay, structural similarities analyzer'
|
15
15
|
|
16
16
|
s.licenses = ['MIT']
|
17
17
|
s.required_ruby_version = '>= 2.3.0'
|
18
|
-
s.rubygems_version = '1.8.23'
|
19
18
|
|
20
19
|
s.files = `git ls-files`.split($RS).reject do |file|
|
21
20
|
file =~ %r{^(?:
|
@@ -34,6 +33,7 @@ Gem::Specification.new do |s|
|
|
34
33
|
|
35
34
|
s.add_dependency('pronto', '~> 0.11.0')
|
36
35
|
s.add_dependency('flay', '~> 2.8')
|
36
|
+
s.add_development_dependency('base64')
|
37
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')
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: pronto
|
@@ -38,6 +37,20 @@ dependencies:
|
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '2.8'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: base64
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
41
54
|
- !ruby/object:Gem::Dependency
|
42
55
|
name: rake
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +93,6 @@ dependencies:
|
|
80
93
|
- - "~>"
|
81
94
|
- !ruby/object:Gem::Version
|
82
95
|
version: '1.2'
|
83
|
-
description:
|
84
96
|
email: mindaugas.mozuras@gmail.com
|
85
97
|
executables: []
|
86
98
|
extensions: []
|
@@ -89,17 +101,18 @@ extra_rdoc_files:
|
|
89
101
|
- README.md
|
90
102
|
files:
|
91
103
|
- ".github/CODEOWNERS"
|
104
|
+
- ".github/dependabot.yml"
|
92
105
|
- ".github/workflows/checks.yml"
|
106
|
+
- ".github/workflows/push_gem.yml"
|
93
107
|
- LICENSE
|
94
108
|
- README.md
|
95
109
|
- lib/pronto/flay.rb
|
96
110
|
- lib/pronto/flay/version.rb
|
97
111
|
- pronto-flay.gemspec
|
98
|
-
homepage: http://github.com/
|
112
|
+
homepage: http://github.com/prontolabs/pronto-flay
|
99
113
|
licenses:
|
100
114
|
- MIT
|
101
115
|
metadata: {}
|
102
|
-
post_install_message:
|
103
116
|
rdoc_options: []
|
104
117
|
require_paths:
|
105
118
|
- lib
|
@@ -114,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
127
|
- !ruby/object:Gem::Version
|
115
128
|
version: '0'
|
116
129
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
130
|
+
rubygems_version: 3.6.2
|
119
131
|
specification_version: 4
|
120
132
|
summary: Pronto runner for Flay, structural similarities analyzer
|
121
133
|
test_files: []
|