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

refactor: Re-enable pylint on 5 files #10106

Merged
merged 11 commits into from
Jun 25, 2020

Conversation

willbarrett
Copy link
Member

SUMMARY

Re-enables pylint on 5 files with global disables. Some checks are fixed, others disabled on a per-instance basis.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

CI, PR review

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

Reviewers

@john-bodley @craig-rueda @dpgaspar

) # pylint: disable=attribute-defined-outside-init
dbcol.avg = (
dbcol.is_numeric
) # pylint: disable=attribute-defined-outside-init
Copy link
Member Author

Choose a reason for hiding this comment

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

OK, what's the deal with these two attributes? Is this cruft? Can I kill it? does anyone know?

Copy link
Member

Choose a reason for hiding this comment

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

Yay pylint paying dividends. I think these could be annexed as they don't seem to be part of the TableColumn class nor seem to be used.

Copy link
Member

Choose a reason for hiding this comment

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

I think that the comment applies to the block, meaning you can:

# pylint: disable=attribute-defined-outside-init
dbcol.sum = dbcol.is_numeric
dbcol.avg = dbcol.is_numeric

https://docs.pylint.org/en/1.6.0/faq.html#is-it-possible-to-locally-disable-a-particular-message

It'd be nice to have more scoping options in pylint, but block is a good place to start.

Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks @willbarrett for tackling this.

superset/connectors/sqla/models.py Outdated Show resolved Hide resolved
superset/connectors/sqla/models.py Outdated Show resolved Hide resolved
@@ -924,9 +934,15 @@ def get_sqla_query( # sqla
elif op == utils.FilterOperator.LIKE.value:
where_clause_and.append(col_obj.get_sqla_col().like(eq))
elif op == utils.FilterOperator.IS_NULL.value:
where_clause_and.append(col_obj.get_sqla_col() == None)
where_clause_and.append(
col_obj.get_sqla_col() # pylint: disable=singleton-comparison
Copy link
Member

Choose a reason for hiding this comment

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

I think is None and is not None will resolve lines 938 and 943 respectively.

Copy link
Member Author

Choose a reason for hiding this comment

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

You know, I thought about that, even tried it, and I'm pretty sure that'll break the function:

>>> from sqlalchemy.sql import column
>>> column("test") is not None
True
>>> column("test") is None
False
>>> column("test") == None
<sqlalchemy.sql.elements.BinaryExpression object at 0x108445e48>
>>> column("test") != None
<sqlalchemy.sql.elements.BinaryExpression object at 0x108450668>

I believe this is building up a where clause, not returning booleans.

) # pylint: disable=attribute-defined-outside-init
dbcol.avg = (
dbcol.is_numeric
) # pylint: disable=attribute-defined-outside-init
Copy link
Member

Choose a reason for hiding this comment

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

Yay pylint paying dividends. I think these could be annexed as they don't seem to be part of the TableColumn class nor seem to be used.

superset/connectors/sqla/models.py Outdated Show resolved Hide resolved
superset/connectors/sqla/models.py Outdated Show resolved Hide resolved
superset/connectors/sqla/views.py Outdated Show resolved Hide resolved
superset/security/manager.py Outdated Show resolved Hide resolved
superset/security/manager.py Outdated Show resolved Hide resolved
Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of comments

superset/connectors/sqla/models.py Show resolved Hide resolved
superset/connectors/sqla/views.py Outdated Show resolved Hide resolved
superset/result_set.py Outdated Show resolved Hide resolved
superset/security/manager.py Outdated Show resolved Hide resolved
superset/security/manager.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2020

Codecov Report

Merging #10106 into master will increase coverage by 5.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10106      +/-   ##
==========================================
+ Coverage   65.79%   70.89%   +5.09%     
==========================================
  Files         590      400     -190     
  Lines       31152    12909   -18243     
  Branches     3169     3174       +5     
==========================================
- Hits        20497     9152   -11345     
+ Misses      10477     3641    -6836     
+ Partials      178      116      -62     
Flag Coverage Δ
#cypress 53.49% <ø> (?)
#javascript 59.62% <ø> (+0.06%) ⬆️
#python ?
Impacted Files Coverage Δ
superset/views/chart/filters.py
superset/models/sql_lab.py
superset/commands/utils.py
superset/queries/filters.py
superset/sql_parse.py
superset/common/tags.py
superset/examples/deck.py
superset/db_engine_specs/kylin.py
superset/views/api.py
superset/extensions.py
... and 323 more

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 a6390af...5fad2de. Read the comment docs.

@willbarrett
Copy link
Member Author

I think I've addressed comments - ready for another pass.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM

@villebro villebro added the v0.37 label Jun 25, 2020
@willbarrett willbarrett merged commit 0017b61 into apache:master Jun 25, 2020
@willbarrett willbarrett deleted the wbarrett/lint-it branch June 25, 2020 18:14
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* Re-enable lint on 5 files

* revert something questionable

* Address PR feedback

* One more PR comment...

* black?

* Update code wrapping

* Disable bugged check

* Add a disable for a failure that's only showing up in CI.

* Fix bad refactor

* A little more lint fixing, bug fixing
@mistercrunch mistercrunch added the 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v0.37 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants