fasterer 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: b9a616ac05b430472ca9f256d14d39c8bca2b228
4
- data.tar.gz: 5dc6f2bd8f06edc6403141d0cbd6b5ae7cfeaf86
3
+ metadata.gz: dfd66e68a652e1bb32201285f8bd465013378659
4
+ data.tar.gz: a43b21900f515191b7350462c7c6bfc5a200dd89
5
5
  SHA512:
6
- metadata.gz: 0045bffa7b1096481147729775723e35a0a13a87b7d24911bc8f29cc37dafddb26cdb72c5c3c4573bc0e325be4d98c4a2089bfe8cd24b9636314db586a3396f2
7
- data.tar.gz: 2e98083140461533bcf3fe7b8effe878e89450840735dcdbb61e1ca43400cde92b5d1314130d7d09b2d666300b3712b98e669cd47b9213b23f550b918b673f6d
6
+ metadata.gz: c446f66a2ccb22546145c0f8a7641dfcd6f5ade08e13b70018ff6a99fdc26fcc7e06c03ae5ed4a98e7668a9acdda03270b6c80d7e8a8153eabac1f191d05903c
7
+ data.tar.gz: a0f3aecf7322e4636b7999ddfab352a0651b5d110389655348889c3fd7b355542564adb94581f826e2f4527ddf29387b0122e2857f8cec49aa58f7858a5e9a99
@@ -47,10 +47,14 @@ module Fasterer
47
47
  end
48
48
 
49
49
  def check_gsub_offense
50
- first_argument = method_call.arguments.first
51
- return if first_argument.nil?
50
+ first_argument = method_call.arguments[0]
51
+ second_argument = method_call.arguments[1]
52
+
53
+ return if first_argument.nil? || second_argument.nil?
54
+
55
+ if first_argument.value.is_a?(String) && first_argument.value.size == 1 &&
56
+ second_argument.value.is_a?(String) && second_argument.value.size == 1
52
57
 
53
- if first_argument.value.is_a?(String) && first_argument.value.size == 1
54
58
  add_offense(:gsub_vs_tr)
55
59
  end
56
60
  end
@@ -1,3 +1,3 @@
1
1
  module Fasterer
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -7,6 +7,6 @@ describe Fasterer::Analyzer do
7
7
  it 'should detect gsub 4 times' do
8
8
  analyzer = Fasterer::Analyzer.new(test_file_path)
9
9
  analyzer.scan
10
- expect(analyzer.errors[:gsub_vs_tr].count).to eq(4)
10
+ expect(analyzer.errors[:gsub_vs_tr].count).to eq(2)
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fasterer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damir Svrtan