Skip to content

Commit 1ad3649

Browse files
authored
Ignore failed inference codes when presenting results to Databricks Runtime (#3087)
This PR disables the following advice codes from being propagated in our notebook editor: - 'cannot-autofix-table-reference', - 'default-format-changed-in-dbr8', - 'dependency-not-found', - 'not-supported', - 'notebook-run-cannot-compute-value', - 'sql-parse-error', - 'sys-path-cannot-compute-value', - 'unsupported-magic-line',
1 parent baefc8f commit 1ad3649

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/databricks/labs/ucx/source_code/lsp_plugin.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
logger = logging.getLogger(__name__)
1616

1717

18+
DEBUG_MESSAGE_CODES = {
19+
'cannot-autofix-table-reference',
20+
'default-format-changed-in-dbr8',
21+
'dependency-not-found',
22+
'not-supported',
23+
'notebook-run-cannot-compute-value',
24+
'sql-parse-error',
25+
'sys-path-cannot-compute-value',
26+
'unsupported-magic-line',
27+
}
28+
29+
1830
@hookimpl
1931
def pylsp_lint(config: Config, document: Document) -> list[dict]:
2032
cfg = config.plugin_settings('pylsp_ucx', document_path=document.uri)
@@ -29,7 +41,7 @@ def pylsp_lint(config: Config, document: Document) -> list[dict]:
2941
languages = LinterContext(index=migration_index, session_state=session_state)
3042
analyser = languages.linter(Language.PYTHON)
3143
code = document.source
32-
diagnostics = [Diagnostic.from_advice(_) for _ in analyser.lint(code)]
44+
diagnostics = [Diagnostic.from_advice(_) for _ in analyser.lint(code) if _.code not in DEBUG_MESSAGE_CODES]
3345
return [d.as_dict() for d in diagnostics]
3446

3547

0 commit comments

Comments
 (0)