tuxedo 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'stringio'
8
+ require 'tuxedo'
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+ end
15
+
16
+ include Tuxedo::Tty
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+ require 'helpers/cane_output_helper'
3
+ include Tuxedo
4
+
5
+ describe "cane parser" do
6
+ describe "#parse_cane" do
7
+ context "for a single line length and whitespace error" do
8
+ let!(:output_1) { generate_cane_output }
9
+ let!(:cane_parser) { Tuxedo::CaneParser.new }
10
+
11
+ before(:all) do
12
+ cane_parser.parse_cane(output_1)
13
+ capture_stdout do
14
+ Tuxedo::Outputter.print_to_screen(cane_parser.result)
15
+ end
16
+ end
17
+
18
+ context "after parsing the output" do
19
+ context "for whitespace errors" do
20
+ it "finds 1 error" do
21
+ cane_parser.result[:"Line contains trailing whitespaces"].count.should == 1
22
+ end
23
+
24
+ it "identifies the correct source of the error" do
25
+ cane_parser.result[:"Line contains trailing whitespaces"].first.source.should == "app/controllers/carts_controller.rb"
26
+ end
27
+
28
+ it "identifies the correct line number for the error" do
29
+ cane_parser.result[:"Line contains trailing whitespaces"].first.line.should == [ 4 ]
30
+ end
31
+ end
32
+
33
+ context "for line length errors" do
34
+ it "finds 1 error" do
35
+ cane_parser.result[:"Line is >80 characters"].count.should == 1
36
+ end
37
+
38
+ it "identifies the correct source of the error" do
39
+ cane_parser.result[:"Line is >80 characters"].first.source.should == "app/controllers/products_controller.rb"
40
+ end
41
+
42
+ it "identifies the correct line number for the error" do
43
+ cane_parser.result[:"Line is >80 characters"].first.line.should == [ 47 ]
44
+ end
45
+ end
46
+
47
+ context "for abc complexity errors" do
48
+ it "finds 1 error" do
49
+ cane_parser.result[:"Maximum allowed ABC complexity"].count.should == 1
50
+ end
51
+
52
+ it "identifies the correct source of the error" do
53
+ cane_parser.result[:"Maximum allowed ABC complexity"].first.source.should == "app/controllers/orders_controller.rb"
54
+ end
55
+
56
+ it "identifies the correct line number for the error" do
57
+ cane_parser.result[:"Maximum allowed ABC complexity"].first.line.should == [ 23 ]
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+ require 'helpers/reek_output_helper'
3
+ include Tuxedo
4
+
5
+ describe "Reek parser" do
6
+ describe "#parse_reek" do
7
+ context "for a giant file" do
8
+ let!(:output_1) { generate_reek_output }
9
+ let!(:reek_parser) { Tuxedo::ReekParser.new }
10
+
11
+ before(:all) do
12
+ reek_parser.parse_reek(output_1)
13
+ capture_stdout do
14
+ Tuxedo::Outputter.print_to_screen(reek_parser.result)
15
+ end
16
+ end
17
+
18
+ context "after parsing the output" do
19
+ context "for TooManyStatements errors" do
20
+ it "finds 1 error" do
21
+ reek_parser.result[:"TooManyStatements"].count.should == 1
22
+ end
23
+
24
+ it "identifies the correct source of the error" do
25
+ reek_parser.result[:"TooManyStatements"].first.source.should == "./app/controllers/addresses_controller.rb"
26
+ end
27
+
28
+ it "identifies the correct line number for the error" do
29
+ reek_parser.result[:"TooManyStatements"].first.line.should == [ 2 ]
30
+ end
31
+ end
32
+
33
+ context "for UncommunicativeVariableName errors" do
34
+ it "finds 1 error" do
35
+ reek_parser.result[:"UncommunicativeVariableName"].count.should == 1
36
+ end
37
+
38
+ it "identifies the correct source of the error" do
39
+ reek_parser.result[:"UncommunicativeVariableName"].first.source.should == "./app/controllers/application_controller.rb"
40
+ end
41
+
42
+ it "identifies the correct line number for the error" do
43
+ reek_parser.result[:"UncommunicativeVariableName"].first.line.should == [ 34 ]
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'tuxedo/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "tuxedo"
9
+ s.version = Tuxedo::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Conan Rimmer", "Charles Strahan", "Ed Weng"]
12
+ s.email = ["conan.rimmer@livingsocial.com", "charles.strahan@livingsocial.com", "ed.weng@livingsocial.com"]
13
+ s.homepage = "https://github.com/conanr/tuxedo"
14
+ s.summary = "Wrapper for Cane and Reek for more managable output."
15
+ s.description = "Wrapper for cane and reek used to produce better style with better output."
16
+
17
+ s.required_rubygems_version = ">= 1.3.6"
18
+
19
+ s.add_development_dependency "rspec"
20
+ s.add_development_dependency "rake"
21
+ s.add_development_dependency "fabrication"
22
+
23
+ s.add_dependency('cane')
24
+ s.add_dependency('reek')
25
+
26
+ s.rubyforge_project = "tuxedo"
27
+
28
+ s.files = `git ls-files`.split("\n")
29
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
31
+ s.require_paths = ["lib"]
32
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tuxedo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Conan Rimmer
9
+ - Charles Strahan
10
+ - Ed Weng
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-05-11 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rake
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: fabrication
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ - !ruby/object:Gem::Dependency
65
+ name: cane
66
+ requirement: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ type: :runtime
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ - !ruby/object:Gem::Dependency
81
+ name: reek
82
+ requirement: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ description: Wrapper for cane and reek used to produce better style with better output.
97
+ email:
98
+ - conan.rimmer@livingsocial.com
99
+ - charles.strahan@livingsocial.com
100
+ - ed.weng@livingsocial.com
101
+ executables:
102
+ - tuxedo
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - .gitignore
107
+ - .rspec
108
+ - .rvmrc
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - README.md
112
+ - Rakefile
113
+ - bin/tuxedo
114
+ - data/sample_cane_output.txt
115
+ - data/sample_reek_output.yml
116
+ - data/sample_reek_output_clean.yml
117
+ - lib/tuxedo.rb
118
+ - lib/tuxedo/cane_parser.rb
119
+ - lib/tuxedo/cane_violation.rb
120
+ - lib/tuxedo/cane_violation/abc_max_violation.rb
121
+ - lib/tuxedo/cane_violation/style_violation.rb
122
+ - lib/tuxedo/cane_violation/syntax_violation.rb
123
+ - lib/tuxedo/cane_violation/threshold_violation.rb
124
+ - lib/tuxedo/cane_violation/undocumented_class_violation.rb
125
+ - lib/tuxedo/cli.rb
126
+ - lib/tuxedo/error.rb
127
+ - lib/tuxedo/formatters/base_formatter.rb
128
+ - lib/tuxedo/formatters/base_text_formatter.rb
129
+ - lib/tuxedo/formatters/cane_text_formatter.rb
130
+ - lib/tuxedo/outputter.rb
131
+ - lib/tuxedo/rake_task.rb
132
+ - lib/tuxedo/reek_parser.rb
133
+ - lib/tuxedo/runner.rb
134
+ - lib/tuxedo/tty.rb
135
+ - lib/tuxedo/version.rb
136
+ - spec/fabricators/cane_output_fabricator.rb
137
+ - spec/helpers/cane_output_helper.rb
138
+ - spec/helpers/reek_output_helper.rb
139
+ - spec/spec_helper.rb
140
+ - spec/tuxedo/cane_parser_spec.rb
141
+ - spec/tuxedo/reek_parser_spec.rb
142
+ - tuxedo.gemspec
143
+ homepage: https://github.com/conanr/tuxedo
144
+ licenses: []
145
+ post_install_message:
146
+ rdoc_options: []
147
+ require_paths:
148
+ - lib
149
+ required_ruby_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: 1.3.6
161
+ requirements: []
162
+ rubyforge_project: tuxedo
163
+ rubygems_version: 1.8.23
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: Wrapper for Cane and Reek for more managable output.
167
+ test_files:
168
+ - spec/fabricators/cane_output_fabricator.rb
169
+ - spec/helpers/cane_output_helper.rb
170
+ - spec/helpers/reek_output_helper.rb
171
+ - spec/spec_helper.rb
172
+ - spec/tuxedo/cane_parser_spec.rb
173
+ - spec/tuxedo/reek_parser_spec.rb