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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '0966a8d26738c5a32c6ead5c8062453334e1f038'
4
- data.tar.gz: 9e4ea33dce6f33f069cb02effde90f14eba07982
3
+ metadata.gz: 59c90b4b800268fd5d50b49faf97dc27e5f4f49c
4
+ data.tar.gz: a9431bc1cab5e5fe25d2cbe6b43da73fad6d5bf6
5
5
  SHA512:
6
- metadata.gz: 674ceb8165a681d84869e3546e6afea0be0d32639e7a96e0e39c7cb559542a6cbee9ad4c29f9f465fefbd1c1ca9cd5d2301b8d8ae7e35d3d28c8fe2a25475918
7
- data.tar.gz: 8d819280b2f2b6b17f6a49fb5f3604c78a5673ed40d6394856d6348304cea51735fad382e864a2b8277f8bf24080547e9d072eb2cac74226cfb3f2eeab4087de
6
+ metadata.gz: deb1374c2e661f5efd72f91e37bc506fe2f923299769191a84eb66c00952820f70dae04d61ee1252fc81c1775f1d33aa3f6756992cc2478b220380a6e360cfde
7
+ data.tar.gz: 2cd66a62b2bd1682f882c4c13bd0540b95e2ef4d27303bae6bd1029c4c526aa96d20a580598c4028feb84142246096cb32328d811c2e180b31eed1bf439b1cac
@@ -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.
@@ -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])
@@ -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
- p script.backtrace
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
- while true
74
- parent = pair.parent
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
- if parent && parent.node.loc.first_line == line
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
@@ -1,3 +1,3 @@
1
1
  module Querly
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -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 i1s okay, but undefined meta var reference raises an error
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
 
@@ -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.}
@@ -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 provablly want to modify that; did you mean dup?
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
@@ -28,7 +28,7 @@ rules:
28
28
  - id: sample.exception
29
29
  pattern: Exception
30
30
  message: |
31
- You probablly should use StandardError
31
+ You probably should use StandardError
32
32
 
33
33
  If you are trying to define error class, inherit that from StandardError.
34
34
  justification:
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.11.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-04-22 00:00:00.000000000 Z
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: []