Command line interface#
pgrubic#
PostgreSQL linter and formatter for schema migrations and design best practices.
Options#
--version#
Show the version and exit.
Examples:
pgrubic lint
pgrubic lint .
pgrubic lint *.sql
pgrubic lint example.sql
pgrubic format file.sql
pgrubic format migrations/
lint#
Lint SQL files.
Options#
--fix#
Fix lint violations automatically.
--ignore-noqa#
Whether to ignore noqa directives.
--add-file-level-general-noqa#
Whether to add file-level noqa directives.
--verbose#
Enable verbose logging.
--workers#
Number of workers to use.
format#
Format SQL files.
Options#
--check#
Check if any files would have been modified.
--diff#
Report the difference between the current file and how the formatted file would look like.
--no-cache#
Whether to read the cache.
--verbose#
Enable verbose logging.
--workers#
Number of workers to use.
Exit codes#
When using pgrubic as a command line tool, it returns exit-code which can be useful in CI pipelines.
lint#
Code | Description |
---|---|
0 | No violations found or all violations were fixed automatically |
1 | Violations found |
2 | Error occurred during linting |
format#
Code | Description |
---|---|
0 | Formatting was successful, even if no changes were made |
2 | Error occurred during formatting |
--check#
Code | Description |
---|---|
0 | No changes would be made |
1 | Changes would be made |
2 | Error occurred during formatting |
--diff#
Code | Description |
---|---|
0 | No changes would be made |
1 | Changes would be made |
2 | Error occurred during formatting |