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

TST: Add pytest-flake8 to travis tests #38

Merged
merged 15 commits into from
Apr 21, 2020
Merged

TST: Add pytest-flake8 to travis tests #38

merged 15 commits into from
Apr 21, 2020

Conversation

jklenzing
Copy link
Member

@jklenzing jklenzing commented Apr 20, 2020

Description

Adds flake8 testing to the Travis CI tests.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

How Has This Been Tested?

Tested via Travis CI.

Checklist:

  • Make sure you are merging into the develop (not master) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes

Notes

  • W503 and W504 (line breaks and operators) are mutually exclusive. Ignoring W503 to better match PEP8 standards.

@jklenzing jklenzing changed the title Flake8 TST: Add pytest-flake8 to travis tests Apr 20, 2020
@jklenzing
Copy link
Member Author

Leaving code as is to show how the interface works. Current flake8 issues listed here (starting at line 750): https://travis-ci.org/github/pysat/pysatModels/jobs/677321154

@jklenzing jklenzing marked this pull request as draft April 20, 2020 16:15
@jklenzing jklenzing requested a review from aburrell April 20, 2020 16:15
Style changes made to remove errors from the flake8 CI test.
@aburrell
Copy link
Member

The only problem I am not sure how to solve is the 'import not used' when importing things with __init__.py.

Fixed bug where the wrong number of parenthesis were used to close the statement.
Changing the way indents for appropriate line lengths are performed.
@jklenzing
Copy link
Member Author

The only problem I am not sure how to solve is the 'import not used' when importing things with __init__.py.

Two ways of solving this:

  • In sami2py, we've added # noqa: F401 as a comment to each of the import lines. This tells flake8 that we have decided to skip F401 on this line only (noqa == no quality assurance)
  • A global ignore for F401 can be added, though this will turn this off everywhere,

Poking around in other packages, the noqa route seems to be the one to take, which is why we used it in sami2py.

@jklenzing jklenzing marked this pull request as ready for review April 20, 2020 19:28
Copy link
Member

@aburrell aburrell left a comment

Choose a reason for hiding this comment

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

I'd like the contributing documentation to be improved. Doing it myself in the next commit.

CONTRIBUTING.md Outdated Show resolved Hide resolved
Changed line length to be less than 80 characters when possible.   Added
useful links to help avoid confusion.  Fixed testing example so that I could run
it.  Added information about desired commit comment style.
Fixed bugs in markdown style.
Fixed the markdown codeblock bugs as well as more of the hyperlinks.
Removed trailing `>` on two links.
Footnote was using RST style and not markdown style
Removed footnote in CONTRIBUTING.md due to GitHub: github/markup#498.
@aburrell
Copy link
Member

Ok, I had to make a compromise with the CONTRIBUTING.md rendering. Eventually this may be improved: miyakogi/m2r#53.

@aburrell
Copy link
Member

@jklenzing @rstoneback @asher-pembroke : you all may want to take a look at the changes I made to the CONTRIBUTING.md file, given that this was likely copy-pasted from pysat and therefore the same changes may be useful there (and in the other pysat projects).

@aburrell aburrell merged commit 43f5b17 into develop Apr 21, 2020
@aburrell aburrell deleted the flake8 branch April 21, 2020 13:33
@jklenzing
Copy link
Member Author

Some weird formatting stuff in readthedocs for contributing:
https://pysatmodels.readthedocs.io/en/flake8/develop_guide/contributing.html

I wonder if we should just use rst instead of markdown for the contributing doc to aid in the import.

@aburrell
Copy link
Member

Yes, that's the issue I referenced above. I think it would be simpler all around to switch to RST, especially since GitHub has its own flavour of markdown.

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.

2 participants