cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing Ruff linter in Gitlab CI/CD for Databrick notebooks

bomb_omb
New Contributor II

Hi all, I am trying to implement ruff linting in Gitlab CI/CD where I am only trying to catch undefined name errors ["F821"]. However it is picking up my magic commands like %sql and %pip as syntax errors and I am unable to exclude it in the pyproject.toml file.

When using %run to import functions from another notebook it will not recognise it as an import. 

Has anyone tried to implement ruff in CI/CD and if so how did you get through this hurdle? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

saurabh18cs
Honored Contributor III

you're using ruff for linting. The issue with Databricks magic commands (%sql%pip%run) is that they're Databricks-specific syntax, not standard Python, so ruff treats them as errors. you should exclude databricks notebook from ruff.

View solution in original post

1 REPLY 1

saurabh18cs
Honored Contributor III

you're using ruff for linting. The issue with Databricks magic commands (%sql%pip%run) is that they're Databricks-specific syntax, not standard Python, so ruff treats them as errors. you should exclude databricks notebook from ruff.