Skip to content

Latest commit

 

History

History
131 lines (83 loc) · 2.92 KB

configuring_indent_rules.rst

File metadata and controls

131 lines (83 loc) · 2.92 KB

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
  • Indentation will be performed using spaces.
  • Indentation will be performed using tabs and 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'

Example: indent_style set to spaces

Setting the indent_style option to spaces will result in leading whitespace being 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;

Example: indent_style set to smart_tabs

Setting the indent_style option to smart_tabs will result in leading whitespace being 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;