fasterer 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.fasterer.yml +2 -0
- data/README.md +12 -1
- data/lib/fasterer/analyzer.rb +1 -1
- data/lib/fasterer/file_traverser.rb +19 -5
- data/lib/fasterer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 606c81ada0fb247e236a2f92ae042f363b5f4cbf
|
4
|
+
data.tar.gz: 323879b3d6230968fd2207d41d85ac697700d1c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 444e1a9af93389bfe9a05adb3f03af1d689ee0f461ff35568a449493e4c85af73890fabf231e94341ae48d7e27611bf582fc9102e4286265d00e220d352c39ee
|
7
|
+
data.tar.gz: 496a9e543b07ef7cb190a765387391a2b1bc0c5dcfbc823f49cb735749d6ff48b1677efdc81404ee8665bf9b4d07633ca471d41df970a740257d0935b7f8d8e6
|
data/.fasterer.yml
CHANGED
data/README.md
CHANGED
@@ -46,7 +46,14 @@ Use tr instead of gsub when grepping plain strings. Occured at lines: 161.
|
|
46
46
|
```
|
47
47
|
## Configuration
|
48
48
|
|
49
|
-
|
49
|
+
Configuration is done through the **.fasterer.yml** file placed in the root of your project.
|
50
|
+
|
51
|
+
Options:
|
52
|
+
|
53
|
+
* Turn off speed suggestions
|
54
|
+
* Blacklist files or complete folder paths
|
55
|
+
|
56
|
+
Example:
|
50
57
|
|
51
58
|
|
52
59
|
```yaml
|
@@ -67,6 +74,10 @@ speedups:
|
|
67
74
|
block_vs_symbol_to_proc: true
|
68
75
|
proc_call_vs_yield: true
|
69
76
|
gsub_vs_tr: true
|
77
|
+
|
78
|
+
exclude_paths:
|
79
|
+
- 'vendor/**/*.rb'
|
80
|
+
- 'db/schema.rb'
|
70
81
|
```
|
71
82
|
|
72
83
|
## Speedups TODO:
|
data/lib/fasterer/analyzer.rb
CHANGED
@@ -9,12 +9,17 @@ module Fasterer
|
|
9
9
|
|
10
10
|
CONFIG_FILE_NAME = '.fasterer.yml'
|
11
11
|
|
12
|
-
|
12
|
+
SPEEDUPS_KEY = 'speedups'
|
13
|
+
|
14
|
+
EXCLUDE_PATHS_KEY = 'exclude_paths'
|
15
|
+
|
16
|
+
attr_reader :ignored_speedups, :ignored_paths
|
13
17
|
|
14
18
|
def initialize(path)
|
15
19
|
@path = Pathname(path)
|
16
20
|
@parse_error_paths = []
|
17
21
|
set_ignored_speedups
|
22
|
+
set_ignored_paths
|
18
23
|
end
|
19
24
|
|
20
25
|
def traverse
|
@@ -27,8 +32,14 @@ module Fasterer
|
|
27
32
|
end
|
28
33
|
|
29
34
|
def set_ignored_speedups
|
30
|
-
@ignored_speedups = if config_file
|
31
|
-
config_file[
|
35
|
+
@ignored_speedups = if config_file && config_file[SPEEDUPS_KEY]
|
36
|
+
config_file[SPEEDUPS_KEY].select {|_, value| value == false }.keys.map(&:to_sym)
|
37
|
+
end || []
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_ignored_paths
|
41
|
+
@ignored_paths = if config_file && config_file[EXCLUDE_PATHS_KEY]
|
42
|
+
config_file[EXCLUDE_PATHS_KEY].flat_map {|path| Dir[path] }
|
32
43
|
end || []
|
33
44
|
end
|
34
45
|
|
@@ -50,8 +61,11 @@ module Fasterer
|
|
50
61
|
end
|
51
62
|
|
52
63
|
def traverse_directory(path)
|
53
|
-
Dir["#{path}/**/*.rb"].each do |
|
54
|
-
|
64
|
+
Dir["#{path}/**/*.rb"].each do |ruby_file_path|
|
65
|
+
relative_ruby_file_path = Pathname(ruby_file_path).relative_path_from(path)
|
66
|
+
unless ignored_paths.include?(relative_ruby_file_path.to_s)
|
67
|
+
scan_file(relative_ruby_file_path)
|
68
|
+
end
|
55
69
|
end
|
56
70
|
end
|
57
71
|
|
data/lib/fasterer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fasterer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damir Svrtan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|