Configuring Indent Rules
There are rules which will check indent of lines. The method of indenting can be configured using one of the following options:
Option | Values | Default Value | Description |
---|---|---|---|
indent_style |
spaces , smart_tabs |
spaces |
|
The indent_style
option can be set globally for all rules and locally for a single file using a configuration:
rules:
global:
indent_style: 'smart_tabs'
indent_size: 2
file_list:
- ram.vhd:
rule:
global:
indent_style: 'spaces'
spaces
Example
Setting the indent_style
option to spaces
will result in leading whitespace to be converted into spaces.
Violation
architecture rtl of fifo is
\tsignal wr_en : std_logic;
begin
\tb <= "1000" when a = "00" else
\t\t"0100" when a = "01" else
\t\t"0010" when a = "10" else
\t\t"0001" when a = "11";
end architecture rtl;
Fix
architecture rtl of fifo is
signal wr_en : std_logic;
begin
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
"0001" when a = "11";
end architecture rtl;
smart_tabs
Example
Setting the indent_style
option to smart_tabs
will result in leading whitespace to be converted into tabs and spaces. Tabs set the indent and spaces are used for alignment.
Violation
architecture rtl of fifo is
signal wr_en : std_logic;
begin
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
"0001" when a = "11";
end architecture rtl;
Fix
architecture rtl of fifo is
\tsignal wr_en : std_logic;
begin
\tb <= "1000" when a = "00" else
\t "0100" when a = "01" else
\t "0010" when a = "10" else
\t "0001" when a = "11";
end architecture rtl;