Skip to content

Running flake8 tests show 101 undefined names - #4768

Closed
cclauss wants to merge 2 commits into
statsmodels:masterfrom
cclauss:patch-1
Closed

cclauss wants to merge 2 commits into
statsmodels:masterfrom
cclauss:patch-1

Conversation

@cclauss

@cclauss cclauss commented Jun 29, 2018

Copy link
Copy Markdown
Contributor

In Python 3 there will be even more than Python 2.

Each undefined name has the possibility of raising NameError at runtime.

cclauss added 2 commits June 29, 2018 09:11
In Python 3 there will be even more than Python 2.

Each __undefined name__ has the possibility of raising _NameError_ at runtime.
@jbrockmendel

Copy link
Copy Markdown
Contributor

Very much +1 for fixing these (cc @josef-pkt).

Comment thread .travis.yml
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

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.

How strong is your preference for 127 over 80?

@cclauss cclauss Jul 2, 2018 •

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.

Flake8 default is 79... I ususally bang my code through Black which autoformats to 88 characters. I usually bump it up to the width of the GitHub editor (127) when testing a new repo to not clog up the error reports. We can set it to max-line-length=80 if that is the standard for statsmodels.

Comment thread .travis.yml
- pip install flake8
- echo -n "flake8 testing of ${URL} on " ; python -V
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

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 some of this go in a setup.cfg file? That's the direction we should be moving in medium-term anyway.

Comment thread .travis.yml
- python setup.py build_ext --inplace
- python setup.py develop

before_script:

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.

Can this whole thing go into something like a lint.sh file? I'd like to be able to a) run it locally and b) make it increasingly strict over time as incremental cleanup occurs.

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.

Sure that is doable.

@cclauss

cclauss commented Jul 31, 2018 •

Copy link
Copy Markdown
Contributor Author

Closing... @jbrockmendel if you want to add flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics somewhere else in the testing process, please try to do so in a different pull request but the stats are getting worse...

flake8 testing of https://github.com/statsmodels/statsmodels on Python 3.7.0

6     E999 SyntaxError: invalid syntax
112   F821 undefined name 'options'
118

@cclauss cclauss closed this Jul 31, 2018
@cclauss
cclauss deleted the patch-1 branch July 31, 2018 21:51
@jbrockmendel

Copy link
Copy Markdown
Contributor

Closing...

How come? This is a great idea.

@cclauss

cclauss commented Jul 31, 2018 •

Copy link
Copy Markdown
Contributor Author

I know that you have the knowledge to put this test in the right place in the process and the passion to see it done correctly and it gets updated as progress is made. You can do it. If you get stuck, then ping me. It should be run once on Python 2 and once on Python 3 because they produce different results.

@bashtage bashtage added the rejected Used for PRs with changes that are not acceptable label Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants