rubocop 0.13.0 → 0.13.1

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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +18 -0
  3. data/config/default.yml +4 -0
  4. data/config/enabled.yml +13 -9
  5. data/lib/rubocop.rb +5 -1
  6. data/lib/rubocop/backports/bsearch.rb +39 -0
  7. data/lib/rubocop/cop/lint/useless_comparison.rb +2 -0
  8. data/lib/rubocop/cop/lint/useless_setter_call.rb +88 -13
  9. data/lib/rubocop/cop/style/align_array.rb +2 -20
  10. data/lib/rubocop/cop/style/align_parameters.rb +2 -20
  11. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  12. data/lib/rubocop/cop/style/ascii_identifiers.rb +1 -1
  13. data/lib/rubocop/cop/style/autocorrect_alignment.rb +32 -0
  14. data/lib/rubocop/cop/style/character_literal.rb +5 -13
  15. data/lib/rubocop/cop/style/final_newline.rb +2 -2
  16. data/lib/rubocop/cop/style/hash_syntax.rb +10 -3
  17. data/lib/rubocop/cop/style/lambda_call.rb +39 -0
  18. data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
  19. data/lib/rubocop/cop/style/redundant_self.rb +48 -2
  20. data/lib/rubocop/cop/style/string_help.rb +27 -0
  21. data/lib/rubocop/cop/style/string_literals.rb +5 -13
  22. data/lib/rubocop/cop/style/surrounding_space.rb +17 -5
  23. data/lib/rubocop/version.rb +1 -1
  24. data/rubocop.gemspec +0 -1
  25. data/spec/rubocop/cli_spec.rb +909 -914
  26. data/spec/rubocop/cop/lint/useless_comparison_spec.rb +5 -0
  27. data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +41 -0
  28. data/spec/rubocop/cop/style/final_newline_spec.rb +6 -0
  29. data/spec/rubocop/cop/style/hash_syntax_spec.rb +26 -21
  30. data/spec/rubocop/cop/style/lambda_call_spec.rb +29 -0
  31. data/spec/rubocop/cop/style/nil_comparison_spec.rb +5 -0
  32. data/spec/rubocop/cop/style/redundant_self_spec.rb +18 -0
  33. data/spec/rubocop/cop/style/space_around_block_braces_spec.rb +68 -0
  34. metadata +20 -50
  35. data/spec/rubocop/cop/style/space_around_braces_spec.rb +0 -50
@@ -1,50 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- module Rubocop
6
- module Cop
7
- module Style
8
- describe SpaceAroundBraces do
9
- subject(:cop) { SpaceAroundBraces.new }
10
-
11
- it 'registers an offence for left brace without spaces' do
12
- inspect_source(cop, ['each{ puts }'])
13
- expect(cop.messages).to eq(["Surrounding space missing for '{'."])
14
- expect(cop.highlights).to eq(['{'])
15
- end
16
-
17
- it 'registers an offence for right brace without inner space' do
18
- inspect_source(cop, ['each { puts}'])
19
- expect(cop.messages).to eq(
20
- ["Space missing to the left of '}'."])
21
- expect(cop.highlights).to eq(['}'])
22
- end
23
-
24
- it 'accepts an empty hash literal with no space inside' do
25
- inspect_source(cop,
26
- ['view_hash.each do |view_key|',
27
- 'end',
28
- '@views = {}',
29
- ''])
30
- expect(cop.messages).to be_empty
31
- end
32
-
33
- it 'accepts string interpolation braces with no space inside' do
34
- inspect_source(cop,
35
- ['"A=#{a}"',
36
- ':"#{b}"',
37
- '/#{c}/',
38
- '`#{d}`',
39
- 'sprintf("#{message.gsub(/%/, \'%%\')}", line)'])
40
- expect(cop.messages).to be_empty
41
- end
42
-
43
- it 'accepts braces around a hash literal argument' do
44
- inspect_source(cop, ["new({'user' => user_params})"])
45
- expect(cop.messages).to be_empty
46
- end
47
- end
48
- end
49
- end
50
- end