Skip to content

Commit cc678cb

Browse files
authored
Issue#1383: Added case rules for file declarations (#1396)
* Issue#1383: Added case rules for file declarations. * Issue#1383: Added tests for case rules for file declarations. * Issue#1383: Added documentation for case rules for file declarations. * Issue#1383: Added case rules for file type declarations. * Issue#1383: Added tests for case rules for file type declarations. * Issue#1383: Added documentation for case rules for file type declarations. * Issue#1383: Corrected "file type declaration" to "file type definition".
1 parent 1247327 commit cc678cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1110
-0
lines changed

docs/configuring_uppercase_and_lowercase_rules.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,15 @@ Rules Enforcing Case
356356

357357
* `external_variable_name_500 <external_variable_name_rules.html#external-variable-name-500>`_
358358

359+
* `file_open_information_500 <file_open_information_rules.html#file-open-information-500>`_
360+
* `file_open_information_501 <file_open_information_rules.html#file-open-information-501>`_
361+
* `file_open_information_502 <file_open_information_rules.html#file-open-information-502>`_
362+
359363
* `file_002 <file_rules.html#file-002>`_
364+
* `file_500 <file_rules.html#file-500>`_
365+
366+
* `file_type_definition_500 <file_type_definition_rules.html#file-type-definition-500>`_
367+
* `file_type_definition_501 <file_type_definition_rules.html#file-type-definition-501>`_
360368

361369
* `for_generate_statement_500 <for_generate_statement_rules.html#for-generate-statement-500>`_
362370
* `for_generate_statement_501 <for_generate_statement_rules.html#for-generate-statement-501>`_
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
.. include:: includes.rst
2+
3+
File Open Information Rules
4+
---------------------------
5+
6+
file_open_information_500
7+
#########################
8+
9+
|phase_6| |error| |case| |case_keyword|
10+
11+
This rule checks the **open** keyword has proper case.
12+
13+
|configuring_uppercase_and_lowercase_rules_link|
14+
15+
**Violation**
16+
17+
.. code-block:: vhdl
18+
19+
architecture rtl of fifo is
20+
21+
file defaultImage : load_file_type OPEN read_mode is load_file_name;
22+
23+
begin
24+
25+
**Fix**
26+
27+
.. code-block:: vhdl
28+
29+
architecture rtl of fifo is
30+
31+
file defaultImage : load_file_type open read_mode is load_file_name;
32+
33+
begin
34+
35+
file_open_information_501
36+
#########################
37+
38+
|phase_6| |error| |case| |case_keyword|
39+
40+
This rule checks the file open kind expression has proper case.
41+
42+
|configuring_uppercase_and_lowercase_rules_link|
43+
44+
**Violation**
45+
46+
.. code-block:: vhdl
47+
48+
architecture rtl of fifo is
49+
50+
FILE defaultImage : load_file_type open READ_MODE is load_file_name;
51+
52+
begin
53+
54+
**Fix**
55+
56+
.. code-block:: vhdl
57+
58+
architecture rtl of fifo is
59+
60+
file defaultImage : load_file_type open read_mode is load_file_name;
61+
62+
begin
63+
64+
file_open_information_502
65+
#########################
66+
67+
|phase_6| |error| |case| |case_keyword|
68+
69+
This rule checks the **is** keyword has proper case.
70+
71+
|configuring_uppercase_and_lowercase_rules_link|
72+
73+
**Violation**
74+
75+
.. code-block:: vhdl
76+
77+
architecture rtl of fifo is
78+
79+
file defaultimage : load_file_type open read_mode IS load_file_name;
80+
81+
begin
82+
83+
**Fix**
84+
85+
.. code-block:: vhdl
86+
87+
architecture rtl of fifo is
88+
89+
file defaultImage : load_file_type open read_mode is load_file_name;
90+
91+
begin

docs/file_rules.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,32 @@ This rule checks for a single space before the identifier.
9595
.. code-block:: vhdl
9696
9797
file defaultImage : load_file_type open read_mode is load_file_name;
98+
99+
file_500
100+
########
101+
102+
|phase_6| |error| |case| |case_name|
103+
104+
This rule checks the file identifier has proper case.
105+
106+
|configuring_uppercase_and_lowercase_rules_link|
107+
108+
**Violation**
109+
110+
.. code-block:: vhdl
111+
112+
architecture rtl of fifo is
113+
114+
file DEFAULTIMAGE : load_file_type open read_mode is load_file_name;
115+
116+
begin
117+
118+
**Fix**
119+
120+
.. code-block:: vhdl
121+
122+
architecture rtl of fifo is
123+
124+
file defaultImage : load_file_type open read_mode is load_file_name;
125+
126+
begin
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. include:: includes.rst
2+
3+
File Type Definition Rules
4+
--------------------------
5+
6+
file_type_definition_500
7+
########################
8+
9+
|phase_6| |error| |case| |case_keyword|
10+
11+
This rule checks the **file** keyword has proper case.
12+
13+
|configuring_uppercase_and_lowercase_rules_link|
14+
15+
**Violation**
16+
17+
.. code-block:: vhdl
18+
19+
type integer_file is FILE of integer;
20+
21+
22+
**Fix**
23+
24+
.. code-block:: vhdl
25+
26+
architecture rtl of fifo is
27+
28+
type integer_file is file of integer;
29+
30+
begin
31+
32+
file_type_definition_501
33+
########################
34+
35+
|phase_6| |error| |case| |case_keyword|
36+
37+
This rule checks the **of** keyword has proper case.
38+
39+
|configuring_uppercase_and_lowercase_rules_link|
40+
41+
**Violation**
42+
43+
.. code-block:: vhdl
44+
45+
type integer_file is file OF integer;
46+
47+
48+
**Fix**
49+
50+
.. code-block:: vhdl
51+
52+
architecture rtl of fifo is
53+
54+
type integer_file is file of integer;
55+
56+
begin

