Configuring Whitespace Rules

There are rules which will check for a whitespace between keywords or keywords and identifiers. The number of spaces can be configured to allow for multiple or no whitespaces.

There are a couple of options to these rules:

Option

Description

number_of_spaces

Determines the number of whitespace characters to allow.

The number_of_spaces option can accept several values:

Value

Description

[0-9][0-9]*

The number of spaces to enforce.

>[0-9][0-9]*

The minimum number of spaces to enforce.

>=[0-9][0-9]*

The minimum number of spaces to enforce.

[0-9][0-9]*+

The minimum number of spaces to enforce.

<[0-9][0-9]*

The maximum number of spaces to enforce.

<=[0-9][0-9]*

The maximum number of spaces to enforce.

These options combined with the values allow complete control over the number of whitespaces allowed.

Example: enforce one whitespace between end and architecture

rule :
  architecture_012:
     number_of_spaces: 1

In this example, the number of whitespaces between the keywords must be 1.

end architecture;

Example: enforce two whitespaces between end and architecture

rule :
  architecture_012:
     number_of_spaces: 2

In this example, the number of whitespaces between the keywords must be 2.

end  architecture;

Example: allow at least 1 space before a colon

rule :
  signal_006:
     number_of_spaces: '>=1'

In this example, there must be at least a single whitespace before the colon. All of these would not be a violation.

signal wr_en : std_logic;
signal wr_en  : std_logic;
signal wr_en                : std_logic;

The same result could be achieved using this yaml:

rule :
  signal_006:
     number_of_spaces: '1+'

Example: allow at most 4 spaces before colon

rule :
  signal_006:
     number_of_spaces: '<=4'

In this example, there must be at most four whitespaces before the colon. The third signal declaration would be a violation.

signal wr_en : std_logic;
signal wr_en  : std_logic;
signal wr_en                : std_logic;

Rules Enforcing Whitespace