querly 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE +21 -0
- data/lib/querly/cli.rb +1 -1
- data/lib/querly/cli/console.rb +9 -14
- data/lib/querly/version.rb +1 -1
- data/manual/patterns.md +1 -1
- data/querly.gemspec +1 -0
- data/rules/sample.yml +1 -1
- data/template.yml +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59c90b4b800268fd5d50b49faf97dc27e5f4f49c
|
4
|
+
data.tar.gz: a9431bc1cab5e5fe25d2cbe6b43da73fad6d5bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb1374c2e661f5efd72f91e37bc506fe2f923299769191a84eb66c00952820f70dae04d61ee1252fc81c1775f1d33aa3f6756992cc2478b220380a6e360cfde
|
7
|
+
data.tar.gz: 2cd66a62b2bd1682f882c4c13bd0540b95e2ef4d27303bae6bd1029c4c526aa96d20a580598c4028feb84142246096cb32328d811c2e180b31eed1bf439b1cac
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.12.0 (2018-08-03)
|
6
|
+
|
7
|
+
* Declare MIT license #44
|
8
|
+
* Make reading backtrace easier in `console` command (@pocke) #43
|
9
|
+
* Highlight matched expression in querly console (@pocke) #42
|
10
|
+
* Set exit status = 1 when `querly.yaml` has syntax error (@pocke) #41
|
11
|
+
* Fix typos (@koic, @vzvu3k6k) #40, #39
|
12
|
+
|
5
13
|
## 0.11.0 (2018-04-22)
|
6
14
|
|
7
15
|
* Relax `rainbow` version requirement
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Soutaro Matsumoto
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/lib/querly/cli.rb
CHANGED
@@ -36,7 +36,7 @@ Specify configuration file by --config option.
|
|
36
36
|
Config.load(yaml, config_path: config_path, root_dir: root_path, stderr: STDERR)
|
37
37
|
rescue => exn
|
38
38
|
formatter.config_error config_path, exn
|
39
|
-
exit
|
39
|
+
exit 1
|
40
40
|
end
|
41
41
|
|
42
42
|
analyzer = Analyzer.new(config: config, rule: options[:rule])
|
data/lib/querly/cli/console.rb
CHANGED
@@ -43,7 +43,7 @@ Querly #{VERSION}, interactive console
|
|
43
43
|
@analyzer.scripts << script
|
44
44
|
when StandardError
|
45
45
|
p path: path, script: script.inspect
|
46
|
-
|
46
|
+
puts script.backtrace
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -69,21 +69,16 @@ Querly #{VERSION}, interactive console
|
|
69
69
|
analyzer.find(pattern) do |script, pair|
|
70
70
|
path = script.path.to_s
|
71
71
|
line = pair.node.loc.first_line
|
72
|
+
range = pair.node.loc.expression
|
73
|
+
start_col = range.column
|
74
|
+
end_col = range.last_column
|
72
75
|
|
73
|
-
|
74
|
-
|
76
|
+
src = range.source_buffer.source_lines[line-1]
|
77
|
+
src = Rainbow(src[0...start_col]).blue +
|
78
|
+
Rainbow(src[start_col...end_col]).bright.blue.bold +
|
79
|
+
Rainbow(src[end_col..-1]).blue
|
75
80
|
|
76
|
-
|
77
|
-
pair = pair.parent
|
78
|
-
else
|
79
|
-
break
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
src = Rainbow(pair.node.loc.expression.source.split(/\n/).first).blue
|
84
|
-
col = pair.node.loc.column
|
85
|
-
|
86
|
-
puts " #{path}:#{line}:#{col}\t#{src}"
|
81
|
+
puts " #{path}:#{line}:#{start_col}\t#{src}"
|
87
82
|
|
88
83
|
count += 1
|
89
84
|
end
|
data/lib/querly/version.rb
CHANGED
data/manual/patterns.md
CHANGED
@@ -160,7 +160,7 @@ pattern:
|
|
160
160
|
It matches with `find_by_email_and_name(...)`.
|
161
161
|
|
162
162
|
- Meta variables `'finder` can occur only as method name
|
163
|
-
- Unused meta var definition
|
163
|
+
- Unused meta var definition is okay, but undefined meta var reference raises an error
|
164
164
|
- If value of meta var is a string `foo`, it matches send nodes with exactly same method name
|
165
165
|
- If value of meta var is a regexp `/foo/`, it matches send nodes with method name which `=~` the regexp
|
166
166
|
|
data/querly.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Querly::VERSION
|
9
9
|
spec.authors = ["Soutaro Matsumoto"]
|
10
10
|
spec.email = ["matsumoto@soutaro.com"]
|
11
|
+
spec.license = "MIT"
|
11
12
|
|
12
13
|
spec.summary = %q{Pattern Based Checking Tool for Ruby}
|
13
14
|
spec.description = %q{Querly is a query language and tool to find out method calls from Ruby programs. Define rules to check your program with patterns to find out *bad* pieces. Querly finds out matching pieces from your program.}
|
data/rules/sample.yml
CHANGED
@@ -30,5 +30,5 @@
|
|
30
30
|
`clone` returns frozen object when receiver is frozen.
|
31
31
|
|
32
32
|
* If object is frozen, you usually does not need to clone it
|
33
|
-
* When you need a copy of a object, you
|
33
|
+
* When you need a copy of a object, you probably want to modify that; did you mean dup?
|
34
34
|
* Ruby 2.4 accepts freeze keyword and returns not frozen object
|
data/template.yml
CHANGED
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: 0.
|
4
|
+
version: 0.12.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: 2018-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- ".travis.yml"
|
158
158
|
- CHANGELOG.md
|
159
159
|
- Gemfile
|
160
|
+
- LICENSE
|
160
161
|
- README.md
|
161
162
|
- Rakefile
|
162
163
|
- bin/console
|
@@ -194,7 +195,8 @@ files:
|
|
194
195
|
- sample.yaml
|
195
196
|
- template.yml
|
196
197
|
homepage: https://github.com/soutaro/querly
|
197
|
-
licenses:
|
198
|
+
licenses:
|
199
|
+
- MIT
|
198
200
|
metadata: {}
|
199
201
|
post_install_message:
|
200
202
|
rdoc_options: []
|