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 flake8-expression-complexity #291

Merged
merged 8 commits into from
Nov 23, 2021
Merged

Conversation

fealho
Copy link
Member

@fealho fealho commented Nov 10, 2021

As part of #80, added flake8-expression-complexity addon and adapted our code to follow this style check.

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

Merging #291 (961a6a4) into issue-278-base (88909fe) will decrease coverage by 0.07%.
The diff coverage is 66.66%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           issue-278-base     #291      +/-   ##
==================================================
- Coverage           87.25%   87.17%   -0.08%     
==================================================
  Files                  27       27              
  Lines                1702     1707       +5     
==================================================
+ Hits                 1485     1488       +3     
- Misses                217      219       +2     
Impacted Files Coverage Δ
copulas/optimize/__init__.py 92.30% <0.00%> (-2.94%) ⬇️
copulas/bivariate/base.py 86.98% <100.00%> (+0.08%) ⬆️
copulas/multivariate/tree.py 96.97% <100.00%> (+<0.01%) ⬆️
copulas/multivariate/vine.py 99.32% <100.00%> (+<0.01%) ⬆️

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 88909fe...961a6a4. Read the comment docs.

@fealho fealho changed the base branch from issue-278-base to master November 17, 2021 15:40
@fealho fealho changed the base branch from master to issue-278-base November 17, 2021 15:40
tasks.py Outdated
@@ -115,8 +115,8 @@ def tutorials(c):
@task
def lint(c):
check_dependencies(c)
c.run('flake8 copulas')
c.run('flake8 tests --ignore=D,SFS2')
c.run('flake8 copulas --max-expression-complexity=8')
Copy link
Member Author

Choose a reason for hiding this comment

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

The standard limit is 7, but around 10 expressions have complexity of 7.5. Since it seemed silly to decrease the complexity of the expressions (they are just implementations of equations) I increased the cap.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to put this in a config instead of in the command?

Copy link
Contributor

Choose a reason for hiding this comment

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

@fealho can you point at some of these expressions?
In general the complexity can be decreased by capturing some things in intermediate variables, so I suspect we would want to do that.

Copy link
Member Author

@fealho fealho Nov 22, 2021

Choose a reason for hiding this comment

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

Sure, I moved the limit back to 7 and I added the intermediate variables (you can check the specific examples in the code), I just think it doesn't necessarily improve code readability. I'm fine with it either way though.

@fealho fealho marked this pull request as ready for review November 17, 2021 15:43
@fealho fealho requested a review from a team as a code owner November 17, 2021 15:43
@fealho fealho requested review from amontanez24 and csala and removed request for a team November 17, 2021 15:43
@fealho fealho merged commit 02de85b into issue-278-base Nov 23, 2021
@fealho fealho deleted the issue-278-complexity branch November 23, 2021 01:20
fealho added a commit that referenced this pull request Nov 24, 2021
* Add working libraries

* Add addon

* Remove pydocstyle

* Fix unrelated error

* Make double quotes into single (#289)

* Add `flake8-eradicate` (#293)

* Add addon

* Remove paranthesis because the addon thinks they are code

* Add addon

* Remove paranthesis because the addon thinks they are code

* Add `flake8-builtins` (#296)

* Add addon

* Update code according to addon

* Add addon

* Update code according to addon

* Add `pandas-vet` (#299)

* Add addon

* Update code according to addon

* Add addon

* Update code according to addon

* Add absolute import

* Add sfs (#305)

* Add `flake8-multiline-containers` (#290)

* Not sure what to do about these

* Add noqa's where necessary

* Not sure what to do about these

* Add noqa's where necessary

* Address feedback

* Add `flake8-expression-complexity` (#291)

* Add addon

* Change the complexity limit to 8 from 7

* Add addon

* Change the complexity limit to 8 from 7

* Fix complexity

* Rename + remove unnecessary argsort

* Add `flake8-print` (#292)

* Add addon

* Address feedback

* Add `flake8-comprehensions` (#295)

* Add addon

* Fix code according to addon

* Add addon

* Fix code according to addon

* Fix errors

* Fix set as literal

* Address feedback

* Add `pytest-style` (#297)

* Add addon

* Update code according to addon

* Add addon

* Update code according to addon

* Fix errors

* Delete pytest

* Address feedback

* Add `flake8-docstrings` (#301)

* Add addon

* Update code according to addon

* Add addon

* Update code according to addon

* Update code according to pydocstyle

* Fixes

* Fix errors

* Update docstrings

* Fix typos

* Add addon and ignore erros (#304)

* Add `flake8-dlint` (#300)

* Add addon

* Ignore error

* Add addon

* Ignore error

* Add `pep8-naming` (#298)

* Add addon

* Ignore all the variable names

* Add addon

* Ignore all the variable names

* Move ignores to setup.cfg

* Add `flake8-fixme` (#294)

* Add addon

* Remove fixme

* Add addon

* Remove fixme

* Fix bug

* Fix details
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

5 participants