querly 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c59512018b5efff3d07b7be91d84f27bdbcb03ab0c3c85d753776defae7f1465
4
- data.tar.gz: 2d3a28676a671d80378c67e26bd2afd6bf047243a775da6db990dad97e0b0495
3
+ metadata.gz: 3604de13f36852d57290140b9bf4e4bfeb5811ffb8dbfef054a3e0ce8e9aa47a
4
+ data.tar.gz: '09038f2030b2c6bc859cfbd7087ae62da8efd2ac4ae1e3b945741d3f65d3146b'
5
5
  SHA512:
6
- metadata.gz: b72388f4e4cd1d73c6b5942fcbe5897ffa7f1aac5fd4cfa40c644a5a2ac21f36809531847d10a455c97d6f5b9f4d1a580715f390b98f92352bcc9819949c4bca
7
- data.tar.gz: 12116f61a8ae822d6a95560d4acdde918579e312702f402b51bb5a9244cca1f5c4b69b0d47e02a88a6b35fa4f37de90ed0727919eede1dce2362c95e3eb4b2da
6
+ metadata.gz: 8c2dbbd840b5eb4fa65418c4d2ab81af6154dbbac94c96d083c4f7f9d88e5447666f7d583b54f4c266f52c4f4f15d2f38210c353762c2f8c281785da161d0aec
7
+ data.tar.gz: 4fd40dc297b03b7de10e3f1bb348a553d1af355f3e6310feed4b9b8e1fe5324757684e443cb8a699952bc0ccfedcf95f072e13890b5cc838f4c2850b7ef09d58
@@ -0,0 +1,18 @@
1
+ name: RuboCop
2
+
3
+ on: pull_request
4
+
5
+ jobs:
6
+ rubocop:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - uses: ruby/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.6
13
+ - run: gem install rubocop rubocop-rubycw --no-document
14
+ - name: Run RuboCop
15
+ shell: bash
16
+ run: |
17
+ # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
18
+ rubocop | ruby -pe 'sub(/^(.+):(\d+):(\d+): (.): (.+)$/, %q{::error file=\1,line=\2,col=\3::\5})'
@@ -11,18 +11,12 @@ jobs:
11
11
  runs-on: "ubuntu-latest"
12
12
  strategy:
13
13
  matrix:
14
- container_tag:
15
- - 2.6-bionic
16
- - 2.7-bionic
17
- - master-nightly-bionic
18
- container:
19
- image: rubylang/ruby:${{ matrix.container_tag }}
14
+ ruby: [2.6, 2.7, head]
20
15
  steps:
