Settings
Global#
cache-dir#
Path to the cache directory.
If default and the environment variable PGRUBIC_CACHE
is set, the environment
variable takes precedence or otherwise the non-default set value is always used.
Type: str
Default: ".pgrubic_cache"
Example:
include#
A list of file patterns to include in the linting and formatting process.
Type: list[str]
Default: []
Example:
exclude#
A list of file patterns to exclude from the linting and formatting process.
Type: list[str]
Default: []
Example:
respect-gitignore#
Whether to automatically exclude files that are ignored by .ignore
, .gitignore
,
.git/info/exclude
, and global gitignore files. Enabled by default.
Type: bool
Default: True
Example:
Lint#
postgres-target-version#
The target version of Postgres to lint against. This is used to either enable or
disable certain linting rules. For example, DETACH PARTITION CONCURRENTLY
was introduced from Postgres 14.
Type: int
Default: 14
Example:
select#
List of rule aliases or prefixes to enable. It can be the exact code of a rule or
an entire category of rules, for example, TP017
, TP
. All rules are enabled by default.
Can be used in combination with ignore
to streamline rules selection.
Type: list[str]
Default: []
Example:
ignore#
List of rule aliases or prefixes to disable. It can be the exact code of a rule or
an entire category of rules, for example, TP017
, TP
.
Can be used in combination with select
to streamline rules selection.
Please note that ignore takes precedence over select.
Type: list[str]
Default: []
Example:
include#
List of file patterns to include in the linting process.
Type: list[str]
Default: []
Example:
exclude#
List of file patterns to exclude from the linting process.
Type: list[str]
Default: []
Example:
ignore-noqa#
Whether to ignore NOQA
directives in sources.
Overridden by the --ignore-noqa
command-line flag.
Type: bool
Default: False
Example:
allowed-extensions#
List of allowed postgres extensions.
Type: list[str]
Default: []
Example:
allowed-languages#
List of allowed languages.
Type: list[str]
Default: []
Example:
required-columns#
List of required columns along with their data types for every table.
Type: list[Column]
Default: []
Example:
pgrubic.toml
disallowed-schemas#
List of disallowed schemas, with reasons for their disallowance and what to use instead.
Type: list[DisallowedSchema]
Default: []
Example:
pgrubic.toml
disallowed-data-types#
List of disallowed data types, with reasons for their disallowance and what to use instead.
Type: list[DisallowedDataType]
Default: []
Example:
pgrubic.toml
fix#
Whether to automatically fix fixable violations.
Overridden by the --fix
command-line flag.
Type: bool
Default: False
Example:
fixable#
List of rule aliases or prefixes to consider fixable. It can be the exact code of a rule
or an entire category of rules, for example, TP017
, TP
. All rules are considered
fixable by default. Please note that unfixable takes precedence over fixable.
Type: list[str]
Default: []
Example:
unfixable#
List of rule aliases or prefixes to consider unfixable. It can be the exact code of a rule
or an entire category of rules, for example, TP017
, TP
.
Type: list[str]
Default: []
Example:
timestamp-column-suffix#
Suffix to add to timestamp columns.
Type: str
Default: "_at"
Example:
date-column-suffix#
Suffix to add to date columns.
Type: str
Default: "_on"
Example:
regex-partition#
Regular expression to match partition names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-index#
Regular expression to match index names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-constraint-primary-key#
Regular expression to match primary key constraint names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-constraint-unique-key#
Regular expression to match unique key constraint names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-constraint-foreign-key#
Regular expression to match foreign key constraint names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-constraint-check#
Regular expression to match check constraint names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-constraint-exclusion#
Regular expression to match exclusion constraint names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
regex-sequence#
Regular expression to match sequence names.
Type: str
Default: r"^[a-z0-9_]+$"
Example:
Format#
include#
A list of file patterns to include in the formatting process.
Type: list[str]
Default: []
Example:
exclude#
A list of file patterns to exclude from the formatting process.
Type: list[str]
Default: []
Example:
comma-at-beginning#
If true
, add comma as a prefix as opposed to a suffix when formatting a list of
items, such as list of columns in which each column is on a separate line.
For example, when true
:
when false
:
Type: bool
Default: true
Example:
new-line-before-semicolon#
If true
, add a new line before each semicolon.
For example, when true
:
when false
:
Type: bool
Default: false
Example:
lines-between-statements#
Number of lines between SQL statements.
Type: int
Default: 1
Example:
remove-pg-catalog-from-functions#
If true
, remove the pg_catalog.
prefix from functions. Postgres standard functions
are located in the pg_catalog
schema and thus prefixed with pg_catalog.
by default.
Type: bool
Default: true
Example:
diff#
When true
, report the difference between the current file and how it will look when
formatted, without making any changes to the file. If there is a difference, it exits
with a non-zero exit code.
Overridden by the --diff
command-line flag.
Type: bool
Default: false
Example:
check#
When true
, it exits with a non-zero exit code if the any files would have been
modified by the formatter.
Overridden by the --check
command-line flag.
Type: bool
Default: false
Example:
no-cache#
Whether to read the cache. Caching helps speed up the formatting process. When a file
has not been modified after the last formatting, it is simply skipped.
To force reformatting of a file even if it has not been modified since the last
formatting, set to true
.
Overridden by the --no-cache
command-line flag.
Type: bool
Default: false
Example: