How to use the vsg.rule.rule function in vsg

To help you get started, we’ve selected a few vsg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jeremiah-c-leary / vhdl-style-guide / vsg / rules / case_rule.py View on Github external
def __init__(self, name=None, identifier=None, sTrigger=None):
        rule.rule.__init__(self, name, identifier)
        self.phase = 6
        self.solution = None
        self.sTrigger = sTrigger
        self.case = 'lower'
        self.words_to_fix = set()
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / case / rule_021.py View on Github external
def __init__(self):
        rule.rule.__init__(self)
        self.name = 'case'
        self.identifier = '021'
        self.solution = 'Align comment with "when" keyword.'
        self.phase = 4
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / instantiation / rule_017.py View on Github external
from vsg import rule
from vsg import utils


class rule_017(rule.rule):
    '''
    Instantiation rule 017 checks for generic map keyword and generic assignment on the same line.
    '''

    def __init__(self):
        rule.rule.__init__(self)
        self.name = 'instantiation'
        self.identifier = '017'
        self.solution = 'Move generic assignment to it\'s own line.'
        self.phase = 1

    def _analyze(self, oFile, oLine, iLineNumber):
        if oLine.isInstantiationGenericAssignment and oLine.isInstantiationGenericKeyword:
            dViolation = utils.create_violation_dict(iLineNumber)
            self.add_violation(dViolation)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / variable / rule_007.py View on Github external
def __init__(self):
        rule.rule.__init__(self, 'variable', '007')
        self.solution = 'Remove default assignment.'
        self.phase = 1
        self.fixable = False  # Allow the user to decide if these should be removed
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / sequential / rule_006.py View on Github external
def __init__(self):
        rule.rule.__init__(self, 'sequential', '006')
        self.solution = 'Remove comment.'
        self.phase = 1
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / if_statement / rule_031.py View on Github external
from vsg import rule
from vsg import check
from vsg import fix
from vsg import utils


class rule_031(rule.rule):
    '''
    If rule 031 checks for a blank line before the "if" keyword.
    '''

    def __init__(self):
        rule.rule.__init__(self, 'if', '031')
        self.phase = 3
        self.solution = 'Add a blank line before the "if"'

    def _analyze(self, oFile, oLine, iLineNumber):
        if oLine.isFirstIf:
            check.is_blank_line_before(self, oFile, iLineNumber, 'isComment')

    def _fix_violations(self, oFile):
        for dViolation in self.violations[::-1]:
            fix.insert_blank_line_above(self, oFile, utils.get_violation_linenumber(dViolation))
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / no_space_after_rule.py View on Github external
from vsg import rule
from vsg import check
from vsg import fix


class no_space_after_rule(rule.rule):
    '''
    No space after rule checks for spaces after a user specified keyword.
    '''

    def __init__(self, sName=None, sIdentifier=None, sWord=None, sTrigger=None):
        rule.rule.__init__(self, sName, sIdentifier)
        self.phase = 2
        self.sTrigger = sTrigger
        self.sWord = sWord
        self.identifier = sIdentifier
        self.solution = None

    def _analyze(self, oFile, oLine, iLineNumber):
        if oLine.__dict__[self.sTrigger]:
            check.is_no_space_after(self, self.sWord, oLine, iLineNumber)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / architecture / rule_002.py View on Github external
def __init__(self):
        rule.rule.__init__(self)
        self.name = 'architecture'
        self.identifier = '002'
        self.solution = 'Remove extra spaces after architecture keyword.'
        self.phase = 2
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / architecture.py View on Github external
from vsg import rule
from vsg import line
import re


class architecture_rule(rule.rule):
    
    def __init__(self):
        rule.rule.__init__(self)
        self.name = 'architecture'


class rule_001(architecture_rule):
    '''Architecture rule 001 checks for spaces at the beginning of the line.'''

    def __init__(self):
        architecture_rule.__init__(self)
        self.identifier = '001'
        self.solution = 'Ensure proper indentation.'
        self.phase = 4

    def analyze(self, oFile):