21
- - uses: actions/checkout@v1
22
- - name: Run test
23
- run: |
24
- ruby -v
25
- gem install bundler
26
- bundle install --jobs 4 --retry 3
27
- bin/setup
28
- bundle exec rake build test
16
+ - uses: actions/checkout@v2
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - run: bundle install --jobs 4 --retry 3
21
+ - run: bin/setup
22
+ - run: bundle exec rake build test
@@ -0,0 +1,10 @@
1
+ require:
2
+ - rubocop-rubycw
3
+
4
+ AllCops:
5
+ DisabledByDefault: true
6
+ Exclude:
7
+ - test/data/**/*.rb
8
+
9
+ Rubycw/Rubycw:
10
+ Enabled: true
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.2.0 (2020-12-15)
6
+
7
+ * Relax Thor version requirements by @y-yagi ([#85](https://github.com/soutaro/querly/pull/85))
8
+ * Fix ERB comment preprocessing by @mallowlabs ([#84](https://github.com/soutaro/querly/pull/84))
9
+ * Better error message for Ruby code syntax error by @ybiquitous ([#83](https://github.com/soutaro/querly/pull/83))
10
+
5
11
  ## 1.1.0 (2020-05-17)
6
12
 
7
13
  * Fix invalid bytes sequence in UTF-8 error by @mallowlabs [#75](https://github.com/soutaro/querly/pull/75)
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  ![Querly logo](https://github.com/soutaro/querly/blob/master/logo/Querly%20horizontal.png)
2
+
2
3
  # Querly - Pattern Based Checking Tool for Ruby
3
4
 
4
- [![Build Status](https://travis-ci.org/soutaro/querly.svg?branch=master)](https://travis-ci.org/soutaro/querly)
5
+ ![Ruby](https://github.com/soutaro/querly/workflows/Ruby/badge.svg)
5
6
 
6
7
  Querly is a query language and tool to find out method calls from Ruby programs.
7
8
  Define rules to check your program with patterns to find out *bad* pieces.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ task :default => :test
11
11
  task :build => :racc
12
12
  task :test => :racc
13
13
 
14
- rule /\.rb/ => ".y" do |t|
14
+ rule %r/\.rb/ => ".y" do |t|
15
15
  sh "racc", "-v", "-o", "#{t.name}", "#{t.source}"
16
16
  end
17
17
 
@@ -46,7 +46,12 @@ module Querly
46
46
 
47
47
  def script_error(path, error)
48
48
  STDERR.puts Rainbow("Failed to load script: #{path}").red
49
- STDERR.puts error.inspect
49
+
50
+ if error.is_a? Parser::SyntaxError
51
+ STDERR.puts error.diagnostic.render
52
+ else
53
+ STDERR.puts error.inspect
54
+ end
50
55
  end
51
56
 
52
57
  def issue_found(script, rule, pair)
@@ -25,7 +25,7 @@ module Querly
25
25
  yield self
26
26
 
27
27
  children.each do |child|
28
- child.each_subpair &block
28
+ child.each_subpair(&block)
29
29
  end
30
30
  else
31
31
  enum_for :each_subpair
@@ -82,7 +82,8 @@ module Querly
82
82
 
83
83
  new_source = source.gsub(/./, ' ')
84
84
  parser.ast.descendants(:erb).each do |erb_node|
85
- _, _, code_node, = *erb_node
85
+ indicator_node, _, code_node, = *erb_node
86
+ next if indicator_node&.loc&.source == '#'
86
87
  new_source[code_node.loc.range] = code_node.loc.source
87
88
  new_source[code_node.loc.range.end] = ';'
88
89
  end
@@ -1,3 +1,3 @@
1
1
  module Querly
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "slim", "~> 4.0.1"
32
32
  spec.add_development_dependency "haml", "~> 5.0.4"
33
33
 
34
- spec.add_dependency 'thor', ">= 0.19.0", "< 0.21.0"
34
+ spec.add_dependency 'thor', ">= 0.19.0"
35
35
  spec.add_dependency "parser", ">= 2.5.0"
36
36
  spec.add_dependency "rainbow", ">= 2.1"
37
37
  spec.add_dependency "activesupport", ">= 5.0"
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: 1.1.0
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: 2020-05-16 00:00:00.000000000 Z
11
+ date: 2020-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,9 +129,6 @@ dependencies:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.19.0
132
- - - "<"
133
- - !ruby/object:Gem::Version
134
- version: 0.21.0
135
132
  type: :runtime
136
133
  prerelease: false
137
134
  version_requirements: !ruby/object:Gem::Requirement
@@ -139,9 +136,6 @@ dependencies:
139
136
  - - ">="
140
137
  - !ruby/object:Gem::Version
141
138
  version: 0.19.0
142
- - - "<"
143
- - !ruby/object:Gem::Version
144
- version: 0.21.0
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: parser
147
141
  requirement: !ruby/object:Gem::Requirement
@@ -209,9 +203,10 @@ executables:
209
203
  extensions: []
210
204
  extra_rdoc_files: []
211
205
  files:
206
+ - ".github/workflows/rubocop.yml"
212
207
  - ".github/workflows/ruby.yml"
213
208
  - ".gitignore"
214
- - ".travis.yml"
209
+ - ".rubocop.yml"
215
210
  - CHANGELOG.md
216
211
  - Gemfile
217
212
  - LICENSE
@@ -1,11 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.10
5
- - 2.5.8
6
- - 2.6.6
7
- - 2.7.1
8
- before_install: gem install bundler
9
- script:
10
- - bundle exec rake test
11
- - bundle exec querly test --config=sample.yaml