rubocop 0.3.2 → 0.4.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.

Files changed (66) hide show
  1. data/.rubocop.yml +6 -0
  2. data/README.md +18 -6
  3. data/VERSION +1 -1
  4. data/bin/rubocop +1 -1
  5. data/lib/rubocop.rb +3 -0
  6. data/lib/rubocop/cli.rb +33 -16
  7. data/lib/rubocop/cop/collection_methods.rb +29 -0
  8. data/lib/rubocop/cop/cop.rb +1 -1
  9. data/lib/rubocop/cop/def_parentheses.rb +4 -1
  10. data/lib/rubocop/cop/encoding.rb +6 -4
  11. data/lib/rubocop/cop/favor_modifier.rb +5 -5
  12. data/lib/rubocop/cop/indentation.rb +1 -1
  13. data/lib/rubocop/cop/syntax.rb +19 -0
  14. data/lib/rubocop/version.rb +1 -1
  15. data/rubocop.gemspec +6 -5
  16. data/spec/rubocop/cli_spec.rb +98 -52
  17. data/spec/rubocop/cops/align_parameters_spec.rb +29 -29
  18. data/spec/rubocop/cops/ampersands_pipes_vs_and_or_spec.rb +4 -4
  19. data/spec/rubocop/cops/class_and_module_camel_case_spec.rb +4 -4
  20. data/spec/rubocop/cops/collection_methods_spec.rb +39 -0
  21. data/spec/rubocop/cops/cop_spec.rb +5 -5
  22. data/spec/rubocop/cops/def_with_parentheses_spec.rb +5 -5
  23. data/spec/rubocop/cops/def_without_parentheses_spec.rb +4 -4
  24. data/spec/rubocop/cops/empty_lines_spec.rb +8 -8
  25. data/spec/rubocop/cops/encoding_spec.rb +17 -11
  26. data/spec/rubocop/cops/end_of_line_spec.rb +5 -5
  27. data/spec/rubocop/cops/favor_modifier_spec.rb +12 -12
  28. data/spec/rubocop/cops/favor_unless_over_negated_if_spec.rb +8 -8
  29. data/spec/rubocop/cops/favor_until_over_negated_while_spec.rb +7 -7
  30. data/spec/rubocop/cops/grammar_spec.rb +14 -9
  31. data/spec/rubocop/cops/hash_syntax_spec.rb +10 -10
  32. data/spec/rubocop/cops/if_with_semicolon_spec.rb +3 -3
  33. data/spec/rubocop/cops/indentation_spec.rb +7 -7
  34. data/spec/rubocop/cops/line_length_spec.rb +4 -4
  35. data/spec/rubocop/cops/method_and_variable_snake_case_spec.rb +7 -7
  36. data/spec/rubocop/cops/multiline_blocks_spec.rb +4 -4
  37. data/spec/rubocop/cops/multiline_if_then_spec.rb +7 -7
  38. data/spec/rubocop/cops/new_lambda_literal_spec.rb +4 -4
  39. data/spec/rubocop/cops/numeric_literals_spec.rb +10 -10
  40. data/spec/rubocop/cops/offence_spec.rb +4 -4
  41. data/spec/rubocop/cops/one_line_conditional_spec.rb +2 -3
  42. data/spec/rubocop/cops/parameter_lists_spec.rb +4 -4
  43. data/spec/rubocop/cops/parentheses_around_condition_spec.rb +6 -6
  44. data/spec/rubocop/cops/single_line_blocks_spec.rb +4 -4
  45. data/spec/rubocop/cops/space_after_colon_spec.rb +5 -5
  46. data/spec/rubocop/cops/space_after_comma_spec.rb +3 -3
  47. data/spec/rubocop/cops/space_after_semicolon_spec.rb +3 -3
  48. data/spec/rubocop/cops/space_around_braces_spec.rb +6 -6
  49. data/spec/rubocop/cops/space_around_equals_in_default_parameter_spec.rb +4 -4
  50. data/spec/rubocop/cops/space_around_operators_spec.rb +28 -28
  51. data/spec/rubocop/cops/space_inside_brackets_spec.rb +8 -8
  52. data/spec/rubocop/cops/space_inside_parens_spec.rb +4 -4
  53. data/spec/rubocop/cops/string_literals_spec.rb +5 -5
  54. data/spec/rubocop/cops/syntax_spec.rb +18 -0
  55. data/spec/rubocop/cops/tab_spec.rb +3 -3
  56. data/spec/rubocop/cops/ternary_operator_spec.rb +8 -8
  57. data/spec/rubocop/cops/trailing_whitespace_spec.rb +4 -4
  58. data/spec/rubocop/cops/unless_else_spec.rb +4 -4
  59. data/spec/rubocop/cops/when_then_spec.rb +5 -5
  60. data/spec/rubocop/reports/emacs_style_spec.rb +3 -3
  61. data/spec/rubocop/reports/report_spec.rb +5 -5
  62. data/spec/spec_helper.rb +6 -0
  63. metadata +7 -6
  64. data/features/rubocop.feature +0 -9
  65. data/features/step_definitions/rubocop_steps.rb +0 -1
  66. data/features/support/env.rb +0 -15
