querly 0.15.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +18 -0
- data/.github/workflows/ruby.yml +22 -0
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +27 -0
- data/README.md +3 -1
- data/Rakefile +1 -1
- data/bin/setup +1 -2
- data/lib/querly.rb +1 -0
- data/lib/querly/cli.rb +27 -9
- data/lib/querly/cli/console.rb +8 -4
- data/lib/querly/cli/find.rb +8 -4
- data/lib/querly/cli/formatter.rb +6 -1
- data/lib/querly/node_pair.rb +1 -1
- data/lib/querly/pattern/expr.rb +8 -6
- data/lib/querly/pattern/parser.y +8 -9
- data/lib/querly/pp/cli.rb +20 -1
- data/lib/querly/script.rb +20 -0
- data/lib/querly/script_enumerator.rb +18 -24
- data/lib/querly/version.rb +1 -1
- data/logo/Querly horizontal.pdf +793 -0
- data/logo/Querly horizontal.png +0 -0
- data/logo/Querly horizontal.svg +55 -0
- data/logo/Querly logo.png +0 -0
- data/logo/Querly vertical.png +0 -0
- data/manual/patterns.md +14 -2
- data/querly.gemspec +8 -4
- data/sample.yaml +2 -0
- data/template.yml +3 -1
- metadata +73 -16
- data/.travis.yml +0 -10
Binary file
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<svg width="2038" height="778" viewBox="0 0 2038 778" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path d="M276.003 375.191H133.085L181.02 255.405H324.826L276.003 375.191Z" fill="url(#paint0_linear)"/>
|
3
|
+
<path d="M335.478 228.786H191.672L199.662 209.265C224.517 147.154 283.992 109 356.783 109H383.414L335.478 228.786Z" fill="url(#paint1_linear)"/>
|
4
|
+
<path d="M512.129 228.786H369.211L417.146 109H560.065L512.129 228.786Z" fill="url(#paint2_linear)"/>
|
5
|
+
<path d="M630.192 375.191H486.386L534.321 255.405H678.128L630.192 375.191Z" fill="url(#paint3_linear)"/>
|
6
|
+
<path d="M217.415 521.595H213.865C152.614 521.595 101.128 454.16 121.545 401.81H265.351L217.415 521.595Z" fill="url(#paint4_linear)"/>
|
7
|
+
<path d="M394.954 521.595H251.148L299.083 401.81H442.889L394.954 521.595Z" fill="url(#paint5_linear)"/>
|
8
|
+
<path d="M431.349 521.595H427.799L475.734 401.81H619.54C589.359 476.343 518.343 521.595 431.349 521.595Z" fill="url(#paint6_linear)"/>
|
9
|
+
<path d="M689.668 228.786H545.861L593.797 109H597.348C658.598 109 710.085 176.435 689.668 228.786Z" fill="url(#paint7_linear)"/>
|
10
|
+
<path d="M479.285 668H369.211L417.146 548.214H454.429C501.477 548.214 540.535 599.678 524.557 638.719C516.568 656.465 499.702 668 479.285 668Z" fill="url(#paint8_linear)"/>
|
11
|
+
<path d="M335.478 668H331.928C270.677 668 219.191 600.565 239.608 548.214H383.414L335.478 668Z" fill="url(#paint9_linear)"/>
|
12
|
+
<path d="M1092.41 397.627C1092.41 423.604 1087.43 445.479 1077.47 463.252C1067.6 481.025 1053.2 493.525 1034.25 500.752L1085.52 555.977H1038.36L997.926 507.93H992.213C959.889 507.93 935.035 498.359 917.652 479.219C900.367 459.98 891.725 432.686 891.725 397.334C891.725 361.982 900.416 334.834 917.799 315.889C935.279 296.943 960.182 287.471 992.506 287.471C1024.34 287.471 1048.95 297.09 1066.33 316.328C1083.72 335.566 1092.41 362.666 1092.41 397.627ZM928.932 397.627C928.932 423.994 934.254 444.014 944.898 457.686C955.543 471.26 971.314 478.047 992.213 478.047C1013.01 478.047 1028.69 471.309 1039.23 457.832C1049.88 444.355 1055.2 424.287 1055.2 397.627C1055.2 371.357 1049.93 351.436 1039.38 337.861C1028.93 324.287 1013.31 317.5 992.506 317.5C971.51 317.5 955.641 324.287 944.898 337.861C934.254 351.436 928.932 371.357 928.932 397.627ZM1264 505L1259.17 483.76H1257.41C1252.62 491.279 1245.79 497.188 1236.9 501.484C1228.11 505.781 1218.05 507.93 1206.72 507.93C1187.1 507.93 1172.45 503.047 1162.78 493.281C1153.11 483.516 1148.28 468.721 1148.28 448.896V342.988H1182.99V442.891C1182.99 455.293 1185.53 464.619 1190.61 470.869C1195.69 477.021 1203.65 480.098 1214.49 480.098C1228.94 480.098 1239.54 475.801 1246.28 467.207C1253.11 458.516 1256.53 444.014 1256.53 423.701V342.988H1291.1V505H1264ZM1425.92 507.93C1400.73 507.93 1381 500.605 1366.74 485.957C1352.58 471.211 1345.5 450.947 1345.5 425.166C1345.5 398.701 1352.1 377.9 1365.28 362.764C1378.46 347.627 1396.58 340.059 1419.62 340.059C1441.01 340.059 1457.91 346.553 1470.31 359.541C1482.71 372.529 1488.91 390.4 1488.91 413.154V431.758H1380.95C1381.44 447.48 1385.69 459.59 1393.7 468.086C1401.71 476.484 1412.98 480.684 1427.54 480.684C1437.11 480.684 1445.99 479.805 1454.2 478.047C1462.5 476.191 1471.38 473.164 1480.86 468.965V496.943C1472.46 500.947 1463.96 503.779 1455.37 505.439C1446.77 507.1 1436.96 507.93 1425.92 507.93ZM1419.62 366.133C1408.69 366.133 1399.9 369.6 1393.26 376.533C1386.71 383.467 1382.81 393.574 1381.54 406.855H1455.07C1454.88 393.477 1451.66 383.369 1445.41 376.533C1439.16 369.6 1430.56 366.133 1419.62 366.133ZM1625.2 340.059C1632.13 340.059 1637.85 340.547 1642.34 341.523L1638.97 373.604C1634.09 372.432 1629.01 371.846 1623.74 371.846C1609.97 371.846 1598.79 376.338 1590.19 385.322C1581.7 394.307 1577.45 405.977 1577.45 420.332V505H1543.02V342.988H1569.98L1574.52 371.553H1576.28C1581.65 361.885 1588.63 354.219 1597.22 348.555C1605.91 342.891 1615.24 340.059 1625.2 340.059ZM1721.94 505H1687.52V277.07H1721.94V505ZM1761.7 342.988H1799.2L1832.15 434.834C1837.13 447.92 1840.46 460.225 1842.12 471.748H1843.29C1844.17 466.377 1845.78 459.883 1848.12 452.266C1850.46 444.551 1862.87 408.125 1885.33 342.988H1922.54L1853.25 526.533C1840.65 560.225 1819.65 577.07 1790.26 577.07C1782.64 577.07 1775.22 576.24 1767.99 574.58V547.334C1773.17 548.506 1779.08 549.092 1785.72 549.092C1802.32 549.092 1813.99 539.473 1820.73 520.234L1826.73 505L1761.7 342.988Z" fill="#293343"/>
|
13
|
+
<defs>
|
14
|
+
<linearGradient id="paint0_linear" x1="718.389" y1="674.57" x2="229.28" y2="352.826" gradientUnits="userSpaceOnUse">
|
15
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
16
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
17
|
+
</linearGradient>
|
18
|
+
<linearGradient id="paint1_linear" x1="140.775" y1="33.0328" x2="804.079" y2="655.614" gradientUnits="userSpaceOnUse">
|
19
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
20
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
21
|
+
</linearGradient>
|
22
|
+
<linearGradient id="paint2_linear" x1="860.797" y1="459.425" x2="371.448" y2="137.521" gradientUnits="userSpaceOnUse">
|
23
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
24
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
25
|
+
</linearGradient>
|
26
|
+
<linearGradient id="paint3_linear" x1="834.32" y1="499.88" x2="344.888" y2="177.923" gradientUnits="userSpaceOnUse">
|
27
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
28
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
29
|
+
</linearGradient>
|
30
|
+
<linearGradient id="paint4_linear" x1="-37.1093" y1="222.149" x2="626.327" y2="844.855" gradientUnits="userSpaceOnUse">
|
31
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
32
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
33
|
+
</linearGradient>
|
34
|
+
<linearGradient id="paint5_linear" x1="692.281" y1="715.121" x2="202.895" y2="393.191" gradientUnits="userSpaceOnUse">
|
35
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
36
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
37
|
+
</linearGradient>
|
38
|
+
<linearGradient id="paint6_linear" x1="103.465" y1="73.2693" x2="766.556" y2="695.652" gradientUnits="userSpaceOnUse">
|
39
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
40
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
41
|
+
</linearGradient>
|
42
|
+
<linearGradient id="paint7_linear" x1="281.045" y1="-116.263" x2="944.814" y2="506.755" gradientUnits="userSpaceOnUse">
|
43
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
44
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
45
|
+
</linearGradient>
|
46
|
+
<linearGradient id="paint8_linear" x1="641.09" y1="768.324" x2="168.73" y2="457.596" gradientUnits="userSpaceOnUse">
|
47
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
48
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
49
|
+
</linearGradient>
|
50
|
+
<linearGradient id="paint9_linear" x1="-57.481" y1="240.521" x2="606.524" y2="863.762" gradientUnits="userSpaceOnUse">
|
51
|
+
<stop offset="0.0301753" stop-color="#EC2227"/>
|
52
|
+
<stop offset="1" stop-color="#9D1F60"/>
|
53
|
+
</linearGradient>
|
54
|
+
</defs>
|
55
|
+
</svg>
|
Binary file
|
Binary file
|
data/manual/patterns.md
CHANGED
@@ -71,6 +71,8 @@ bar.foo.baz # foo...bar...baz does not match
|
|
71
71
|
* `1.23` (float)
|
72
72
|
* `:foobar` (symbol)
|
73
73
|
* `:symbol:` (any symbol literal)
|
74
|
+
* `"foobar"` (string)
|
75
|
+
* NOTE: It only supports double quotation.
|
74
76
|
* `:string:` (any string literal)
|
75
77
|
* `:dstr:` (any dstr `"hi #{name}"`)
|
76
78
|
* `true`, `false` (true and false)
|
@@ -145,9 +147,9 @@ end
|
|
145
147
|
|
146
148
|
# Interpolation Syntax
|
147
149
|
|
148
|
-
If you want to describe a pattern that can not be described with
|
150
|
+
If you want to describe a pattern that can not be described with above syntax, you can use interpolation as follows:
|
149
151
|
|
150
|
-
```
|
152
|
+
```yaml
|
151
153
|
id: find_by_abc_and_def
|
152
154
|
pattern:
|
153
155
|
subject: "'finder(...)"
|
@@ -164,6 +166,16 @@ It matches with `find_by_email_and_name(...)`.
|
|
164
166
|
- If value of meta var is a string `foo`, it matches send nodes with exactly same method name
|
165
167
|
- If value of meta var is a regexp `/foo/`, it matches send nodes with method name which `=~` the regexp
|
166
168
|
|
169
|
+
You can also use `as` syntax with `:symbol:` and so on.
|
170
|
+
|
171
|
+
```yaml
|
172
|
+
id: migration_references
|
173
|
+
pattern:
|
174
|
+
subject: "t.integer(:symbol: as 'column, ...)"
|
175
|
+
where:
|
176
|
+
column: '/.+_id/'
|
177
|
+
```
|
178
|
+
|
167
179
|
# Difference from Ruby
|
168
180
|
|
169
181
|
* Method call parenthesis cannot be omitted (if omitted, it means *any arguments*)
|
data/querly.gemspec
CHANGED
@@ -23,13 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", ">= 1.12"
|
26
|
-
spec.add_development_dependency "rake", "~>
|
26
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
27
27
|
spec.add_development_dependency "minitest", "~> 5.0"
|
28
|
-
spec.add_development_dependency "racc", "
|
28
|
+
spec.add_development_dependency "racc", ">= 1.4.14"
|
29
29
|
spec.add_development_dependency "unification_assertion", "0.0.1"
|
30
|
+
spec.add_development_dependency "better_html", "~> 1.0.13"
|
31
|
+
spec.add_development_dependency "slim", "~> 4.0.1"
|
32
|
+
spec.add_development_dependency "haml", "~> 5.0.4"
|
30
33
|
|
31
|
-
spec.add_dependency 'thor', ">= 0.19.0"
|
32
|
-
spec.add_dependency "parser", "
|
34
|
+
spec.add_dependency 'thor', ">= 0.19.0"
|
35
|
+
spec.add_dependency "parser", ">= 2.5.0"
|
33
36
|
spec.add_dependency "rainbow", ">= 2.1"
|
34
37
|
spec.add_dependency "activesupport", ">= 5.0"
|
38
|
+
spec.add_dependency "parallel", "~>1.17"
|
35
39
|
end
|
data/sample.yaml
CHANGED
data/template.yml
CHANGED
@@ -58,7 +58,9 @@ rules:
|
|
58
58
|
assert_empty some.count
|
59
59
|
|
60
60
|
preprocessor:
|
61
|
-
.slim: slimrb --compile
|
61
|
+
# .slim: slimrb --compile # Install `slim` gem for slim support
|
62
|
+
# .erb: querly-pp erb # Install `better_erb` gem for erb support
|
63
|
+
# .haml: querly-pp haml # Install `haml` gem for haml support
|
62
64
|
|
63
65
|
check:
|
64
66
|
- path: /
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: querly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: racc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.4.14
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.4.14
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -80,6 +80,48 @@ dependencies:
|
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: better_html
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.13
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.13
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: slim
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.0.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 4.0.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: haml
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 5.0.4
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 5.0.4
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
126
|
name: thor
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,9 +129,6 @@ dependencies:
|
|
87
129
|
- - ">="
|
88
130
|
- !ruby/object:Gem::Version
|
89
131
|
version: 0.19.0
|
90
|
-
- - "<"
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 0.21.0
|
93
132
|
type: :runtime
|
94
133
|
prerelease: false
|
95
134
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -97,21 +136,18 @@ dependencies:
|
|
97
136
|
- - ">="
|
98
137
|
- !ruby/object:Gem::Version
|
99
138
|
version: 0.19.0
|
100
|
-
- - "<"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 0.21.0
|
103
139
|
- !ruby/object:Gem::Dependency
|
104
140
|
name: parser
|
105
141
|
requirement: !ruby/object:Gem::Requirement
|
106
142
|
requirements:
|
107
|
-
- - "
|
143
|
+
- - ">="
|
108
144
|
- !ruby/object:Gem::Version
|
109
145
|
version: 2.5.0
|
110
146
|
type: :runtime
|
111
147
|
prerelease: false
|
112
148
|
version_requirements: !ruby/object:Gem::Requirement
|
113
149
|
requirements:
|
114
|
-
- - "
|
150
|
+
- - ">="
|
115
151
|
- !ruby/object:Gem::Version
|
116
152
|
version: 2.5.0
|
117
153
|
- !ruby/object:Gem::Dependency
|
@@ -142,6 +178,20 @@ dependencies:
|
|
142
178
|
- - ">="
|
143
179
|
- !ruby/object:Gem::Version
|
144
180
|
version: '5.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: parallel
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '1.17'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1.17'
|
145
195
|
description: Querly is a query language and tool to find out method calls from Ruby
|
146
196
|
programs. Define rules to check your program with patterns to find out *bad* pieces.
|
147
197
|
Querly finds out matching pieces from your program.
|
@@ -153,8 +203,10 @@ executables:
|
|
153
203
|
extensions: []
|
154
204
|
extra_rdoc_files: []
|
155
205
|
files:
|
206
|
+
- ".github/workflows/rubocop.yml"
|
207
|
+
- ".github/workflows/ruby.yml"
|
156
208
|
- ".gitignore"
|
157
|
-
- ".
|
209
|
+
- ".rubocop.yml"
|
158
210
|
- CHANGELOG.md
|
159
211
|
- Gemfile
|
160
212
|
- LICENSE
|
@@ -188,6 +240,11 @@ files:
|
|
188
240
|
- lib/querly/script.rb
|
189
241
|
- lib/querly/script_enumerator.rb
|
190
242
|
- lib/querly/version.rb
|
243
|
+
- logo/Querly horizontal.pdf
|
244
|
+
- logo/Querly horizontal.png
|
245
|
+
- logo/Querly horizontal.svg
|
246
|
+
- logo/Querly logo.png
|
247
|
+
- logo/Querly vertical.png
|
191
248
|
- manual/configuration.md
|
192
249
|
- manual/examples.md
|
193
250
|
- manual/patterns.md
|
@@ -214,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
271
|
- !ruby/object:Gem::Version
|
215
272
|
version: '0'
|
216
273
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
274
|
+
rubygems_version: 3.1.2
|
218
275
|
signing_key:
|
219
276
|
specification_version: 4
|
220
277
|
summary: Pattern Based Checking Tool for Ruby
|