sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

Add linting option to `sqlmesh format` command

Open petrikoro opened this issue 6 months ago • 0 comments

Description:

The current implementation of the sqlmesh format command only supports formatting code. To enhance its functionality, it would be beneficial to introduce an option that allows users to solely lint their code, similar to the --check flag used in black.

Use Case:

In my current workflow, I utilize a pre-commit job to format the code. Subsequently, in the CI pipeline, I only need to verify that the formatting is valid by running a linting check. The addition of a linting option to sqlmesh format would greatly facilitate this process.

Proposed Solution:

Implement a new flag, e.g., --check or --lint, that, when used with sqlmesh format, will only perform a linting check on the code without applying any formatting changes. This would enable users to validate the formatting of their code in a more efficient and streamlined manner.

Example Usage:

sqlmesh format --check This command would lint the code and report any formatting issues without modifying the files.

petrikoro avatar Jul 30 '24 17:07 petrikoro