зеркало из https://github.com/github/ruby.git
[ruby/syntax_suggest] Do not output "Syntax OK" when there's an error
Due to a problem with ripper we do not recognize `break` as invalid code. It's confusing that "Syntax OK" is output in that case. When there's no syntax error, the algorithm should not say anything. The exception is in the CLI and that's for compatibility with `ruby -wc` ``` $ cat /tmp/break.rb break ⛄️ 3.1.2 🚀 /Users/rschneeman/Documents/projects/syntax_suggest (schneems/no-syntax-not-okay-break) $ ruby -wc /tmp/break.rb Syntax OK ``` > Note that this is invalid, running this code will raise a Syntax error. ``` $ exe/syntax_suggest /tmp/break.rb Syntax OK ``` Close https://github.com/ruby/syntax_suggest/pull/157 https://github.com/ruby/syntax_suggest/commit/d7bd8f03a2
This commit is contained in:
Родитель
4d51a0b495
Коммит
f64ba0fadd
|
@ -65,6 +65,7 @@ module SyntaxSuggest
|
|||
)
|
||||
|
||||
if display.document_ok?
|
||||
@io.puts "Syntax OK"
|
||||
@exit_obj.exit(0)
|
||||
else
|
||||
@exit_obj.exit(1)
|
||||
|
|
|
@ -23,7 +23,6 @@ module SyntaxSuggest
|
|||
|
||||
def call
|
||||
if document_ok?
|
||||
@io.puts "Syntax OK"
|
||||
return self
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module SyntaxSuggest
|
|||
io: io
|
||||
)
|
||||
|
||||
expect(io.string.strip).to eq("Syntax OK")
|
||||
expect(io.string.strip).to eq("")
|
||||
end
|
||||
|
||||
it "raises original error with warning if a non-syntax error is passed" do
|
||||
|
|
|
@ -25,7 +25,7 @@ module SyntaxSuggest
|
|||
code_lines: search.code_lines
|
||||
)
|
||||
display.call
|
||||
expect(io.string).to include("Syntax OK")
|
||||
expect(io.string).to include("")
|
||||
end
|
||||
|
||||
it "selectively prints to terminal if input is a tty by default" do
|
||||
|
|
Загрузка…
Ссылка в новой задаче