rufo 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2da6aac7c9ee2daf498d8131afd7e77717a9ebb7
4
- data.tar.gz: 1fbb0734dec03fc709b615fae32f6c52bfcb1df1
3
+ metadata.gz: 7cd6d76280a492dbed740bbd7f3d339f11569ffa
4
+ data.tar.gz: 33f7f1ea2649f177af1933597154ea2e34c78315
5
5
  SHA512:
6
- metadata.gz: d21c78d0b4287cc04e5121c91631dacebcbf7f860c0398335e39f885da82de0a08676048b44c0964e8480253d86ebc78f699e23499931398318ba2a54e7dfc27
7
- data.tar.gz: 23800db7fbb6224f5be334fab2141ef022d87906bc27926d6744debfd2d1751538ad9d189f956cf0a8e7c382c8cf0c801a5d6672dba49652117b041a615161ef
6
+ metadata.gz: cf1009830d35c4009d4f7175f68675cc36e77d43e0891c5154f6f8b0fb31dc60efc5652891da51d3dd0677fe7def47f1af0d0d6951fec083ce78aa7122d9101a
7
+ data.tar.gz: 68b71bdf20a8e023d44076a5fb0e0075fc1f7f1e0921fefb4f6ee5096e86a9b144f54f9111d90e86090be80ce674630e889b40dfcdce90b5b2157337ff5be08c
data/README.md CHANGED
@@ -63,12 +63,11 @@ according to **rufo**, and will exit with exit code 1.
63
63
  - Sublime Text: [sublime-rufo](https://github.com/asterite/sublime-rufo)
64
64
  - Vim: [rufo-vim](https://github.com/splattael/rufo-vim) :construction:
65
65
  - Atom: [rufo-atom](https://github.com/bmulvihill/rufo-atom) :construction:
66
+ - Emacs [emacs-rufo](https://github.com/aleandros/emacs-rufo) :construction:
66
67
 
67
68
  Did you write a plugin for your favorite editor? That's great! Let me know about it and
68
69
  I will list it here.
69
70
 
70
- Right now it would be great to have an [Emacs](https://www.gnu.org/software/emacs/) plugin :-)
71
-
72
71
  ## Configuration
73
72
 
74
73
  Rufo follows most of the conventions found in this [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). It does a bit more than that, and it can also be configured a bit.
@@ -32,7 +32,7 @@ class Rufo::Command
32
32
  rescue Rufo::SyntaxError
33
33
  STDERR.puts "Error: the given text is not a valid ruby program (it has syntax errors)"
34
34
  exit 1
35
- rescue Rufo::Bug => ex
35
+ rescue => ex
36
36
  STDERR.puts "You've found a bug!"
37
37
  STDERR.puts "Please report it to https://github.com/asterite/rufo/issues with code that triggers it"
38
38
  STDERR.puts
@@ -88,7 +88,7 @@ class Rufo::Command
88
88
  rescue Rufo::SyntaxError
89
89
  STDERR.puts "Error: the given text in #{filename} is not a valid ruby program (it has syntax errors)"
90
90
  exit 1
91
- rescue Rufo::Bug => ex
91
+ rescue => ex
92
92
  STDERR.puts "You've found a bug!"
93
93
  STDERR.puts "It happened while trying to format the file #{filename}"
94
94
  STDERR.puts "Please report it to https://github.com/asterite/rufo/issues with code that triggers it"
@@ -587,7 +587,7 @@ class Rufo::Formatter
587
587
 
588
588
  case current_token_kind
589
589
  when :on_heredoc_end
590
- (line+1..@line).each do |i|
590
+ (line + 1..@line).each do |i|
591
591
  @heredoc_lines[i] = true
592
592
  end
593
593
 
@@ -922,7 +922,12 @@ class Rufo::Formatter
922
922
 
923
923
  def consume_call_dot
924
924
  if current_token_kind == :on_op
925
- consume_token :on_op
925
+ if current_token_value == "&."
926
+ write "&."
927
+ else
928
+ write "."
929
+ end
930
+ next_token
926
931
  else
927
932
  consume_token :on_period
928
933
  end
@@ -2203,9 +2208,7 @@ class Rufo::Formatter
2203
2208
 
2204
2209
  # Remember dot column
2205
2210
  dot_column = @column
2206
- check :on_period
2207
- write "."
2208
- next_token
2211
+ consume_call_dot
2209
2212
  skip_space
2210
2213
 
2211
2214
  if newline? || comment?
@@ -3236,16 +3239,20 @@ class Rufo::Formatter
3236
3239
  next unless first_paren_end_line == last_line
3237
3240
 
3238
3241
  diff = first_param_indent - indent
3239
- (first_line+1..last_line).each do |line|
3242
+ (first_line + 1..last_line).each do |line|
3240
3243
  @line_to_call_info.delete(line)
3241
3244
 
3242
3245
  next if @heredoc_lines[line]
3243
3246
 
3244
3247
  current_line = lines[line]
3245
3248
  current_line = current_line[diff..-1]
3246
- lines[line] = current_line
3247
3249
 
3248
- adjust_other_alignments nil, line, 0, -diff
3250
+ # It can happen that this line didn't need an indent because
3251
+ # it simply had a newline
3252
+ if current_line
3253
+ lines[line] = current_line
3254
+ adjust_other_alignments nil, line, 0, -diff
3255
+ end
3249
3256
  end
3250
3257
  end
3251
3258
 
@@ -1,3 +1,3 @@
1
1
  module Rufo
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ary Borenszweig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-27 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler