Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flake8] Resolving Q??? errors #3847

Merged
merged 1 commit into from
Nov 14, 2017

Conversation

john-bodley
Copy link
Member

This is the final PR related to remedying the flake8 errors. This resolves the flake8 Q??? violation errors which enforces single quotes for strings.

Previously there was a large mix of single and double quotes used for strings, and per PEP8,

In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this. Pick a rule and stick to it. When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. It improves readability.

For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.

it mentions to pick a rule and stick to it. Given that the majoring of strings were single-quoted I used that as the default. Note some strings include ' which I've escaped as opposed to using the other to avoid backslashes. I'm happy to remedy this if necessary.

to: @mistercrunch

@john-bodley john-bodley force-pushed the john-bodley-flake8-Q branch 2 times, most recently from ab21b5f to 6d01b69 Compare November 13, 2017 01:30
@mistercrunch
Copy link
Member

Agreed, single over double quotes.

Personally I prefer switching to avoid backslashes but I feel bad making you make lots of edits.

One thing though is that I prefer not enforcing rules that linters cannot enforce, so can we get pylint to enforce it? If not we'll have to tell each person on their first PR which is annoying both on the reviewer and reviewee side...

@mistercrunch
Copy link
Member

mistercrunch commented Nov 13, 2017

Looks like this would do it:
https://github.com/edaniszewski/pylint-quotes

@john-bodley
Copy link
Member Author

@mistercrunch I can switch from single to double quotes for the strings which include quotes to avoid backslashes. I'll comment on the PR when the change is made.

@mistercrunch
Copy link
Member

Sweet that will be ideal. It's also consistent with how the JS linter is set up.

@mistercrunch
Copy link
Member

Now you're in a serious position to win the "Most update on Github" trophy for this week
trophe

@john-bodley
Copy link
Member Author

@mistercrunch flake8 is enforcing the quoting as well; https://github.com/apache/incubator-superset/blob/master/tox.ini#L59.

@john-bodley john-bodley force-pushed the john-bodley-flake8-Q branch 4 times, most recently from 3b7251c to 607d446 Compare November 13, 2017 17:58
@john-bodley
Copy link
Member Author

@mistercrunch I've update the PR to remove all occurrences of backslashes in the string.

@mistercrunch mistercrunch merged commit ac57780 into apache:master Nov 14, 2017
@john-bodley
Copy link
Member Author

Woot!

@john-bodley john-bodley deleted the john-bodley-flake8-Q branch November 14, 2017 07:08
mistercrunch pushed a commit that referenced this pull request Nov 20, 2017
)

@classmethod
def convert_dttm(cls, target_type, dttm):
tt = target_type.upper()
if tt == 'DATE':
return "'{}'".format(dttm.strftime('%Y-%m-%d'))
return "{}'".format(dttm.strftime('%Y-%m-%d'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused: #4915

)

@classmethod
def convert_dttm(cls, target_type, dttm):
tt = target_type.upper()
if tt == 'DATE':
return "'{}'".format(dttm.strftime('%Y-%m-%d'))
return "{}'".format(dttm.strftime('%Y-%m-%d'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused: #4915

mistercrunch added a commit to mistercrunch/superset that referenced this pull request May 1, 2018
mistercrunch added a commit that referenced this pull request May 1, 2018
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
timifasubaa pushed a commit to timifasubaa/incubator-superset that referenced this pull request May 31, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0 labels Feb 27, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.21.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants