Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/configuring_whitespace_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ Rules Enforcing Whitespace
* `external_variable_name_102 <external_variable_name_rules.html#external-variable-name-102>`_
* `external_variable_name_103 <external_variable_name_rules.html#external-variable-name-103>`_
* `external_variable_name_104 <external_variable_name_rules.html#external-variable-name-104>`_
* `file_open_information_100 <file_open_information_rules.html#file-open-information-100>`_
* `file_open_information_101 <file_open_information_rules.html#file-open-information-101>`_
* `file_open_information_102 <file_open_information_rules.html#file-open-information-102>`_
* `file_open_information_103 <file_open_information_rules.html#file-open-information-103>`_
* `file_100 <file_rules.html#file-100>`_
* `file_101 <file_rules.html#file-101>`_
* `function_100 <function_rules.html#function-100>`_
* `function_101 <function_rules.html#function-101>`_
* `generate_002 <generate_rules.html#generate-002>`_
Expand Down
84 changes: 84 additions & 0 deletions docs/file_open_information_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,90 @@
File Open Information Rules
---------------------------

file_open_information_100
#########################

|phase_2| |error| |whitespace|

This rule checks for a single space before the **open** keyword.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

**Fix**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

file_open_information_101
#########################

|phase_2| |error| |whitespace|

This rule checks for a single space after the **open** keyword.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

**Fix**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

file_open_information_102
#########################

|phase_2| |error| |whitespace|

This rule checks for a single space before the **is** keyword.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

**Fix**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

file_open_information_103
#########################

|phase_2| |error| |whitespace|

This rule checks for a single space after the **is** keyword.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

**Fix**

.. code-block:: vhdl

file defaultImage : load_file_type open read_mode is load_file_name;

file_open_information_500
#########################

Expand Down
21 changes: 21 additions & 0 deletions docs/file_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@ This rule checks for a single space before the identifier.
**Fix**

.. code-block:: vhdl
file defaultImage : load_file_type open read_mode is load_file_name;
file_101
########

|phase_2| |error| |whitespace|

This rule checks for a single space after the identifier.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl
file defaultImage : load_file_type open read_mode is load_file_name;
**Fix**

.. code-block:: vhdl
file defaultImage : load_file_type open read_mode is load_file_name;
Expand Down
5 changes: 5 additions & 0 deletions docs/rule_groups/whitespace_rule_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ Rules Enforcing Whitespace Rule Group
* `external_variable_name_102 <../external_variable_name_rules.html#external-variable-name-102>`_
* `external_variable_name_103 <../external_variable_name_rules.html#external-variable-name-103>`_
* `external_variable_name_104 <../external_variable_name_rules.html#external-variable-name-104>`_
* `file_open_information_100 <../file_open_information_rules.html#file-open-information-100>`_
* `file_open_information_101 <../file_open_information_rules.html#file-open-information-101>`_
* `file_open_information_102 <../file_open_information_rules.html#file-open-information-102>`_
* `file_open_information_103 <../file_open_information_rules.html#file-open-information-103>`_
* `file_100 <../file_rules.html#file-100>`_
* `file_101 <../file_rules.html#file-101>`_
* `function_100 <../function_rules.html#function-100>`_
* `function_101 <../function_rules.html#function-101>`_
* `generate_002 <../generate_rules.html#generate-002>`_
Expand Down
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_100_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_100_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_101_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_101_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_102_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_102_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_103_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/file_open_information/rule_103_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

file defaultImage : load_file_type open read_mode is load_file_name;

file defaultImage : load_file_type open read_mode is load_file_name;

begin

end architecture rtl;
48 changes: 48 additions & 0 deletions tests/file_open_information/test_rule_100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import file_open_information

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_100_test_input.vhd"))

dIndentMap = utils.read_indent_file()

lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_100_test_input.fixed.vhd"), lExpected)


class test_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap)

def test_rule_100(self):
oRule = file_open_information.rule_100()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "file_open_information")
self.assertEqual(oRule.identifier, "100")

lExpected = [6]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_fix_rule_100(self):
oRule = file_open_information.rule_100()

oRule.fix(self.oFile)

lActual = self.oFile.get_lines()

self.assertEqual(lExpected, lActual)

oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
48 changes: 48 additions & 0 deletions tests/file_open_information/test_rule_101.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import file_open_information

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_101_test_input.vhd"))

dIndentMap = utils.read_indent_file()

lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_101_test_input.fixed.vhd"), lExpected)


class test_file_declaration_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap)

def test_rule_101(self):
oRule = file_open_information.rule_101()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "file_open_information")
self.assertEqual(oRule.identifier, "101")

lExpected = [6]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_fix_rule_101(self):
oRule = file_open_information.rule_101()

oRule.fix(self.oFile)

lActual = self.oFile.get_lines()

self.assertEqual(lExpected, lActual)

oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
48 changes: 48 additions & 0 deletions tests/file_open_information/test_rule_102.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import file_open_information

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_102_test_input.vhd"))

dIndentMap = utils.read_indent_file()

lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_102_test_input.fixed.vhd"), lExpected)


class test_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap)

def test_rule_102(self):
oRule = file_open_information.rule_102()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "file_open_information")
self.assertEqual(oRule.identifier, "102")

lExpected = [6]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_fix_rule_102(self):
oRule = file_open_information.rule_102()

oRule.fix(self.oFile)

lActual = self.oFile.get_lines()

self.assertEqual(lExpected, lActual)

oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
Loading
Loading