rubocop 0.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubocop might be problematic. Click here for more details.

@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create 1.9.3@rubocop
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "yard", "~> 0.7"
11
+ gem "cucumber", ">= 0"
12
+ gem "bundler", "~> 1.1.0"
13
+ gem "jeweler", "~> 1.8.3"
14
+ gem "simplecov"
15
+ end
@@ -0,0 +1,49 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (3.0.0)
5
+ cucumber (1.1.9)
6
+ builder (>= 2.1.2)
7
+ diff-lcs (>= 1.1.2)
8
+ gherkin (~> 2.9.0)
9
+ json (>= 1.4.6)
10
+ term-ansicolor (>= 1.0.6)
11
+ diff-lcs (1.1.3)
12
+ gherkin (2.9.3)
13
+ json (>= 1.4.6)
14
+ git (1.2.5)
15
+ jeweler (1.8.3)
16
+ bundler (~> 1.0)
17
+ git (>= 1.2.5)
18
+ rake
19
+ rdoc
20
+ json (1.6.6)
21
+ multi_json (1.3.2)
22
+ rake (0.9.2.2)
23
+ rdoc (3.12)
24
+ json (~> 1.4)
25
+ rspec (2.8.0)
26
+ rspec-core (~> 2.8.0)
27
+ rspec-expectations (~> 2.8.0)
28
+ rspec-mocks (~> 2.8.0)
29
+ rspec-core (2.8.0)
30
+ rspec-expectations (2.8.0)
31
+ diff-lcs (~> 1.1.2)
32
+ rspec-mocks (2.8.0)
33
+ simplecov (0.6.2)
34
+ multi_json (~> 1.3)
35
+ simplecov-html (~> 0.5.3)
36
+ simplecov-html (0.5.3)
37
+ term-ansicolor (1.0.7)
38
+ yard (0.7.5)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ bundler (~> 1.1.0)
45
+ cucumber
46
+ jeweler (~> 1.8.3)
47
+ rspec (~> 2.8.0)
48
+ simplecov
49
+ yard (~> 0.7)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Bozhidar Batsov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # rubocop
2
+
3
+ Ruby code style checker.
4
+
5
+ ## Contributing to Rubocop
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ ## Copyright
16
+
17
+ Copyright (c) 2012 Bozhidar Batsov. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "rubocop"
18
+ gem.homepage = "http://github.com/bbatsov/rubocop"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Automatic Ruby code style checking tool.}
21
+ gem.description = %Q{Automatic Ruby code style checking tool. Aims to enforce the community-driven Ruby Style Guide.}
22
+ gem.email = "bozhidar@batsov.com"
23
+ gem.authors = ["Bozhidar Batsov"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ require 'cucumber/rake/task'
40
+ Cucumber::Rake::Task.new(:features)
41
+
42
+ task :default => :spec
43
+
44
+ require 'yard'
45
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
4
+
5
+ require 'rubocop'
6
+
7
+ cli = Rubocop::CLI.new
8
+ exit cli.run
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
+ require 'rubocop'
12
+
13
+ require 'rspec/expectations'
@@ -0,0 +1,5 @@
1
+ require 'rubocop/cop/offence'
2
+ require 'rubocop/cop/cop'
3
+ require 'rubocop/cop/line_length_cop'
4
+
5
+ require 'rubocop/cli'
@@ -0,0 +1,40 @@
1
+ require 'optparse'
2
+
3
+ module Rubocop
4
+ # The CLI is a class responsible of handling all the command line interface
5
+ # logic.
6
+ class CLI
7
+ def run
8
+ options = {}
9
+
10
+ OptionParser.new do |opts|
11
+ opts.banner = "Usage: rubocop [options] [file1, file2, ...]"
12
+
13
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
14
+ options[:verbose] = v
15
+ end
16
+ end.parse!
17
+
18
+ cops = []
19
+ cops << Cop::LineLengthCop
20
+
21
+ target_files.each do |file|
22
+ cops.each do |cop_klass|
23
+ cop = cop_klass.new
24
+ cop.inspect(file)
25
+ cop.report
26
+ end
27
+ end
28
+
29
+ return 0
30
+ end
31
+
32
+ def target_files
33
+ return Dir['**/*.rb'] if ARGV.empty?
34
+
35
+ if glob = ARGV.detect { |arg| arg =~ /\*/ }
36
+ return Dir[glob]
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,21 @@
1
+ module Rubocop
2
+ module Cop
3
+ class Cop
4
+ attr_accessor :offences
5
+
6
+ def initialize
7
+ @offences = []
8
+ end
9
+
10
+ def report
11
+ @offences.each do |offence|
12
+ puts offence
13
+ end
14
+ end
15
+
16
+ def add_offence(file, line_number, line, message)
17
+ @offences << Offence.new(file, line_number, line, message)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module Rubocop
2
+ module Cop
3
+ class LineLengthCop < Cop
4
+ def inspect(file)
5
+ File.readlines(file).each_with_index do |line, index|
6
+ add_offence(file, index, line, "Line too long") if line.size > 80
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ module Rubocop
2
+ module Cop
3
+ class Offence
4
+ attr_accessor :filename, :line_number, :line, :message
5
+
6
+ def initialize(filename, line_number, line, message)
7
+ @filename = filename
8
+ @line_number = line_number
9
+ @line = line
10
+ @message = message
11
+ end
12
+
13
+ def to_s
14
+ "#@filename:#@line_number:#{@line.chomp} - #@message"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Rubocop
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Rubocop" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'rubocop'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bozhidar Batsov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70138309473860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.8.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70138309473860
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ requirement: &70138309487180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.7'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70138309487180
36
+ - !ruby/object:Gem::Dependency
37
+ name: cucumber
38
+ requirement: &70138309483540 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70138309483540
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &70138309491060 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70138309491060
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &70138309505580 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.8.3
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70138309505580
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: &70138309504800 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70138309504800
80
+ description: Automatic Ruby code style checking tool. Aims to enforce the community-driven
81
+ Ruby Style Guide.
82
+ email: bozhidar@batsov.com
83
+ executables:
84
+ - rubocop
85
+ extensions: []
86
+ extra_rdoc_files:
87
+ - LICENSE.txt
88
+ - README.md
89
+ files:
90
+ - .document
91
+ - .rspec
92
+ - .rvmrc
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - VERSION
99
+ - bin/rubocop
100
+ - features/rubocop.feature
101
+ - features/step_definitions/rubocop_steps.rb
102
+ - features/support/env.rb
103
+ - lib/rubocop.rb
104
+ - lib/rubocop/cli.rb
105
+ - lib/rubocop/cop/cop.rb
106
+ - lib/rubocop/cop/line_length_cop.rb
107
+ - lib/rubocop/cop/offence.rb
108
+ - lib/rubocop/version.rb
109
+ - spec/rubocop_spec.rb
110
+ - spec/spec_helper.rb
111
+ homepage: http://github.com/bbatsov/rubocop
112
+ licenses:
113
+ - MIT
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ segments:
125
+ - 0
126
+ hash: 2147834688713714248
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 1.8.15
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Automatic Ruby code style checking tool.
139
+ test_files: []