Skip to content

Implement basic linting for Travis - #4820

Merged
TomAugspurger merged 5 commits into
statsmodels:masterfrom
jbrockmendel:flaker
Aug 4, 2018
Merged

TomAugspurger merged 5 commits into
statsmodels:masterfrom
jbrockmendel:flaker

Conversation

@jbrockmendel

Copy link
Copy Markdown
Contributor

Fixes the couple of py3-incompatible print statements, leaves unfixed the hundred+ lurking NameErrors discussed in #4768.

@ChadFulton please. This shouldn't be like pulling teeth here.

@ChadFulton

Copy link
Copy Markdown
Member

This means Travis fails until all flake8 errors are gone?

@jbrockmendel

Copy link
Copy Markdown
Contributor Author

This means Travis fails until all flake8 errors are gone?

I left in F821 on the first run to make sure travis was running it correctly. When that one is removed, Travis will pass again. Then we can incrementally fix these and tighten the linting to ensure these errors don't sneak back in.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.006%) to 83.647% when pulling 1a1845a on jbrockmendel:flaker into 2c76850 on statsmodels:master.

@coveralls

coveralls commented Aug 1, 2018 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 83.683% when pulling 1eb8b5f on jbrockmendel:flaker into 2c76850 on statsmodels:master.

Comment thread lint.sh Outdated
RET=0

flake8 statsmodels --select=E901,E999,F822,F823,E111,E114
if [ $? -ne "0" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just exit $?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because I anticipate needing to add more calls as we incrementally fix stuff up. e.g.

flake8 statsmodels --select=F821 --exclude=LIST_OF_FILES_WE_INCREMENTALLY_FIX
if [ $? ...

flake8 statsmodels --select=??? --exclude=LIST_OF_FILES_WE_INCREMENTALLY_FIX
if [ $? ...

It's not pretty, but all-at-once fixes aren't really workable here.

Comment thread lint.sh Outdated

RET=0

flake8 statsmodels --select=E901,E999,F822,F823,E111,E114

@cclauss cclauss Aug 1, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably should add a comment: # TODO: Add F821 back in once all undefined names are resolved.

They are important as they each have the potential to raise NameError at runtime.

@TomAugspurger TomAugspurger Aug 1, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you move this to a setup.cfg, so that editors pick up the settings as well?

[flake8]
exclude=build,docs,examples,.git
select=E901,E999,...

Then you should just be able to have flake8 here.

@codecov-io

codecov-io commented Aug 1, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #4820 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4820   +/-   ##
=======================================
  Coverage   81.14%   81.14%           
=======================================
  Files         581      581           
  Lines       89901    89901           
  Branches    10041    10041           
=======================================
  Hits        72946    72946           
  Misses      14675    14675           
  Partials     2280     2280

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c76850...1eb8b5f. Read the comment docs.

@TomAugspurger TomAugspurger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small request to use a config file, +1 otherwise.

@josef-pkt

Copy link
Copy Markdown
Member

Based on the latest travis run, this would/could add quite a bit of test time.

I think we need to do the check only in a single environment instead of in each one.

@jbrockmendel

jbrockmendel commented Aug 1, 2018 •

Copy link
Copy Markdown
Contributor Author

I think we need to do the check only in a single environment instead of in each one.

Sounds good. Have a preference for which one?

@cclauss

cclauss commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

Again, flake8 should be run once on Python 2 and once on Python 3 because they have different syntaxes and therefore different Abstract Syntax Trees and therefore will produce different results. This is the note at the top of the first page of the flake8 docs.

@bashtage

bashtage commented Aug 2, 2018

Copy link
Copy Markdown
Member

Always +1 on using CI to improve quality.

@TomAugspurger

TomAugspurger commented Aug 3, 2018 •

Copy link
Copy Markdown
Contributor

Merging tomorrow if there are no objections.

@TomAugspurger
TomAugspurger merged commit 40f7b02 into statsmodels:master Aug 4, 2018
@jbrockmendel
jbrockmendel deleted the flaker branch August 13, 2018 22:01
@josef-pkt josef-pkt added this to the 0.10 milestone Sep 15, 2018
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.

8 participants