code_analyzer 0.1.0
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/.gitignore +17 -0
- data/.rspec +2 -0
- data/.rvmrc +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/code_analyzer.gemspec +20 -0
- data/lib/code_analyzer.rb +11 -0
- data/lib/code_analyzer/analyzer_exception.rb +3 -0
- data/lib/code_analyzer/checker.rb +90 -0
- data/lib/code_analyzer/checking_visitor.rb +7 -0
- data/lib/code_analyzer/checking_visitor/default.rb +59 -0
- data/lib/code_analyzer/checking_visitor/plain.rb +17 -0
- data/lib/code_analyzer/nil.rb +35 -0
- data/lib/code_analyzer/sexp.rb +836 -0
- data/lib/code_analyzer/version.rb +3 -0
- data/lib/code_analyzer/warning.rb +19 -0
- data/spec/code_analyzer/checker_spec.rb +64 -0
- data/spec/code_analyzer/checking_visitor/default_spec.rb +42 -0
- data/spec/code_analyzer/checking_visitor/plain_spec.rb +18 -0
- data/spec/code_analyzer/nil_spec.rb +37 -0
- data/spec/code_analyzer/sexp_spec.rb +622 -0
- data/spec/code_analyzer/warning_spec.rb +12 -0
- data/spec/spec_helper.rb +14 -0
- metadata +110 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module CodeAnalyzer
|
4
|
+
describe Warning do
|
5
|
+
it "should return error with filename, line number and message" do
|
6
|
+
Warning.new(
|
7
|
+
filename: "app/models/user.rb",
|
8
|
+
line_number: "100",
|
9
|
+
message: "not good").to_s.should == "app/models/user.rb:100 - not good"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'code_analyzer'
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.filter_run focus: true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse_content(content)
|
13
|
+
Sexp.from_array(Ripper::SexpBuilder.new(content).parse)[1]
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: code_analyzer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Richard Huang
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sexp_processor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: a code analyzer tool which extracted from rails_best_practices, it helps
|
47
|
+
you easily build your own code analyzer tool.
|
48
|
+
email:
|
49
|
+
- flyerhzm@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- .rspec
|
56
|
+
- .rvmrc
|
57
|
+
- Gemfile
|
58
|
+
- LICENSE
|
59
|
+
- README.md
|
60
|
+
- Rakefile
|
61
|
+
- code_analyzer.gemspec
|
62
|
+
- lib/code_analyzer.rb
|
63
|
+
- lib/code_analyzer/analyzer_exception.rb
|
64
|
+
- lib/code_analyzer/checker.rb
|
65
|
+
- lib/code_analyzer/checking_visitor.rb
|
66
|
+
- lib/code_analyzer/checking_visitor/default.rb
|
67
|
+
- lib/code_analyzer/checking_visitor/plain.rb
|
68
|
+
- lib/code_analyzer/nil.rb
|
69
|
+
- lib/code_analyzer/sexp.rb
|
70
|
+
- lib/code_analyzer/version.rb
|
71
|
+
- lib/code_analyzer/warning.rb
|
72
|
+
- spec/code_analyzer/checker_spec.rb
|
73
|
+
- spec/code_analyzer/checking_visitor/default_spec.rb
|
74
|
+
- spec/code_analyzer/checking_visitor/plain_spec.rb
|
75
|
+
- spec/code_analyzer/nil_spec.rb
|
76
|
+
- spec/code_analyzer/sexp_spec.rb
|
77
|
+
- spec/code_analyzer/warning_spec.rb
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
homepage: https://github.com/flyerhzm/code_analyzer
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.24
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: a code analyzer helps you build your own code analyzer tool.
|
103
|
+
test_files:
|
104
|
+
- spec/code_analyzer/checker_spec.rb
|
105
|
+
- spec/code_analyzer/checking_visitor/default_spec.rb
|
106
|
+
- spec/code_analyzer/checking_visitor/plain_spec.rb
|
107
|
+
- spec/code_analyzer/nil_spec.rb
|
108
|
+
- spec/code_analyzer/sexp_spec.rb
|
109
|
+
- spec/code_analyzer/warning_spec.rb
|
110
|
+
- spec/spec_helper.rb
|