-
Notifications
You must be signed in to change notification settings - Fork 87
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
Consistent 0-based line tracking for linters #1855
Conversation
…racking. Lines are now 1-based everywhere instead of a mix of 0-based and 1-based. In addition an off-by-one error in the offset tracking for notebook cells has been fixed.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1855 +/- ##
==========================================
- Coverage 89.27% 89.26% -0.01%
==========================================
Files 95 95
Lines 12007 12022 +15
Branches 2108 2110 +2
==========================================
+ Hits 10719 10732 +13
- Misses 877 879 +2
Partials 411 411 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything has to be zero-based
❌ 188/189 passed, 1 failed, 23 skipped, 3h53m2s total ❌ test_job_linter_some_notebook_graph_with_problems: AssertionError: assert {'second_note.../mnt/foo/bar'} == {'second_note.../mnt/foo/bar'} (17.707s)
Running from acceptance #3799 |
## Changes This PR is stacked on #1855 and includes the following changes: - Updates the fixtures for the functional linter tests so that the expected offsets are correct. - Updates the functional tests to also validate the region offsets are as expected. - The test itself has also been updated so that test failures are reported as lists of missing/unexpected comments in the form used by the functional tests. ### Tests - [ ] manually tested - [X] added unit tests - [ ] added integration tests - [ ] verified on staging environment (screenshot attached)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
* Added migration for Python linters from `ast` (standard library) to `astroid` package ([#1835](#1835)). In this release, the Python linters have been migrated from the `ast` package in the standard library to the `astroid` package, version 3.2.2 or higher, with minimal inference implementation. This change includes updates to the `pyproject.toml` file to include `astroid` as a dependency and bump the version of `pylint`. No changes have been made to user documentation, CLI commands, workflows, or tables. Testing has been conducted through the addition of unit tests. This update aims to improve the functionality and accuracy of the Python linters. * Added workflow linter for delta live tables task ([#1825](#1825)). In this release, there are updates to the `_register_pipeline_task` method in the `jobs.py` file. The method now checks for the existence of the pipeline and its libraries, and registers each notebook or jar library found in the pipeline as a task. If the library is a Maven or file type, it will raise a `DependencyProblem` as it is not yet implemented. Additionally, new functions and tests have been added to improve the quality and functionality of the project, including a workflow linter for Delta Live Tables (DLT) tasks and a linter that checks for issues with specified DLT tasks. A new method, `test_workflow_linter_dlt_pipeline_task`, has been added to test the workflow linter for DLT tasks, verifying the correct creation and functioning of the pipeline task and checking the building of the dependency graph for the task. These changes enhance the project's ability to ensure the proper configuration and correctness of DLT tasks and prevent potential issues. * Consistent 0-based line tracking for linters ([#1855](#1855)). 0-based line tracking has been consistently implemented for linters in various files and methods throughout the project, addressing issue [#1855](#1855). This change includes removing direct filesystem references in favor of using the Unity Catalog for table migration and format changes. It also updates comments and warnings to improve clarity and consistency. In particular, the spark-table.py file has been updated to ensure that the spark.log.level is set correctly for UC Shared Clusters, and that the Spark Driver JVM is no longer accessed directly. The new file, simple_notebook.py, demonstrates the consistent line tracking for linters across different cell types, such as Python, Markdown, SQL, Scala, Shell, Pip, and Python (with magic commands). These changes aim to improve the accuracy and reliability of linters, making the codebase more maintainable and adaptable. Dependency updates: * Updated sqlglot requirement from <24.2,>=23.9 to >=23.9,<25.1 ([#1856](#1856)).
* Added migration for Python linters from `ast` (standard library) to `astroid` package ([#1835](#1835)). In this release, the Python linters have been migrated from the `ast` package in the standard library to the `astroid` package, version 3.2.2 or higher, with minimal inference implementation. This change includes updates to the `pyproject.toml` file to include `astroid` as a dependency and bump the version of `pylint`. No changes have been made to user documentation, CLI commands, workflows, or tables. Testing has been conducted through the addition of unit tests. This update aims to improve the functionality and accuracy of the Python linters. * Added workflow linter for delta live tables task ([#1825](#1825)). In this release, there are updates to the `_register_pipeline_task` method in the `jobs.py` file. The method now checks for the existence of the pipeline and its libraries, and registers each notebook or jar library found in the pipeline as a task. If the library is a Maven or file type, it will raise a `DependencyProblem` as it is not yet implemented. Additionally, new functions and tests have been added to improve the quality and functionality of the project, including a workflow linter for Delta Live Tables (DLT) tasks and a linter that checks for issues with specified DLT tasks. A new method, `test_workflow_linter_dlt_pipeline_task`, has been added to test the workflow linter for DLT tasks, verifying the correct creation and functioning of the pipeline task and checking the building of the dependency graph for the task. These changes enhance the project's ability to ensure the proper configuration and correctness of DLT tasks and prevent potential issues. * Consistent 0-based line tracking for linters ([#1855](#1855)). 0-based line tracking has been consistently implemented for linters in various files and methods throughout the project, addressing issue [#1855](#1855). This change includes removing direct filesystem references in favor of using the Unity Catalog for table migration and format changes. It also updates comments and warnings to improve clarity and consistency. In particular, the spark-table.py file has been updated to ensure that the spark.log.level is set correctly for UC Shared Clusters, and that the Spark Driver JVM is no longer accessed directly. The new file, simple_notebook.py, demonstrates the consistent line tracking for linters across different cell types, such as Python, Markdown, SQL, Scala, Shell, Pip, and Python (with magic commands). These changes aim to improve the accuracy and reliability of linters, making the codebase more maintainable and adaptable. Dependency updates: * Updated sqlglot requirement from <24.2,>=23.9 to >=23.9,<25.1 ([#1856](#1856)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment
Changes
This PR includes the following changes with respect to how line information is tracked and reported by the linting code:
For notebooks, there is an issue of what the position information means: for now the line position will refer to the 0-based line number in the underlying notebook file. (There is a related issue with respect to tracking column positions for
MAGIC
cells, but that is unaddressed by this PR.)Linked issues
Blocks #1843.