mirror of
https://github.com/apache/superset.git
synced 2026-06-02 14:19:21 +00:00
fix: sqlglot linter (#33849)
This commit is contained in:
@@ -87,9 +87,12 @@ class SQLParsingLibraryImportChecker(BaseChecker):
|
||||
def _is_disallowed(self, file_path: Path, root_mod: str) -> bool:
|
||||
# True if sqlglot is imported outside superset/sql,
|
||||
# or if any forbidden library is imported anywhere
|
||||
in_superset_sql = file_path.match("**/superset/sql/**/*.py") or file_path.match(
|
||||
"**/superset/sql/*.py"
|
||||
)
|
||||
allowed = {
|
||||
"**/supersql/sql/**/*.py",
|
||||
"**/supersql/sql/*.py",
|
||||
"**/superset/config.py",
|
||||
}
|
||||
in_superset_sql = any(file_path.match(pattern) for pattern in allowed)
|
||||
return (root_mod == "sqlglot" and not in_superset_sql) or root_mod in {
|
||||
"sqlparse",
|
||||
"sqloxide",
|
||||
|
||||
Reference in New Issue
Block a user