docs/rule_groups/case_keyword_rule_group.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ Rules Enforcing Case::Keyword Rule Group
6969
* `external_constant_name_500 <../external_constant_name_rules.html#external-constant-name-500>`_
7070
* `external_signal_name_500 <../external_signal_name_rules.html#external-signal-name-500>`_
7171
* `external_variable_name_500 <../external_variable_name_rules.html#external-variable-name-500>`_
72+
* `file_open_information_500 <../file_open_information_rules.html#file-open-information-500>`_
73+
* `file_open_information_501 <../file_open_information_rules.html#file-open-information-501>`_
74+
* `file_open_information_502 <../file_open_information_rules.html#file-open-information-502>`_
7275
* `file_002 <../file_rules.html#file-002>`_
76+
* `file_type_definition_500 <../file_type_definition_rules.html#file-type-definition-500>`_
77+
* `file_type_definition_501 <../file_type_definition_rules.html#file-type-definition-501>`_
7378
* `for_generate_statement_500 <../for_generate_statement_rules.html#for-generate-statement-500>`_
7479
* `for_generate_statement_501 <../for_generate_statement_rules.html#for-generate-statement-501>`_
7580
* `function_004 <../function_rules.html#function-004>`_

docs/rule_groups/case_name_rule_group.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Rules Enforcing Case::Name Rule Group
2222
* `entity_008 <../entity_rules.html#entity-008>`_
2323
* `entity_012 <../entity_rules.html#entity-012>`_
2424
* `entity_specification_503 <../entity_specification_rules.html#entity-specification-503>`_
25+
* `file_500 <file_rules.html#file-500>`_
2526
* `function_017 <../function_rules.html#function-017>`_
2627
* `function_506 <../function_rules.html#function-506>`_
2728
* `function_507 <../function_rules.html#function-507>`_

docs/rule_groups/case_rule_group.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ Rules Enforcing Case Rule Group
9595
* `external_constant_name_500 <../external_constant_name_rules.html#external-constant-name-500>`_
9696
* `external_signal_name_500 <../external_signal_name_rules.html#external-signal-name-500>`_
9797
* `external_variable_name_500 <../external_variable_name_rules.html#external-variable-name-500>`_
98+
* `file_open_information_500 <../file_open_information_rules.html#file-open-information-500>`_
99+
* `file_open_information_501 <../file_open_information_rules.html#file-open-information-501>`_
100+
* `file_open_information_502 <../file_open_information_rules.html#file-open-information-502>`_
98101
* `file_002 <../file_rules.html#file-002>`_
102+
* `file_500 <../file_rules.html#file-500>`_
103+
* `file_type_definition_500 <../file_type_definition_rules.html#file-type-definition-500>`_
104+
* `file_type_definition_501 <../file_type_definition_rules.html#file-type-definition-501>`_
99105
* `for_generate_statement_500 <../for_generate_statement_rules.html#for-generate-statement-500>`_
100106
* `for_generate_statement_501 <../for_generate_statement_rules.html#for-generate-statement-501>`_
101107
* `function_004 <../function_rules.html#function-004>`_

docs/rules.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ The rules are divided into categories depending on the part of the VHDL code bei
4242
external_signal_name_rules.rst
4343
external_variable_name_rules.rst
4444
file_rules.rst
45+
file_open_information_rules.rst
46+
file_type_definition_rules.rst
4547
for_loop_rules.rst
4648
for_generate_statement_rules.rst
4749
function_rules.rst

tests/file_open_information/__init__.py

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
architecture rtl of fifo is
3+
4+
file defaultimage : load_file_type open read_mode is load_file_name;
5+
6+
file defaultimage : load_file_type open read_mode is load_file_name;
7+
8+
file defaultimage : load_file_type open read_mode is load_file_name;
9+
10+
begin
11+
12+
end;

0 commit comments

Comments
 (0)