debride 1.5.1 → 1.6.0

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
  SHA1:
3
- metadata.gz: 940626014070c225b026dfb66c2447942dc3b3e1
4
- data.tar.gz: bae7f08f057b29e7045d1641b6ee69466127e0c5
3
+ metadata.gz: 82b0f1e06d3647db71770771357949a6b602f2eb
4
+ data.tar.gz: b8dd7fb4af36fd5742baef9a041763aed58e5ccb
5
5
  SHA512:
6
- metadata.gz: 78711d1f9bb7e3076fd4c8d0513fa15636039b76efbe8a92616fd50ff2b4f224e1c38ad5a75d15704e8151866fa1807a83cf6af8dd50c9a802a61af9b6b4b521
7
- data.tar.gz: 6fabb380cc55ff7b23d1cb8e1da189ac1ff2187bffb7f23fc1e3a19f6f0f1f6016b68de6f4cbdc4138c8c79791b8049238412fa17b08c18fcfa9e2817f639809
6
+ metadata.gz: 24628c05032af7f7f86dcd53ee0f67d73061b80d94c291d794edb3731e9cc2c9e697918d7ee5818358d26b5e13b0082e15e44cf2174bd3fc3c5def8b71aa42d3
7
+ data.tar.gz: 38725e26ec1f5b696c9f02299e7625e40d009c813cde75a3c634ead60f85d0343310589d0478c618ea4aa038d9ce165605abb9551d0c397bc63965641b0b26a0
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,13 @@
1
+ === 1.6.0 / 2016-05-15
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Switched to path_expander to deal with cmdline args. See path_expander for details.
6
+
7
+ * 1 bug fix:
8
+
9
+ * Fixed confusing crasher when a plugin raises an exception. (phiggins)
10
+
1
11
  === 1.5.1 / 2015-08-10
2
12
 
3
13
  * 1 bug fix:
@@ -14,6 +14,10 @@ Analyze code for potentially uncalled / dead methods.
14
14
  * Whitelisting known good methods by name or regexp.
15
15
  * Use --rails for Rails-specific domain knowledge.
16
16
  * Use `debride_rails_whitelist` to generate an emperical whitelist from logs.
17
+ * Uses path_expander, so you can use:
18
+ * dir_arg -- expand a directory automatically
19
+ * @file_of_args -- persist arguments in a file
20
+ * -path_to_subtract -- ignore intersecting subsets of files/directories
17
21
 
18
22
  == SYNOPSIS:
19
23
 
@@ -44,10 +48,13 @@ You can also use regexps in your whitelist by delimiting them with //'s.
44
48
 
45
49
  debride-erb :: Extends debride to analyze erb files (via erubis ala rails).
46
50
  debride-haml :: Plugin to allow debride to parse Haml files.
51
+ debride-curly :: A plugin for the Curly templating language
47
52
 
48
53
  == REQUIREMENTS:
49
54
 
50
- * ruby 1.8+
55
+ * sexp_processor
56
+ * ruby_parser
57
+ * path_expander
51
58
 
52
59
  == INSTALL:
53
60
 
data/Rakefile CHANGED
@@ -3,6 +3,13 @@
3
3
  require "rubygems"
4
4
  require "hoe"
5
5
 
6
+ Hoe::add_include_dirs("../../sexp_processor/dev/lib",
7
+ "../../ruby_parser/dev/lib",
8
+ "../../ruby2ruby/dev/lib",
9
+ "../../ZenTest/dev/lib",
10
+ "../../path_expander/dev/lib",
11
+ "lib")
12
+
6
13
  Hoe.plugin :isolate
7
14
  Hoe.plugin :seattlerb
8
15
  Hoe.plugin :rdoc
@@ -13,26 +20,36 @@ Hoe.spec "debride" do
13
20
 
14
21
  dependency "sexp_processor", "~> 4.5"
15
22
  dependency "ruby_parser", "~> 3.6"
23
+ dependency "path_expander", "~> 1.0"
16
24
  end
17
25
 
18
- def run dir, wl
26
+ def run dir, whitelist
27
+ abort "Specify dir to scan with D=<path>" unless dir
28
+
19
29
  ENV["GEM_HOME"] = "tmp/isolate/ruby-2.0.0"
20
30
  ENV["GEM_PATH"] = "../../debride-erb/dev/tmp/isolate/ruby-2.0.0"
21
- verbose = ENV["V"] ? "-v" : ""
22
31
 
23
- abort "Specify dir to scan with D=<path>" unless dir
24
- wl = "--whitelist #{wl}" if wl
32
+ whitelist = whitelist && ["--whitelist", whitelist]
33
+ verbose = ENV["V"] && "-v"
34
+
35
+ require "debride"
25
36
 
26
- ruby "-Ilib:../../debride-erb/dev/lib bin/debride --rails #{verbose} #{dir} #{wl}"
37
+ args = ["--rails", verbose, whitelist, dir].flatten.compact
38
+
39
+ Debride.run(args).report
27
40
  end
