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

Lint fixes #37

Merged
merged 4 commits into from
Jun 3, 2019
Merged

Lint fixes #37

merged 4 commits into from
Jun 3, 2019

Conversation

ayan-b
Copy link
Collaborator

@ayan-b ayan-b commented May 31, 2019

No description provided.

@ayan-b
Copy link
Collaborator Author

ayan-b commented May 31, 2019

@yunhailuo This PR is ready. Please review. 😊

@yunhailuo
Copy link
Collaborator

Sorry. Just re-organized travis code. Please rebase.

setup.cfg Outdated Show resolved Hide resolved
@ayan-b
Copy link
Collaborator Author

ayan-b commented May 31, 2019

Rebased. :)

@ayan-b
Copy link
Collaborator Author

ayan-b commented May 31, 2019

Please take a look @yunhailuo.

@yunhailuo
Copy link
Collaborator

I have some hesitation on how we would ignore rules. Like W503 should be ignored as they said so. But others, overall ignores in config or inline ignore, I'd prefer to be careful and specific. By being specific, I mean

  • Overall ignore should be restricted unless there is clear reason to do so;
  • Inline ignore should be specific to certain rule(s).

This is my general thinking. We will need some discussions like:

  • Which rule(s) should definitely be ignored for all? Only W503?
  • Is it overwhelming if for some rules, which are not really ignore for all, are too many for inline?
  • ...

xena_gdc_etl/constants.py Outdated Show resolved Hide resolved
@yunhailuo
Copy link
Collaborator

Looks good. Let me know your thoughts on global ignore when you are ready.

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

Global Ignores:

  • W605 (invalid escape sequence '*'): Quite a few docstrings use \*\*, so its ignored.
  • E722 (do not use bare 'except'): Some except is bare, so its ignored. I think we can use local ignore here. No longer ignoring globally.
  • E121 (continuation line under-indented for hanging indent) No longer ignoring globally.
  • E126 (continuation line over-indented for hanging indent) No longer ignoring globally.

Local Ignores:

  • E203 (whitespace before ':'): Not PEP8 compliant for slicing.

@yunhailuo
Copy link
Collaborator

  • Quite a few docstrings use */*/

An example?

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

02b9ead uses black to format code: black -l 79 -S xena_gdc_etl tests.

@yunhailuo
Copy link
Collaborator

Thanks for the example. Looked into W605 a little bit. In the long run, it may become SyntaxError. We should not ignore it. It seems make docstring a raw string will fix it. I haven't try though. I saw only four in xena_dataset.py.

@yunhailuo
Copy link
Collaborator

02b9ead uses black to format code: black -l 79 -S xena_gdc_etl tests.

What is black? A link for intro or doc?

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

No longer ignoring W605.

Copy link
Collaborator

@yunhailuo yunhailuo left a comment

Choose a reason for hiding this comment

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

I actually like quite some changes made by black here. But some are confusing to me. I guess the question is what it is and if they are really official. We can follow it since it's kind of official/good. But I don't think we have to following it 100%. I'd say we could have a few small tweaks.

I went through most but it's a lot and I probably didn't cover all details. The good part though is you help us with tests so that we could be confident about it working.

My suggestion is make changes by black (both auto and manual tweaks after) a single independent commit. That way we might, though less likely, be able to revert it later if needed.

xena_gdc_etl/constants.py Outdated Show resolved Hide resolved
xena_gdc_etl/gdc.py Show resolved Hide resolved
# samples_json.append(r)
# for r in res:
# r.setdefault('samples', [{}])
# samples_json.append(r)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we just delete these three lines? I'd like to but need a second opinion.

xena_gdc_etl/gdc.py Show resolved Hide resolved
xena_gdc_etl/main.py Show resolved Hide resolved
xena_gdc_etl/xena_dataset.py Outdated Show resolved Hide resolved
xena_gdc_etl/xena_dataset.py Outdated Show resolved Hide resolved
xena_gdc_etl/xena_dataset.py Show resolved Hide resolved
xena_gdc_etl/xena_dataset.py Show resolved Hide resolved
@yunhailuo
Copy link
Collaborator

@yunhailuo black: https://black.readthedocs.io/

Thanks. Seems like a good tool to have and use.

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

I guess the question is what it is and if they are really official.

black claims their styles are subset to PEP8. In fact, the code is actually hosted in the Python org. https://github.com/python/black

@ayan-b
Copy link
Collaborator Author

ayan-b commented Jun 3, 2019

Now all the black lint fixes are in 866d14b.

@yunhailuo
Copy link
Collaborator

Looks good. Really a lot of changes. Great job!

@yunhailuo yunhailuo merged commit 18590a4 into ucscXena:master Jun 3, 2019
@ayan-b ayan-b deleted the lint-fix branch June 3, 2019 18:12
@ayan-b ayan-b restored the lint-fix branch June 8, 2019 15:58
@ayan-b ayan-b deleted the lint-fix branch June 8, 2019 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants