fasterer 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +2 -7
- data/lib/fasterer/scanners/method_call_scanner.rb +4 -1
- data/lib/fasterer/version.rb +1 -1
- data/spec/support/analyzer/24_gsub_vs_tr.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5326a0412657a2db9c2b84efad1a746aaf21f476
|
4
|
+
data.tar.gz: c04d001a94792fdcee7ea2fd31f5bf58f0d1048a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d37d2a91589c7c9d89eb2e7edfeda0f7c89824c37c2871e2f50b111b83cf40a5ee2fa22034df6837b969da5129aa769e11a61331ea1fa20d9f7c3715599a0942
|
7
|
+
data.tar.gz: f2055f3eb1d3473ed18d14a9e461bae2600b1dca20e447460b8f2da63a46315e0f59496cf479f1f90678e9951381395d5913f624b8012a2572f7ed2a48c78f7e
|
data/README.md
CHANGED
@@ -45,7 +45,7 @@ Use tr instead of gsub when grepping plain strings. Occured at lines: 161.
|
|
45
45
|
```
|
46
46
|
## Configuration
|
47
47
|
|
48
|
-
You can turn
|
48
|
+
You can turn off speed suggestions with a simple yaml file called **.fasterer.yml** in the root of your project. Example:
|
49
49
|
|
50
50
|
|
51
51
|
```yaml
|
@@ -68,7 +68,7 @@ speedups:
|
|
68
68
|
gsub_vs_tr: true
|
69
69
|
```
|
70
70
|
|
71
|
-
##
|
71
|
+
## Speedups TODO:
|
72
72
|
|
73
73
|
4. find vs bsearch
|
74
74
|
5. Array#count vs Array#size
|
@@ -79,11 +79,6 @@ speedups:
|
|
79
79
|
22. String#match vs String#start_with?/String#end_with?
|
80
80
|
23. String#gsub vs String#sub
|
81
81
|
|
82
|
-
# New
|
83
|
-
|
84
|
-
values each -> each_value
|
85
|
-
class_eval
|
86
|
-
|
87
82
|
## Contributing
|
88
83
|
|
89
84
|
1. Fork it ( https://github.com/DamirSvrtan/fasterer/fork )
|
@@ -47,7 +47,10 @@ module Fasterer
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def check_gsub_offense
|
50
|
-
|
50
|
+
first_argument = method_call.arguments.first
|
51
|
+
return if first_argument.nil?
|
52
|
+
|
53
|
+
if first_argument.value.is_a?(String) && first_argument.value.size == 1
|
51
54
|
add_offense(:gsub_vs_tr)
|
52
55
|
end
|
53
56
|
end
|
data/lib/fasterer/version.rb
CHANGED