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

chore(pylint): Remove top-level disable #16589

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Sep 4, 2021

SUMMARY

Generally top-level Pylint disable should be discouraged (except for a few necessary exceptions related to imports and number of lines) as they can mask a number of issues. This PR moves top-level Pylint disable messages to the relevant scope (and fixes a number of issues which surfaced by doing so).

Note the bulk of the changes are in superset/viz.py which I gather could be slated for deprecation.

TESTING INSTRUCTIONS

CI.

ADDITIONAL INFORMATION

  • Has associated issue: [SIP-59] Proposal for Database migration standards #13351
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch from 20a8566 to 1ecd28d Compare September 4, 2021 06:20
@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch 3 times, most recently from e264479 to 50fd6a3 Compare September 4, 2021 15:47
@codecov
Copy link

codecov bot commented Sep 4, 2021

Codecov Report

Merging #16589 (cecb7ec) into master (ad60c0c) will decrease coverage by 0.17%.
The diff coverage is 60.72%.

❗ Current head cecb7ec differs from pull request most recent head 02f2710. Consider uploading reports for the commit 02f2710 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16589      +/-   ##
==========================================
- Coverage   76.93%   76.76%   -0.18%     
==========================================
  Files        1007     1007              
  Lines       54112    54101      -11     
  Branches     7346     7367      +21     
==========================================
- Hits        41633    41531     -102     
- Misses      12239    12330      +91     
  Partials      240      240              
Flag Coverage Δ
hive ?
mysql 81.75% <54.81%> (+0.10%) ⬆️
postgres 81.81% <54.81%> (+0.10%) ⬆️
presto ?
python 81.90% <54.81%> (-0.36%) ⬇️
sqlite 81.42% <54.81%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntend/src/explore/components/ExploreChartPanel.jsx 14.28% <0.00%> (-0.72%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/viz.py 57.85% <44.38%> (+0.42%) ⬆️
...perset-frontend/src/addSlice/AddSliceContainer.tsx 60.00% <50.00%> (+3.07%) ⬆️
...ontrols/DndColumnSelectControl/DndFilterSelect.tsx 51.97% <75.00%> (+0.64%) ⬆️
superset/models/core.py 89.00% <90.00%> (-0.41%) ⬇️
superset/tasks/async_queries.py 96.96% <90.90%> (ø)
superset-frontend/src/components/Select/Select.tsx 91.66% <97.05%> (+1.70%) ⬆️
superset-frontend/src/components/Select/utils.ts 96.15% <100.00%> (ø)
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 73.27% <100.00%> (+0.07%) ⬆️
... and 34 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 ad60c0c...02f2710. Read the comment docs.

@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch from 50fd6a3 to 2a00cf1 Compare September 5, 2021 04:28
from superset.utils.public_interfaces import compute_hash, get_warning_message
from tests.integration_tests.base_tests import SupersetTestCase
Copy link
Member Author

Choose a reason for hiding this comment

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

Unused.

hashes = {
dummy_sql_query_mutator: "Kv%NM3b;7BcpoD2wbPkW",
}
hashes: Dict[Callable[..., Any], str] = {}
Copy link
Member Author

Choose a reason for hiding this comment

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

There was issues in referencing the `app.config["SQL_QUERY_MUTATOR"] because i) the app was the test rather than the default config, and ii) the test wasn't running within an app context. Furthermore it's unclear why the default SQL query mutator was needed explicit checking compared to say any other of the default interfaces.

@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch 2 times, most recently from bc8e960 to 13ca5c4 Compare September 13, 2021 20:55
@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch from 13ca5c4 to 11059cf Compare September 13, 2021 22:49
@john-bodley john-bodley force-pushed the john-bodley--pylint-remove-top-level-disable branch from 8f5ba9f to 02f2710 Compare September 14, 2021 16:28
@@ -52,25 +50,13 @@
from superset.utils.dates import now_as_float
from superset.utils.decorators import stats_timing


# pylint: disable=unused-argument, redefined-outer-name
def dummy_sql_query_mutator(
Copy link
Member Author

Choose a reason for hiding this comment

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

Note I don't believe moving this is to config.py is a breaking change since any custom logic would already be defined in a custom config override.

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -984,7 +985,14 @@ def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC(
# def SQL_QUERY_MUTATOR(sql, user_name, security_manager, database):
# dttm = datetime.now().isoformat()
# return f"-- [SQL LAB] {username} {dttm}\n{sql}"
SQL_QUERY_MUTATOR = None
def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument
Copy link
Member

Choose a reason for hiding this comment

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

Which one is the invalid-name?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ktmud Pylint doesn’t like capitals in function names.

@john-bodley john-bodley merged commit fb4650a into apache:master Sep 15, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* chore(pylint): Remove top-level disable

* Update examples.py

* Update command.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* chore(pylint): Remove top-level disable

* Update examples.py

* Update command.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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/XXL 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants