naokazuterada / MarkdownTOC

SublimeText3 plugin which generate a table of contents (TOC) in a markdown document.
https://packagecontrol.io/packages/MarkdownTOC
MIT License
301 stars 48 forks source link

Standardize Single Quote Usage #150

Closed TerminalFi closed 4 years ago

TerminalFi commented 4 years ago

What was expected

A standard around quote usage, I noticed throughout the codebase there is single and double quote usage.

There should be a preference for one over the other. Which will make contributing easier. I've got my environment to prefer double quotes (blackd) so on code changes, it converts single to double, this cause a big diff in my PR in which I went back and modified all the quotes back.

Please update the contributing docs to state single quote usage is preferred.

image

image

jonasbn commented 4 years ago

@naokazuterada do you want me to write up a proposal for an update to the contribution guidelines. As @TheSecEng points to; consistency is always good, so let me know what quoting policy you prefer and I will write it up.

I am a single quote guy myself, coming from Perl where string with double quotes can be interpolated and single quoted strings cannot. I would have to read up on Python to understand the use of single and double quoted string. Judging from the example posted by @TheSecEng single quotes could be used, but a full scan of the source would of course be necessary.

Unfortunately it does not seem as if pycodestyle says anything about quotes.

It seems as if double quotes are used for inline documentation, which means this could be regarded as reserved for this a policy would be easier to enforce.

Let me know what you think

jonasbn

naokazuterada commented 4 years ago

@TheSecEng Thank you for your suggestion and letting me know about the faulty code 🤕

@jonasbn I prefer single quotes, and have already checked and replaced all doubles to singles (7c6913). I'm so appreciate if you write it down to CONTRIBUTING.md. May I ask? 🥺

jonasbn commented 4 years ago

@naokazuterada I have updated the contribution guidelines with information on quoting, let me now if you come across other issues not currently handled by pycodestyle

Take care and stay safe

naokazuterada commented 4 years ago

progress report

I'm looking for a code styling tool that has an auto fix feature, but the only option that seems to be just right is Black, and it doesn't allow single quotes for quotation, so I'm not sure what to do.

Would it be easier to ride the Black's rail?

TerminalFi commented 4 years ago

We could use this fork of black. Easily enough to keep current with black.

Else I’m not sure

https://github.com/axiros/axblack

naokazuterada commented 4 years ago

@TheSecEng Thank you for informing me! but I prefer to follow original Black, sorry.