-
-
Save kevinclark/79314 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
require 'pp' | |
require 'rubygems' | |
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) | |
require 'dust' | |
# {Constant => {Method => [Warnings]}} | |
$warnings = Hash.new {|h,k| h[k] = Hash.new {|_h,_k| _h[_k] = [] }} | |
Dusters = [ | |
Dust::ArgumentDuster, Dust::BlockDuster, Dust::BranchDuster, | |
Dust::LocalVariableDuster, Dust::MethodDuster, Dust::RescueDuster | |
] | |
class Class | |
def method_added(name) | |
warnings = Dusters.map do |duster_class| | |
duster = duster_class.new(self, name) | |
duster.dust! | |
duster.warnings | |
end.flatten | |
$warnings[self][name] = warnings | |
end | |
end | |
at_exit do | |
# Prune empty classes and methods | |
$warnings.each do |klass, methods| | |
methods.each do |meth, warnings| | |
$warnings[klass].delete(meth) if warnings.empty? | |
end | |
$warnings.delete(klass) if $warnings[klass].empty? | |
end | |
$warnings.each do |klass, methods| | |
puts "#{klass}" | |
methods.each do |meth, warnings| | |
puts " #{meth}" | |
warnings.each do |w| | |
puts " - #{w.message}" | |
end | |
end | |
puts | |
end | |
end | |
ARGV.each {|file| load file } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REXML::Source | |
match_to | |
- The argument :char is unused. | |
read | |
- The method :read is empty. | |
match_to_consume | |
- The argument :char is unused. | |
Merb::AcceptType | |
synonyms | |
- An assigment is being used as a condition: (_mime = mime) | |
Erubis::Converter | |
convert_input | |
- The argument :input is unused. | |
- The argument :codebuf is unused. | |
OptionParser | |
complete | |
- One or more variable(s) are being shadowed (opt) | |
ver | |
- An assigment is being used as a condition: (v = release) | |
- An assigment is being used as a condition: (v = version) | |
make_switch | |
- One or more variable(s) are being shadowed (o) | |
- One or more variable(s) are being shadowed (o) | |
- The variable :n is unused. | |
visit | |
- One or more variable(s) are being shadowed (el) | |
permute! | |
- One or more variable(s) are being shadowed (arg) | |
parse_in_order | |
- An assigment is being used as a condition: (arg = catch(:terminate) do | |
while arg = argv.shift do | |
case arg | |
when /\A--([^=]*)(?:=(.*))?/mn then | |
opt, rest = $1, $2 | |
begin | |
sw = complete(:long, opt, true) | |
rescue ParseError | |
raise($!.set_option(arg, true)) | |
end | |
begin | |
(opt, cb, val = sw.parse(rest, argv) { |*exc| raise(*exc) } | |
val = cb.call(val) if cb | |
setter.call(sw.switch_name, val) if setter) | |
rescue ParseError | |
raise($!.set_option(arg, rest)) | |
end | |
when /\A-(.)((=).*|.+)?/mn then | |
opt, has_arg, eq, val, rest = $1, $3, $3, $2, $2 | |
begin | |
(sw = search(:short, opt) | |
unless sw then | |
begin | |
(sw = complete(:short, opt) | |
val = arg.sub(/\A-/, "") | |
has_arg = true) | |
rescue InvalidOption | |
sw = complete(:long, opt) | |
eq ||= (not rest) | |
end | |
end) | |
rescue ParseError | |
raise($!.set_option(arg, true)) | |
end | |
begin | |
(opt, cb, val = sw.parse(val, argv) { |*exc| raise(*exc) if eq } | |
if (has_arg and ((not eq) and (arg == "-#{opt}"))) then | |
raise(InvalidOption, arg) | |
end | |
argv.unshift(opt) if (opt and (not ((opt = opt.sub(/\A-*/, "-")) == "-"))) | |
val = cb.call(val) if cb | |
setter.call(sw.switch_name, val) if setter) | |
rescue ParseError | |
raise($!.set_option(arg, (arg.length > 2))) | |
end | |
else | |
catch(:prune) do | |
visit(:each_option) do |sw| | |
sw.block.call(arg) if (Switch.===(sw) and sw.match_nonswitch?(arg)) | |
end | |
nonopt.call(arg) | |
end | |
end | |
end | |
# do nothing | |
end) | |
- One or more variable(s) are being shadowed (arg) | |
- One or more variable(s) are being shadowed (sw) | |
- One or more variable(s) are being shadowed (sw) | |
OptionParser::Switch::OptionalArgument | |
parse | |
- The argument :argv is unused. | |
Merb::Router::Route | |
compile_param | |
- An assigment is being used as a condition: (place = @placeholders[placeholder_key]) | |
- An assigment is being used as a condition: (match = JUST_BRACKETS.match(value)) | |
- An assigment is being used as a condition: (match = SEGMENT_REGEXP_WITH_BRACKETS.match(value)) | |
compile_conditions | |
- An assigment is being used as a condition: (path = compile_path(path)) | |
deferred_condition_statement | |
- An assigment is being used as a condition: (current = deferred.first) | |
condition_statements | |
- An assigment is being used as a condition: (first = @deferred_procs.first) | |
Merb::Router::Route::Generator | |
with | |
- The argument :block is unused. | |
- A block is being yielded to without a check for block_given? | |
Merb::ResponderMixin | |
_perform_content_negotiation | |
- An assigment is being used as a condition: (fmt = params[:format]) | |
Erubis::Generator | |
add_preamble | |
- The argument :src is unused. | |
add_expr_debug | |
- The argument :code is unused. | |
- The argument :src is unused. | |
add_postamble | |
- The argument :src is unused. | |
add_text | |
- The argument :text is unused. | |
- The argument :src is unused. | |
add_expr_literal | |
- The argument :code is unused. | |
- The argument :src is unused. | |
escape_text | |
- The argument :text is unused. | |
add_expr_escaped | |
- The argument :code is unused. | |
- The argument :src is unused. | |
add_stmt | |
- The argument :code is unused. | |
- The argument :src is unused. | |
Erubis::BiPatternEnhancer | |
initialize | |
- The argument :input is unused. | |
OptionParser::Completion | |
complete | |
- One or more variable(s) are being shadowed (v,k) | |
- One or more variable(s) are being shadowed (v,k) | |
- One or more variable(s) are being shadowed (v,k) | |
convert | |
- The argument :opt is unused. | |
OptionParser::Switch::NoArgument | |
parse | |
- The argument :argv is unused. | |
SimpleDelegator | |
dup | |
- The argument :obj is unused. | |
Erubis::Evaluator | |
evaluate | |
- The argument :args is unused. | |
result | |
- The argument :args is unused. | |
Merb::AbstractController | |
capture | |
- The argument :block is unused. | |
- A block is being yielded to without a check for block_given? | |
- One or more variable(s) are being shadowed (args) | |
_template_location | |
- The argument :type is unused. | |
initialize | |
- The argument :args is unused. | |
_absolute_template_location | |
- The argument :type is unused. | |
Erubis::PI::Converter | |
convert_input | |
- No need for an if. Just return '(stmt and rspace)' as a boolean. | |
LazyArray | |
respond_to? | |
- The argument :include_private is unused. | |
Merb::Request | |
dispatch_exception | |
- An assigment is being used as a condition: (action_name = e.action_name) | |
- A rescue is capturing Object or Exception, which may hide errors. | |
handle | |
- A rescue is capturing Object or Exception, which may hide errors. | |
if_modified_since | |
- An assigment is being used as a condition: (time = @env[Merb::Const::HTTP_IF_MODIFIED_SINCE]) | |
controller | |
- The variable :e is unused. | |
REXML::Encoding | |
encoding= | |
- A rescue is capturing Object or Exception, which may hide errors. | |
Merb::Router::Behavior | |
with_behavior_context | |
- The argument :block is unused. | |
- The variable :retval is unused. | |
to_route | |
- An assigment is being used as a condition: (prefixes = @options[:controller_prefix]) | |
- An assigment is being used as a condition: (before = (@options[:before] and @options[:before].last)) | |
Erubis::HeaderFooterEnhancer | |
convert | |
- The argument :input is unused. | |
Erubis::NoCodeEnhancer | |
add_preamble | |
- The argument :src is unused. | |
- The method :add_preamble is empty. | |
add_postamble | |
- The argument :src is unused. | |
- The method :add_postamble is empty. | |
add_expr | |
- The argument :indicator is unused. | |
Merb::Worker | |
process_queue | |
- A rescue is capturing Object or Exception, which may hide errors. | |
Merb::Template::Erubis::Mixin | |
concat_erb | |
- The argument :binding is unused. | |
OptionParser::List | |
search | |
- An assigment is being used as a condition: (list = __send__(id)) | |
update | |
- One or more variable(s) are being shadowed (o) | |
- One or more variable(s) are being shadowed (o) | |
- One or more variable(s) are being shadowed (o) | |
- One or more variable(s) are being shadowed (o) | |
Merb::RenderMixin | |
display | |
- The variable :_ is unused. | |
render | |
- An assigment is being used as a condition: (layout = _get_layout(opts[:layout])) | |
_template_for | |
- An assigment is being used as a condition: (template_method = _template_method_for(template_location.to_s, locals)) | |
partial | |
- An assigment is being used as a condition: (m = template.match(/.*(?=\/)/)) | |
REXML::IOSource | |
scan | |
- The argument :cons is unused. | |
read | |
- A rescue is capturing Object or Exception, which may hide errors. | |
initialize | |
- The argument :block_size is unused. | |
Erubis::PrintOutEnhancer | |
add_preamble | |
- The argument :src is unused. | |
- The method :add_preamble is empty. | |
Pathname | |
has_trailing_separator? | |
- An assigment is being used as a condition: (r = chop_basename(path)) | |
descend | |
- A block is being yielded to without a check for block_given? | |
each_entry | |
- The argument :block is unused. | |
- A block is being yielded to without a check for block_given? | |
each_filename | |
- A block is being yielded to without a check for block_given? | |
- The variable :prefix is unused. | |
relative? | |
- The variable :basename is unused. | |
find | |
- The argument :block is unused. | |
plus | |
- An assigment is being used as a condition: (r1 = chop_basename(prefix1)) | |
del_trailing_separator | |
- An assigment is being used as a condition: (r = chop_basename(path)) | |
ascend | |
- A block is being yielded to without a check for block_given? | |
- A block is being yielded to without a check for block_given? | |
- The variable :name is unused. | |
String | |
margin | |
- The argument :indicator is unused. | |
REXML::UndefinedNamespaceException | |
initialize | |
- The argument :source is unused. | |
- The argument :parser is unused. | |
OptionParser::Switch | |
summarize | |
- A block is being yielded to without a check for block_given? | |
- A block is being yielded to without a check for block_given? | |
- One or more variable(s) are being shadowed (s) | |
- One or more variable(s) are being shadowed (s) | |
- One or more variable(s) are being shadowed (s) | |
- One or more variable(s) are being shadowed (s) | |
parse_arg | |
- A block is being yielded to without a check for block_given? | |
- An assigment is being used as a condition: (m = pattern.match(arg)) | |
conv_arg | |
- One or more variable(s) are being shadowed (val) | |
Erubis::Context | |
each | |
- A block is being yielded to without a check for block_given? | |
Hash | |
normalize_param | |
- One or more variable(s) are being shadowed (key,value) | |
unprotect_keys! | |
- A rescue is returning "nil" directly and may not handle an error. | |
Dictionary | |
each_pair | |
- A block is being yielded to without a check for block_given? | |
each_value | |
- A block is being yielded to without a check for block_given? | |
each | |
- A block is being yielded to without a check for block_given? | |
each_key | |
- A block is being yielded to without a check for block_given? | |
Erubis::RubyGenerator | |
init_generator | |
- The argument :properties is unused. | |
REXML::Light::Node | |
text= | |
- The argument :foo is unused. | |
namespace_of | |
- The argument :node is unused. | |
to_s | |
- The method :to_s is empty. | |
each | |
- The argument :block is unused. | |
- A block is being yielded to without a check for block_given? | |
Merb::Logger | |
warn! | |
- A block is being yielded to without a check for block_given? | |
info! | |
- A block is being yielded to without a check for block_given? | |
debug | |
- A block is being yielded to without a check for block_given? | |
debug! | |
- A block is being yielded to without a check for block_given? | |
error | |
- A block is being yielded to without a check for block_given? | |
fatal! | |
- A block is being yielded to without a check for block_given? | |
fatal | |
- A block is being yielded to without a check for block_given? | |
info | |
- A block is being yielded to without a check for block_given? | |
error! | |
- A block is being yielded to without a check for block_given? | |
warn | |
- A block is being yielded to without a check for block_given? | |
OptionParser::Arguable | |
options= | |
- An assigment is being used as a condition: (@optparse = opt) | |
options | |
- A block is being yielded to without a check for block_given? | |
initialize | |
- The argument :args is unused. | |
Kernel | |
load_dependency | |
- An assigment is being used as a condition: (block = dep.require_block) | |
__profile__ | |
- A block is being yielded to without a check for block_given? | |
__caller_info__ | |
- The variable :meth is unused. | |
- The variable :line is unused. | |
- The variable :file is unused. | |
Erubis::Basic::Converter | |
convert_input | |
- No need for an if. Just return 'rspace' as a boolean. | |
Merb::Router::Resources | |
resources | |
- An assigment is being used as a condition: (klass = Object.full_const_get(klass_name)) | |
- The variable :e is unused. | |
Erubis::InterpolationEnhancer | |
convert_input | |
- No need for an if. Just return 'rspace' as a boolean. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clio:dust kev$ ./bin/dust ../glu.ttono.us/app.rb | |
Scanf::FormatSpecifier | |
nil_proc | |
- The argument :s is unused. | |
- The method :nil_proc is empty. | |
Sinatra::Default | |
invoke | |
- The argument :block is unused. | |
URI::Generic | |
absolute | |
- No need for an if. Just return '@scheme' as a boolean. | |
absolute? | |
- No need for an if. Just return '@scheme' as a boolean. | |
hierarchical? | |
- No need for an if. Just return '@path' as a boolean. | |
CodeRay::Scanners::Ruby | |
scan_tokens | |
- The argument :options is unused. | |
- An assigment is being used as a condition: (esc = scan(/ #{patterns::ESCAPE} /o)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::CLASS_VARIABLE}/o)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::GLOBAL_VARIABLE}/o)) | |
- An assigment is being used as a condition: (match = scan(/`/)) | |
- An assigment is being used as a condition: (match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)) | |
- An assigment is being used as a condition: (match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::SYMBOL}/o)) | |
- An assigment is being used as a condition: (match = if value_expected then | |
scan(/[-+]?#{patterns::NUMERIC}/o) | |
else | |
scan(/#{patterns::NUMERIC}/o) | |
end) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::INSTANCE_VARIABLE}/o)) | |
- An assigment is being used as a condition: (match = scan(/ ['"] /mx)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::METHOD_NAME}/o)) | |
- An assigment is being used as a condition: (match = scan(/(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/o)) | |
- An assigment is being used as a condition: (match = scan(/ (?:#{patterns::IDENT}::)* #{patterns::IDENT} /o)) | |
- An assigment is being used as a condition: (match = scan(/<</)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::SYMBOL}/o)) | |
- An assigment is being used as a condition: (match = scan(/#{patterns::METHOD_NAME_EX}/o)) | |
- An assigment is being used as a condition: (match = scan(/(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/o)) | |
- An assigment is being used as a condition: (match = scan(/,/)) | |
- An assigment is being used as a condition: (match = scan(/\\?\n/)) | |
- An assigment is being used as a condition: (match = scan(/[ \t\f]+/)) | |
CodeRay::Scanners::Scanner | |
setup | |
- The method :setup is empty. | |
scan_tokens | |
- The argument :options is unused. | |
- The argument :tokens is unused. | |
Rack::File | |
each | |
- A block is being yielded to without a check for block_given? | |
serving | |
- An assigment is being used as a condition: (size = F.size?(@path)) | |
Sinatra::Request | |
params | |
- The variable :boom is unused. | |
OpenStruct | |
initialize_copy | |
- The argument :orig is unused. | |
Sinatra::Helpers::StaticFile | |
each | |
- A block is being yielded to without a check for block_given? | |
SimpleDelegator | |
dup | |
- The argument :obj is unused. | |
Sinatra::Base | |
error_block! | |
- An assigment is being used as a condition: (block = errmap[key]) | |
route! | |
- An assigment is being used as a condition: (match = pattern.match(path)) | |
- An assigment is being used as a condition: (routes = self.class.routes[@request.request_method]) | |
Rack::Response | |
initialize | |
- The argument :block is unused. | |
Object | |
sinatra_warn | |
- One or more variable(s) are being shadowed (line) | |
CodeRay::Encoders::HTML | |
token | |
- An assigment is being used as a condition: (style = @css_style[@opened]) | |
finish | |
- The variable :not_needed is unused. | |
CodeRay::Encoders::HTML::CSS | |
[] | |
- An assigment is being used as a condition: (style = cl[styles[(offset..-1)]]) | |
CodeRay::Scanners::Ruby::Patterns::StringState | |
initialize | |
- An assigment is being used as a condition: (paren = CLOSING_PAREN[delim]) | |
Sinatra::ServerError | |
initialize | |
- The argument :block is unused. | |
- The argument :args is unused. | |
CodeRay::Tokens | |
each_text_token | |
- A block is being yielded to without a check for block_given? | |
String | |
block_scanf | |
- The argument :b is unused. | |
IO | |
scanf | |
- A rescue is returning "0" directly and may not handle an error. | |
block_scanf | |
- A block is being yielded to without a check for block_given? | |
CodeRay::Encoders::Encoder | |
compile | |
- The argument :options is unused. | |
setup | |
- The argument :options is unused. | |
finish | |
- The argument :options is unused. | |
text_token | |
- The argument :text is unused. | |
- The argument :kind is unused. | |
- The method :text_token is empty. | |
Rack::Request | |
params | |
- The variable :e is unused. | |
ip | |
- An assigment is being used as a condition: (addr = @env["HTTP_X_FORWARDED_FOR"]) | |
Clio:dust kev$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment