Skip to content

Commit

Permalink
[Fix #1566] Don't convert line endings on Windows when autocorrecting
Browse files Browse the repository at this point in the history
When autocorrecting, the changed portions of code will use "\n" line endings,
rather than "\r\n". Everything else will remain as it was.
  • Loading branch information
alexdowad committed Dec 23, 2015
1 parent dfc54e1 commit 6d5f8e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
* [#947](https://github.com/bbatsov/rubocop/issues/947): `Style/Documentation` considers classes and modules which only define constants to be "namespaces", and doesn't flag them for lack of a documentation comment. ([@alexdowad][])
* [#2467](https://github.com/bbatsov/rubocop/issues/2467): Explicitly inheriting configuration from the rubocop gem in .rubocop.yml is not allowed. ([@alexdowad][])
* [#2322](https://github.com/bbatsov/rubocop/issues/2322): Output of --auto-gen-config shows content of default config parameters which are Arrays; this is especially useful for SupportedStyles. ([@alexdowad][])
* [#1566](https://github.com/bbatsov/rubocop/issues/1566): When autocorrecting on Windows, line endings are not converted to "\r\n" in untouched portions of the source files; corrected portions may use "\n" rather than "\r\n". ([@alexdowad][])

## 0.35.1 (10/11/2015)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def autocorrect(buffer, cops)
@options[:stdin] = new_source
else
filename = buffer.name
File.open(filename, 'w') { |f| f.write(new_source) }
File.open(filename, 'wb') { |f| f.write(new_source) }
end
@updated_source_file = true
end
Expand Down

0 comments on commit 6d5f8e2

Please sign in to comment.