@@ -5,14 +5,14 @@ require 'spec_helper'
5
5
  module Rubocop
6
6
  module Report
7
7
  describe Report do
8
- let (:report) { Report.new('test') }
8
+ let(:report) { Report.new('test') }
9
9
 
10
10
  it 'initially has 0 entries' do
11
- report.entries.size.should == 0
11
+ expect(report.entries.size).to be_zero
12
12
  end
13
13
 
14
14
  it 'initially has nothing to report' do
15
- report.empty?.should be_true
15
+ expect(report.empty?).to be_true
16
16
  end
17
17
 
18
18
  it 'keeps track of offences' do
@@ -21,8 +21,8 @@ module Rubocop
21
21
 
22
22
  report << cop
23
23
 
24
- report.empty?.should be_false
25
- report.entries.size.should == 1
24
+ expect(report.empty?).to be_false
25
+ expect(report.entries.size).to eq(1)
26
26
  end
27
27
  end
28
28
  end
data/spec/spec_helper.rb CHANGED
@@ -40,6 +40,12 @@ module ExitCodeMatchers
40
40
  end
41
41
 
42
42
  RSpec.configure do |config|
43
+ config.filter_run_excluding ruby: ->(v) { !RUBY_VERSION.start_with?(v.to_s) }
44
+
45
+ config.expect_with :rspec do |c|
46
+ c.syntax = :expect # disables `should`
47
+ end
48
+
43
49
  config.include(ExitCodeMatchers)
44
50
  end
45
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
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: 2013-04-06 00:00:00.000000000 Z
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
@@ -145,15 +145,13 @@ files:
145
145
  - Rakefile
146
146
  - VERSION
147
147
  - bin/rubocop
148
- - features/rubocop.feature
149
- - features/step_definitions/rubocop_steps.rb
150
- - features/support/env.rb
151
148
  - lib/rubocop.rb
152
149
  - lib/rubocop/cli.rb
153
150
  - lib/rubocop/cop/align_parameters.rb
154
151
  - lib/rubocop/cop/ampersands_pipes_vs_and_or.rb
155
152
  - lib/rubocop/cop/blocks.rb
156
153
  - lib/rubocop/cop/class_and_module_camel_case.rb
154
+ - lib/rubocop/cop/collection_methods.rb
157
155
  - lib/rubocop/cop/cop.rb
158
156
  - lib/rubocop/cop/def_parentheses.rb
159
157
  - lib/rubocop/cop/empty_lines.rb
@@ -175,6 +173,7 @@ files:
175
173
  - lib/rubocop/cop/space_after_comma_etc.rb
176
174
  - lib/rubocop/cop/string_literals.rb
177
175
  - lib/rubocop/cop/surrounding_space.rb
176
+ - lib/rubocop/cop/syntax.rb
178
177
  - lib/rubocop/cop/tab.rb
179
178
  - lib/rubocop/cop/ternary_operator.rb
180
179
  - lib/rubocop/cop/trailing_whitespace.rb
@@ -189,6 +188,7 @@ files:
189
188
  - spec/rubocop/cops/align_parameters_spec.rb
190
189
  - spec/rubocop/cops/ampersands_pipes_vs_and_or_spec.rb
191
190
  - spec/rubocop/cops/class_and_module_camel_case_spec.rb
191
+ - spec/rubocop/cops/collection_methods_spec.rb
192
192
  - spec/rubocop/cops/cop_spec.rb
193
193
  - spec/rubocop/cops/def_with_parentheses_spec.rb
194
194
  - spec/rubocop/cops/def_without_parentheses_spec.rb
@@ -222,6 +222,7 @@ files:
222
222
  - spec/rubocop/cops/space_inside_brackets_spec.rb
223
223
  - spec/rubocop/cops/space_inside_parens_spec.rb
224
224
  - spec/rubocop/cops/string_literals_spec.rb
225
+ - spec/rubocop/cops/syntax_spec.rb
225
226
  - spec/rubocop/cops/tab_spec.rb
226
227
  - spec/rubocop/cops/ternary_operator_spec.rb
227
228
  - spec/rubocop/cops/trailing_whitespace_spec.rb
@@ -245,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
246
  version: '0'
246
247
  segments:
247
248
  - 0
248
- hash: -1829929382271578205
249
+ hash: 1039361930821170753
249
250
  required_rubygems_version: !ruby/object:Gem::Requirement
250
251
  none: false
251
252
  requirements:
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
1
- # encoding: utf-8
@@ -1,15 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'bundler'
4
- begin
5
- Bundler.setup(:default, :development)
6
- rescue Bundler::BundlerError => e
7
- $stderr.puts e.message
8
- $stderr.puts 'Run `bundle install` to install missing gems'
9
- exit e.status_code
10
- end
11
-
12
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
13
- require 'rubocop'
14
-
15
- require 'rspec/expectations'