rbr 0.3.2 → 0.3.4

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
  SHA256:
3
- metadata.gz: 8b7d0b6b8d0cf90f5663842f750f2a54aca82bbeac46ab4ba6c542889a1dea98
4
- data.tar.gz: f54146ad71167e7dd56d4038457c7388f130e67d539c179490f5ee773b642e1a
3
+ metadata.gz: 5c0e7a109d2816ccffdfaae67030e2b2fdf05ec174f4eed9a3bddfee349a8f25
4
+ data.tar.gz: 19b465b803e994d549ba2eaa5944d7ca4548fccbe98b54fa917c622fa25a0354
5
5
  SHA512:
6
- metadata.gz: ab183917580958f97adfbd4e2144f501561c16eb4e330f0c0c806f33407d6402cb3fe87cc85f393f3083ab35dc975cb2ed6e5636cdc430b0b47c5e01ed2e11f3
7
- data.tar.gz: 2cf02448bf77d5c58f8f7f6d68067085ec424d723d7a5515254ba50975e687b2f19681f65a30a1b8fa717b9a2ac392ea2ec2a0bbe0fca73662186f877581355c
6
+ metadata.gz: cb66285e2b739e5cfbb7531785c21d14aa0568a2a96fa1f991d7ab84e19fbc305dd5f89939e88641d2a39fbcf1de07218693db49572141b8404e59f8cc32fa95
7
+ data.tar.gz: 5ddc4afc2a09a1cd4ee462d2dded97a919609ad117f16c612868ea25e27e43ca25cbdb4090a05ee1d5b4816a07331bd220537766cc37040afd82a64e6ae1f176
data/.rubocop.yml CHANGED
@@ -5,7 +5,6 @@ require:
5
5
 
6
6
  AllCops:
7
7
  NewCops: enable
8
- TargetRubyVersion: 2.6
9
8
  Exclude:
10
9
  - "test/fixtures/*"
11
10
 
data/README.md CHANGED
@@ -50,7 +50,7 @@ This differs from a file contents search (like grep) in that rbr understands Rub
50
50
  test/fixtures/book.rb:50: book.send(:great_method)
51
51
  ```
52
52
 
53
- - Find all statements that update an ActiveRecord model attribute named `title`.
53
+ - Find statements that update an ActiveRecord model attribute named `title`.
54
54
 
55
55
  ```sh
56
56
  $ rbr ar_update :title test/fixtures/book.rb
@@ -59,6 +59,16 @@ This differs from a file contents search (like grep) in that rbr understands Rub
59
59
  test/fixtures/book.rb:31: book.send(:update_column, :title, "Great Title")
60
60
  ```
61
61
 
62
+ Note that this matcher is necessarily incomplete. For example, a parser alone cannot find situations like the following.
63
+
64
+ ```ruby
65
+ def update_record(attrs)
66
+ record.update(attrs)
67
+ end
68
+
69
+ update_record(title: "Great Author")
70
+ ```
71
+
62
72
  ### rbr is the *wrong tool* for the following situations:
63
73
 
64
74
  - Find all appearance of "author" in a codebase.
data/TODO CHANGED
@@ -1 +1,5 @@
1
- not_str matcher
1
+ new matchers:
2
+ not string
3
+ raw SQL updates
4
+ text in an if/unless condition
5
+ symbol or string
data/lib/rbr/matchers.rb CHANGED
@@ -102,7 +102,7 @@ module Rbr
102
102
  end
103
103
 
104
104
  private_class_method def self.ar_update_hash_element(node, name)
105
- node.method_call?(:[]=) && node.children[-2].value == name
105
+ node.method_call?(:[]=) && node.children[-2].is_a?(Node) && node.children[-2].value == name
106
106
  end
107
107
  end
108
108
  end
data/lib/rbr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rbr
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.4"
5
5
  end
data/rbr.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
25
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|LICENSE)/}) }
27
27
  end
28
28
  spec.bindir = "exe"
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddie Lebow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 3.2.3
116
+ rubygems_version: 3.5.3
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Semantically-aware code search tool for Ruby