Configuring Previous Line Rules

There are rules which will check the contents on lines above code structures. These rules allow enforcement of comments and blank lines.

There are several options to these rules, which can be selected by using the style option:

Style Description
no_blank_line Removes blank lines on the line above.
require_blank_line Requires a blank line on the line above.
no_code Either a blank line; or comment(s) on the line(s) above.
allow_comment Either a blank line; or comment(s) on the line(s) above and a blank line above the comment(s).
require_comment Comment(s) required on the line(s) above and a blank line above the comment(s).

Note

Unless stated in the rule description, the default style is require_blank_line.

Warning

It is important to be aware these rules may conflict with rules that enforce blank lines below keywords. This can occur when a below rule is applied and then on the next line a previous rule applies. Resolve any conflicts by changing the configuration of either rule.

This is an example of how to configure these options.

rule :
  entity_003:
     style : require_blank_line

Note

All examples below are using the rule entity_004.

Example: no_blank

The following code would fail with this option:

library fifo_dsn;
-- Define entity

entity fifo is

The following code would pass with this option:

library fifo_dsn;
-- Define entity
entity fifo is

Example: require_blank_line

The following code would fail with this option:

library fifo_dsn;
-- Define entity
entity fifo is

The following code would pass with this option:

library fifo_dsn;
-- Define entity

entity fifo is

Example: no_code

The following code would fail with this option:

library fifo_dsn;
entity fifo is

The following code would pass with this option:

library fifo_dsn;

entity fifo is

library fifo_dsn;
-- Comment

entity fifo is

library fifo_dsn;
-- Comment
entity fifo is

Example: allow_comment

The following code would fail with this option:

library fifo_dsn;
entity fifo is

library fifo_dsn;
-- Comment
entity fifo is

The following code would pass with this option:

library fifo_dsn;

entity fifo is

library fifo_dsn;
-- Comment

entity fifo is

library fifo_dsn;

-- Comment
entity fifo is

Example: require_comment

The following code would fail these options:

library fifo_dsn;
entity fifo is

library fifo_dsn;
-- Comment
entity fifo is

The following code would pass these options:

library fifo_dsn;

-- Comment
entity fifo is