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

Add linting stage to Travis CI build #55

Merged
merged 9 commits into from
Apr 22, 2019
Merged

Add linting stage to Travis CI build #55

merged 9 commits into from
Apr 22, 2019

Conversation

daneah
Copy link
Member

@daneah daneah commented Apr 21, 2019

This change is a: (check at least one)

  • Bugfix
  • Feature addition
  • Code style update
  • Refactor
  • Release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the:

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite passing?
  • Code coverage maximal?
  • Changelog up to date?

What does this change address?
Makes use of the concept of "stages" on Travis CI. There is one stage
each here for linting, testing, and deploying. The deploy stage is now
cut off at the pass if the target is not a tag from the master branch,
so the build should be slightly faster.

How does this change work?

  • Install black for consistent code formatting
  • Run black --check on the code to see if it's been properly formatted, failing if not
  • Install pyflakes for static analysis
  • Run pyflakes on the code, failing if any errors found

Screenshot 2019-04-22 10 31 35

Makes use of the concept of "stages" on Travis CI. There is one stage
each here for linting, testing, and deploying. The deploy stage is now
cut off at the pass if the target is not a tag from the master branch,
so the build should be slightly faster.
@daneah daneah added the ✨ enhancement New feature or request label Apr 21, 2019
Stages get the first Python listed by default, but black can only run in
Python 3.6+. Also make sure that black checks against 3.4-compatible
syntax (black should also be run with this flag when transforming
files).
Reformat the code using black to establish the baseline. Used `black -t
py34 apiron tests` to produce the change.
black requires Python 3.6+ and won't even install in lower versions.
Remove black from dev-requirements.txt and only install it manually in
the lint stage where Python 3.6+ is guaranteed.
Add comments to .travis.yml for clarity.
Add `pyflakes` to linting stage and fix import warnings it was raising.
I had previously said `import *` was fine in apiron/__init__.py, but
pyflakes does get mad about that. Explode that out to the items that
really are there, and list them out explicitly in `__all__`.
@daneah daneah requested a review from a team April 21, 2019 15:39
* Use `pyproject.toml` to configure black for all supported Python
versions; this reduces likelihood of running black the wrong way
* Increase line length to 120 for consistency with existing code style
Copy link
Contributor

@michael-iden michael-iden left a comment

Choose a reason for hiding this comment

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

Reformatting looks good.

Copy link

@maddy531 maddy531 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@daneah daneah merged commit 820a941 into dev Apr 22, 2019
@daneah daneah deleted the add-lint-stage branch April 22, 2019 14:41
eslawski pushed a commit that referenced this pull request Jun 5, 2019
* Add linting stage to Travis CI build

Makes use of the concept of "stages" on Travis CI. There is one stage
each here for linting, testing, and deploying. The deploy stage is now
cut off at the pass if the target is not a tag from the master branch,
so the build should be slightly faster.

* Reorder Pythons in Travis CI matrix and target 3.4 with black

Stages get the first Python listed by default, but black can only run in
Python 3.6+. Also make sure that black checks against 3.4-compatible
syntax (black should also be run with this flag when transforming
files).

* Process code using black

Reformat the code using black to establish the baseline. Used `black -t
py34 apiron tests` to produce the change.

* Install black in lint stage only

black requires Python 3.6+ and won't even install in lower versions.
Remove black from dev-requirements.txt and only install it manually in
the lint stage where Python 3.6+ is guaranteed.

* Document .travis.yml sections

Add comments to .travis.yml for clarity.

* Add note about black to CONTRIBUTING.md

* Add pyflakes checks to linting stage

Add `pyflakes` to linting stage and fix import warnings it was raising.
I had previously said `import *` was fine in apiron/__init__.py, but
pyflakes does get mad about that. Explode that out to the items that
really are there, and list them out explicitly in `__all__`.

* Blackify apiron/__init__.py

* Update black configuration

* Use `pyproject.toml` to configure black for all supported Python
versions; this reduces likelihood of running black the wrong way
* Increase line length to 120 for consistency with existing code style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants