skeptic 0.0.2 → 0.0.3
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.
- data/VERSION +1 -1
- data/lib/skeptic/rules/lines_per_method.rb +26 -3
- data/lib/skeptic/sexp_visitor.rb +3 -1
- data/skeptic.gemspec +83 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -33,9 +33,17 @@ module Skeptic
|
|
33
33
|
private
|
34
34
|
|
35
35
|
on :class do |name, parent, body|
|
36
|
-
class_name = [env[:
|
36
|
+
class_name = [env[:module], extract_name(name)].compact.join('::')
|
37
37
|
|
38
|
-
env.scoped :
|
38
|
+
env.scoped :module => class_name do
|
39
|
+
visit body
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
on :module do |name, body|
|
44
|
+
module_name = [env[:module], extract_name(name)].compact.join('::')
|
45
|
+
|
46
|
+
env.scoped :module => module_name do
|
39
47
|
visit body
|
40
48
|
end
|
41
49
|
end
|
@@ -48,7 +56,22 @@ module Skeptic
|
|
48
56
|
|
49
57
|
lines = env[:line_numbers].uniq.compact.length
|
50
58
|
|
51
|
-
full_name = "#{env[:
|
59
|
+
full_name = "#{env[:module]}##{env[:method]}"
|
60
|
+
@line_counts[full_name] = lines + @line_counts.fetch(full_name, 0)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
on :defs do |target, separator, name, params, body|
|
65
|
+
method_name = extract_name(name)
|
66
|
+
class_name = extract_name(target)
|
67
|
+
class_name = env[:module] if class_name == 'self'
|
68
|
+
|
69
|
+
env.scoped method: method_name, line_numbers: [] do
|
70
|
+
visit body
|
71
|
+
|
72
|
+
lines = env[:line_numbers].uniq.compact.length
|
73
|
+
|
74
|
+
full_name = "#{class_name}.#{method_name}"
|
52
75
|
@line_counts[full_name] = lines + @line_counts.fetch(full_name, 0)
|
53
76
|
end
|
54
77
|
end
|
data/lib/skeptic/sexp_visitor.rb
CHANGED
@@ -25,7 +25,7 @@ module Skeptic
|
|
25
25
|
type, *args = *sexp
|
26
26
|
handler = self.class.handlers[type]
|
27
27
|
|
28
|
-
with_sexp_type(type) { instance_exec
|
28
|
+
with_sexp_type(type) { instance_exec(*args, &handler) }
|
29
29
|
else
|
30
30
|
range = sexp[0].kind_of?(Symbol) ? 1..-1 : 0..-1
|
31
31
|
|
@@ -57,6 +57,8 @@ module Skeptic
|
|
57
57
|
when :var_ref then extract_name(first)
|
58
58
|
when :@const then first
|
59
59
|
when :@ident then first
|
60
|
+
when :@kw then first
|
61
|
+
when :@op then first
|
60
62
|
else '<unknown>'
|
61
63
|
end
|
62
64
|
end
|
data/skeptic.gemspec
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "skeptic"
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Stefan Kanev"]
|
12
|
+
s.date = "2012-10-25"
|
13
|
+
s.description = "An experimental, half-assed, bug-ridden and highly opinionated code analyzer."
|
14
|
+
s.email = "stefan.kanev@gmail.com"
|
15
|
+
s.executables = ["skeptic"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
".rvmrc",
|
24
|
+
"Gemfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/skeptic",
|
30
|
+
"features/skeptic.feature",
|
31
|
+
"lib/skeptic.rb",
|
32
|
+
"lib/skeptic/critic.rb",
|
33
|
+
"lib/skeptic/environment.rb",
|
34
|
+
"lib/skeptic/rule_table.rb",
|
35
|
+
"lib/skeptic/rules.rb",
|
36
|
+
"lib/skeptic/rules/check_syntax.rb",
|
37
|
+
"lib/skeptic/rules/line_length.rb",
|
38
|
+
"lib/skeptic/rules/lines_per_method.rb",
|
39
|
+
"lib/skeptic/rules/max_nesting_depth.rb",
|
40
|
+
"lib/skeptic/rules/methods_per_class.rb",
|
41
|
+
"lib/skeptic/rules/no_semicolons.rb",
|
42
|
+
"lib/skeptic/rules/no_trailing_whitespace.rb",
|
43
|
+
"lib/skeptic/scope.rb",
|
44
|
+
"lib/skeptic/sexp_visitor.rb",
|
45
|
+
"skeptic.gemspec"
|
46
|
+
]
|
47
|
+
s.homepage = "http://github.com/skanev/skeptic"
|
48
|
+
s.licenses = ["MIT"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = "1.8.24"
|
51
|
+
s.summary = "Skeptic points out annoying things in your code"
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
+
s.add_runtime_dependency(%q<trollop>, [">= 1.16.2"])
|
58
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<aruba>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<trollop>, [">= 1.16.2"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
67
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
68
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
69
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
70
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
71
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
72
|
+
end
|
73
|
+
else
|
74
|
+
s.add_dependency(%q<trollop>, [">= 1.16.2"])
|
75
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
76
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
77
|
+
s.add_dependency(%q<aruba>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
80
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skeptic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/skeptic/rules/no_trailing_whitespace.rb
|
157
157
|
- lib/skeptic/scope.rb
|
158
158
|
- lib/skeptic/sexp_visitor.rb
|
159
|
+
- skeptic.gemspec
|
159
160
|
homepage: http://github.com/skanev/skeptic
|
160
161
|
licenses:
|
161
162
|
- MIT
|
@@ -171,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
172
|
version: '0'
|
172
173
|
segments:
|
173
174
|
- 0
|
174
|
-
hash:
|
175
|
+
hash: -47347213712121151
|
175
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
177
|
none: false
|
177
178
|
requirements:
|