为什么在 Windows 10 pro 但在 Mac 中没有检测到 rubocop 罪行(C:检测到运输 return 字符)?
Why rubocop offenses (C: Carriage return character detected) in Windows 10 pro but not in Mac?
代码如下:
def fix(value)
value << 'xyz'
value = value.upcase
value.concat('!')
end
s = 'hello'
t = fix(s)
puts s
puts t
在 mac 中没有显示任何 rubocop 攻击,但显示
C: Carriage return character detected
def fix(value) ...
^^^^^^^^^^^^^^
在 windows 10 亲.
Unix 和 Windows 使用不同的字符来表示 newline。 Unix 使用 line feed
("\n"
),Windows 使用 carriage return + line feed
("\r\n"
).
只需在 Windows 机器上配置 IDE 以仅使用 Unix 版本。
代码如下:
def fix(value)
value << 'xyz'
value = value.upcase
value.concat('!')
end
s = 'hello'
t = fix(s)
puts s
puts t
在 mac 中没有显示任何 rubocop 攻击,但显示
C: Carriage return character detected
def fix(value) ...
^^^^^^^^^^^^^^
在 windows 10 亲.
Unix 和 Windows 使用不同的字符来表示 newline。 Unix 使用 line feed
("\n"
),Windows 使用 carriage return + line feed
("\r\n"
).
只需在 Windows 机器上配置 IDE 以仅使用 Unix 版本。