excellent 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/bin/excellent +6 -2
- data/lib/simplabs/excellent/checks/rails/instance_var_in_partial_check.rb +1 -1
- data/lib/simplabs/excellent/checks/rails/params_hash_in_view_check.rb +1 -1
- data/lib/simplabs/excellent/checks/rails/session_hash_in_view_check.rb +1 -1
- data/lib/simplabs/excellent/parsing/parser.rb +1 -1
- data/lib/simplabs/excellent.rb +1 -1
- metadata +3 -4
- data/lib/simplabs/excellent/command_line_runner.rb +0 -37
data/History.txt
CHANGED
data/bin/excellent
CHANGED
@@ -15,12 +15,16 @@ optparse = OptionParser.new do |opt|
|
|
15
15
|
puts optparse
|
16
16
|
exit
|
17
17
|
end
|
18
|
+
opt.on_tail('--version', '-v', 'Version') do
|
19
|
+
puts Simplabs::Excellent::VERSION
|
20
|
+
exit
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
optparse.parse!
|
21
25
|
|
22
|
-
target
|
23
|
-
paths
|
26
|
+
target = options[:output]
|
27
|
+
paths = ARGV.dup
|
24
28
|
|
25
29
|
if paths.empty?
|
26
30
|
puts "\n You must specify one or more directories to analyse, e.g.:\n"
|
@@ -23,7 +23,7 @@ module Simplabs
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def evaluate(context) #:nodoc:
|
26
|
-
add_warning(context, 'Instance variable {{variable}} used in partial.', { :variable => context.full_name }, RUBY_VERSION =~ /1\.
|
26
|
+
add_warning(context, 'Instance variable {{variable}} used in partial.', { :variable => context.full_name }, RUBY_VERSION =~ /1\.8/ ? 0 : -1)
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -24,7 +24,7 @@ module Simplabs
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def evaluate(context) #:nodoc:
|
27
|
-
add_warning(context, 'Params hash used in view.', {}, RUBY_VERSION =~ /1\.
|
27
|
+
add_warning(context, 'Params hash used in view.', {}, RUBY_VERSION =~ /1\.8/ ? 0 : -1) if (context.full_name == 'params')
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -24,7 +24,7 @@ module Simplabs
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def evaluate(context) #:nodoc:
|
27
|
-
add_warning(context, 'Session hash used in view.', {}, RUBY_VERSION =~ /1\.
|
27
|
+
add_warning(context, 'Session hash used in view.', {}, RUBY_VERSION =~ /1\.8/ ? 0 : -1) if (context.full_name == 'session')
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -19,7 +19,7 @@ module Simplabs
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def silent_parse(content, filename)
|
22
|
-
@parser ||= RubyParser.for_current_ruby
|
22
|
+
@parser ||= RUBY_VERSION =~ /2\.0/ ? Ruby19Parser.new : RubyParser.for_current_ruby
|
23
23
|
content = ::ERB.new(content, nil, '-').src if filename =~ /\.erb$/
|
24
24
|
sexp = @parser.parse(content, filename)
|
25
25
|
sexp
|
data/lib/simplabs/excellent.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excellent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 1.7.
|
9
|
+
- 1
|
10
|
+
version: 1.7.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marco Otte-Witte
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- lib/simplabs/excellent/checks/rails.rb
|
96
96
|
- lib/simplabs/excellent/checks/singleton_variable_check.rb
|
97
97
|
- lib/simplabs/excellent/checks.rb
|
98
|
-
- lib/simplabs/excellent/command_line_runner.rb
|
99
98
|
- lib/simplabs/excellent/extensions/sexp.rb
|
100
99
|
- lib/simplabs/excellent/extensions/string.rb
|
101
100
|
- lib/simplabs/excellent/formatters/base.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'simplabs/excellent/runner'
|
2
|
-
require 'simplabs/excellent/formatters'
|
3
|
-
|
4
|
-
module Simplabs
|
5
|
-
|
6
|
-
module Excellent
|
7
|
-
|
8
|
-
class CommandLineRunner < Runner #:nodoc:
|
9
|
-
|
10
|
-
def initialize(*checks)
|
11
|
-
super
|
12
|
-
@formatter = Formatters::Text.new
|
13
|
-
@formatter.start
|
14
|
-
end
|
15
|
-
|
16
|
-
def check_paths(paths)
|
17
|
-
paths.each do |path|
|
18
|
-
if File.file?(path)
|
19
|
-
check_file(path)
|
20
|
-
elsif File.directory?(path)
|
21
|
-
Dir.glob(File.join(path, '**/*.rb')).each { |file| check_file(file) }
|
22
|
-
else
|
23
|
-
next
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def check_file(filename)
|
29
|
-
super
|
30
|
-
@formatter.file(filename, (@checks || []).collect { |check| check.warnings }.flatten)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|