Inspection "Wrong attribute quotes"

ReSharper is complaining that the attributes on my HTML are delimited with single quotes.
WrongAttributeQuote.gif
Single quoted attributes are perfectly legal.

If a language gives me a choice, I'll always choose single quotes because it's a non-chorded keystroke, so it's less stress on the tendons. With no other reason to favor one or the other, that makes single quotes objectively better.

I could just disable the warning, but we don't share ReSharper configs among team members, so unless I cave and start using double quotes, my coworkers will see this warning.

Why does it exist?

5 comments
Comment actions Permalink

We have to pick a default, and it's bound to be wrong for someone :)

You can easily share these settings between the team though - if you change the default setting for the inspection, or change the default quote style in Code Style, don't hit "Save" but hit "Save To", and save to the shared team settings. This will save the options to a sln.dotSettings file that sits next to your .sln file. Check this into source control and everyone on the team will share the same settings.

0
Comment actions Permalink

We have to pick a default

Why? They are both equally valid, and people often switch which they use to avoid escaping the other. Why label one as "wrong" by default, when objectively, according to the standard, neither are wrong?

The default should be either is valid. If some pedantic team wants to then force developers to use one or the other, they can go in an enable it.
0
Comment actions Permalink

Well, even picking the idea that both are "valid" is a default. We've chosen that you should aim for consistency - pick one style and stick with it across the board. We've also chosen double quotes over single quotes as the default, but I don't know why. Also, we're not labelling it as "wrong" - we're giving a *hint* (our lowest level highlight) that you should change it, for consistency's sake (it's a Code Style inspection, rather than a code issue inspection). And of course, it's configurable. If you don't like our defaults - some will, some won't - it's very easy to change the default setting, or disable the inspection altogether.

0
Comment actions Permalink

Well, even picking the idea that both are "valid" is a default.


Of course, I just don't understand why you don't default to web standards, or at least common practices, instead of literally inventing arbitrary things to label "wrong".  Yes, I can change the default, and yes we could share settings with team members, but we don't, because people tend to assume that ReSharper's defaults are well considered.

It's a done deal, and I'm mostly just bitching, so thanks for listening. ;)

Also, we're not labelling it as "wrong"

The name of the inspection is literally "Wrong attribute quotes".

0
Comment actions Permalink

Ha! That message does kind of undermine my argument :) Perhaps a better message might have been "inconsistent attribute quotes" - we agree that neither is "wrong", just want to help you write consistently styled code, and make it easy to adapt to what your style is.

0

Please sign in to leave a comment.