28
41
 
29
- task :run do
42
+ task :run => :isolate do
30
43
  run ENV["D"], ENV["W"]
31
44
  end
32
45
 
33
- task :rails do
34
- d = "~/Work/git/seattlerb.org"
35
- run "#{d}/{app,lib,config}", "#{d}/whitelist.txt"
46
+ task :rails => :isolate do
47
+ ENV["GEM_HOME"] = "tmp/isolate/ruby-2.0.0"
48
+ ENV["GEM_PATH"] = "../../debride-erb/dev/tmp/isolate/ruby-2.0.0"
49
+
50
+ d = File.expand_path "~/Work/git/seattlerb.org"
51
+
52
+ run d, "#{d}/whitelist.txt"
36
53
  end
37
54
 
38
55
  task :debug do
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/ruby -w
2
2
 
3
- require "ruby_parser"
4
- require "sexp_processor"
5
3
  require "optparse"
6
4
  require "set"
5
+ require "stringio"
6
+
7
+ require "ruby_parser"
8
+ require "sexp_processor"
9
+ require "path_expander"
7
10
 
8
11
  # :stopdoc:
9
12
  class File
@@ -19,21 +22,9 @@ end
19
22
  # A static code analyzer that points out possible dead methods.
20
23
 
21
24
  class Debride < MethodBasedSexpProcessor
22
- VERSION = "1.5.1" # :nodoc:
25
+ VERSION = "1.6.0" # :nodoc:
23
26
  PROJECT = "debride"
24
27
 
25
- def self.expand_dirs_to_files *dirs # TODO: push back up to sexp_processor
26
- extensions = self.file_extensions
27
-
28
- dirs.flatten.map { |p|
29
- if File.directory? p then
30
- Dir[File.join(p, "**", "*.{#{extensions.join(",")}}")]
31
- else
32
- p
33
- end
34
- }.flatten.map { |s| s.sub(/^\.\//, "") } # strip "./" from paths
35
- end
36
-
37
28
  def self.load_plugins proj = PROJECT
38
29
  unless defined? @@plugins then
39
30
  @@plugins = []
@@ -47,7 +38,7 @@ class Debride < MethodBasedSexpProcessor
47
38
  begin
48
39
  load plugin
49
40
  @@plugins << plugin_name
50
- rescue LoadError => e
41
+ rescue RuntimeError, LoadError => e
51
42
  warn "error loading #{plugin.inspect}: #{e.message}. skipping..."
52
43
  end
53
44
  end
@@ -55,7 +46,7 @@ class Debride < MethodBasedSexpProcessor
55
46
 
56
47
  @@plugins
57
48
  rescue
58
- # ignore
49
+ []
59
50
  end
60
51
 
61
52
  def self.file_extensions
@@ -70,8 +61,12 @@ class Debride < MethodBasedSexpProcessor
70
61
 
71
62
  debride = Debride.new opt
72
63
 
73
- files = expand_dirs_to_files(args)
74
- files -= expand_dirs_to_files(debride.option[:exclude]) if debride.option[:exclude]
64
+ extensions = self.file_extensions
65
+ glob = "**/*.{#{extensions.join(",")}}"
66
+ expander = PathExpander.new(args, glob)
67
+ files = expander.process
68
+ excl = debride.option[:exclude]
69
+ files = expander.filter_files files, StringIO.new(excl.join "\n") if excl
75
70
 
76
71
  debride.run(files)
77
72
  debride
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debride
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgm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D3CJ8Q7sDqSy
30
+ NLq5jm1fq6Y9Uolu3RJbmycf
31
31
  -----END CERTIFICATE-----
32
- date: 2015-08-10 00:00:00.000000000 Z
32
+ date: 2016-05-15 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -60,19 +60,19 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.6'
62
62
  - !ruby/object:Gem::Dependency
63
- name: minitest
63
+ name: path_expander
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '5.8'
69
- type: :development
68
+ version: '1.0'
69
+ type: :runtime
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '5.8'
75
+ version: '1.0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rdoc
78
78
  requirement: !ruby/object:Gem::Requirement
@@ -93,14 +93,14 @@ dependencies:
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '3.13'
96
+ version: '3.15'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: '3.13'
103
+ version: '3.15'
104
104
  description: Analyze code for potentially uncalled / dead methods.
105
105
  email:
106
106
  - ryand-ruby@zenspider.com
@@ -114,7 +114,6 @@ extra_rdoc_files:
114
114
  - README.rdoc
115
115
  files:
116
116
  - .autotest
117
- - .gemtest
118
117
  - History.rdoc
119
118
  - Manifest.txt
120
119
  - README.rdoc
metadata.gz.sig CHANGED
Binary file
data/.gemtest DELETED
File without changes