Project

General

Profile

Actions

Bug #12321

closed

Backticks in log output cause issues

Added by dkniffin (Derek Kniffin) almost 8 years ago. Updated almost 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.3p173
[ruby-core:75205]

Description

I would like to propose changing ruby's log output slightly. The issue I have is with output like this:

NoMethodError: undefined method `some_method' for nil:NilClass

In particular, I don't like how some_method has a backtick on the left, and a single quote on the right. I would much prefer to have single quotes on both sides.

Now, this may seem like a very knit-picky thing, but in the modern age where markdown is very widely used, this causes an issue quite often. For instance, every time I copy/paste a log snippet like that into slack, and try wrapping it in backticks, to denote that it's a code snippet, it formats it wrong.

I've tried to find a reason why ruby's output does this, but I couldn't find anything. The best guess I have is that it was a way to emulate opening and closing apostrophes, but it's a poor replacement for that. If someone else can enlighten me about the reasoning, I'd be very curious to know it.


Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #16495: Inconsistent quotes in error messagesClosedmatz (Yukihiro Matsumoto)Actions
Has duplicate Ruby master - Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:HashRejectedActions

Updated by phluid61 (Matthew Kerwin) almost 8 years ago

It's an old typographical convention, as you say, to indicate opening quotation marks. It is used in TeX, for instance.

I find the argument "it's hard to paste into Slack" not very compelling.

That said, I have no strong opinion either way.

Updated by dkniffin (Derek Kniffin) almost 8 years ago

Well, it's not just slack. It's anything that uses markdown. That includes Github, Stack overflow, Jekyll, PivitolTracker, Jira, and probably many other technical tools. Markdown has become a pseudo-standard, and it's used in tons of places.

If there's a good reason to keep that backtick, I will happily close this issue, and deal with it. However, my suspicion is it causes more issues than solutions.

Updated by sawa (Tsuyoshi Sawada) almost 8 years ago

Backtick can appear anywhere else in a code block even if you get rid of this particular use in Ruby error messages. If you claim it breaks when you simply surround such string by backticks, then the way you are doing it is wrong. You should escape the backticks somehow when embedding that as a piece of code. In markdown, it is done by using multiple backticks.

In the meanwhile, I also think that there is no need for Ruby error messages to follow TeX's convention, as TeX is designed for the beauty of the output (i.e. need to distinguish left and right smart quotes, in this particular case) (with the cost of the source code being ugly), whereas Ruby error messages are to be read as is, and using a combination of backtick and single quote like `foo' surely looks ugly. I would rather prefer Ruby to use markdown style balanced backticks like `foo` to express parts of code in error messages.

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

  • Status changed from Open to Rejected

Use multiline code block.

Actions #5

Updated by shyouhei (Shyouhei Urabe) almost 7 years ago

  • Has duplicate Bug #13589: unmatched opening backtick / closing quote in NoMethodError: undefined method `name' for {}:Hash added
Actions #6

Updated by mame (Yusuke Endoh) about 4 years ago

  • Related to Feature #16495: Inconsistent quotes in error messages added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0