Added command line option --all_phases to allow VSG to not stop when a violation was found while analyzing a file. (cherry picked from commit 43d4498815be9ed3187a34409ea06834d7b6dfce)
This commit is contained in:
parent
17f2c29942
commit
a3c5beedbd
|
|
@ -18,6 +18,7 @@ Welcome to vhdl-style-guide's documentation!
|
|||
configuring
|
||||
code_tags
|
||||
editor_integration
|
||||
tool_integration
|
||||
localizing
|
||||
phases
|
||||
rule_severity
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
Tool Integration
|
||||
----------------
|
||||
|
||||
VSG supports integration with other tools via several command line options.
|
||||
|
||||
+-------------------------------+-------------------------------------------------+
|
||||
| --all-phases | Executes all phases without stopping if a |
|
||||
| | violation is found. |
|
||||
+-------------------------------+-------------------------------------------------+
|
||||
|
||||
--all-phases
|
||||
############
|
||||
|
||||
VSG has a concept of phases, where violations in one phase should be addressed before moving to the next phase.
|
||||
The **--all-phases** option will run an analysis over all the phases.
|
||||
It will not stop if a violation has occured.
|
||||
|
||||
This option can be useful when integrating VSG into an editor that supports linters.
|
||||
It is important to note there are dependencies between some rules.
|
||||
If violations for a later phase are fixed before violations on an earlier phase, it could lead to reoccurances of violations until the correct order is followed.
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ The command line tool can be invoked with:
|
|||
$ vsg
|
||||
usage: VHDL Style Guide (VSG) [-h] [-f FILENAME [FILENAME ...]] [-lr LOCAL_RULES] [-c CONFIGURATION [CONFIGURATION ...]] [--fix]
|
||||
[-fp FIX_PHASE] [-j JUNIT] [-of {vsg,syntastic}] [-b] [-oc OUTPUT_CONFIGURATION]
|
||||
[-rc RULE_CONFIGURATION] [--style {indent_only,jcl}] [-v] [--debug]
|
||||
[-rc RULE_CONFIGURATION] [--style {indent_only,jcl}] [-v] [-ap] [--debug]
|
||||
|
||||
Analyzes VHDL files for style guide violations. Reference documentation is located at: http://vhdl-style-
|
||||
guide.readthedocs.io/en/latest/index.html
|
||||
|
|
@ -37,6 +37,7 @@ The command line tool can be invoked with:
|
|||
--style {indent_only,jcl}
|
||||
Use predefined style
|
||||
-v, --version Displays version information
|
||||
-ap, --all_phases Do not stop when a violation is detected.
|
||||
--debug Displays verbose debug information
|
||||
|
||||
**Command Line Options**
|
||||
|
|
@ -72,6 +73,7 @@ The command line tool can be invoked with:
|
|||
| | vsg -- standard VSG output |
|
||||
| | syntastic -- format compatible with the |
|
||||
| | syntastic VIM module |
|
||||
| | json -- violations in a JSON format |
|
||||
+-------------------------------+-------------------------------------------------+
|
||||
| --backup | Creates a copy of the input file before |
|
||||
| | applying any fixes. This can be used to |
|
||||
|
|
@ -88,6 +90,9 @@ The command line tool can be invoked with:
|
|||
+-------------------------------+-------------------------------------------------+
|
||||
| --version | Displays the version of VSG. |
|
||||
+-------------------------------+-------------------------------------------------+
|
||||
| --all-phases | Executes all phases without stopping if a |
|
||||
| | violation is found. |
|
||||
+-------------------------------+-------------------------------------------------+
|
||||
|
||||
|
||||
Here is an example output running against a test file:
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ def parse_command_line_arguments():
|
|||
parser.add_argument('-rc', '--rule_configuration', default=None, action='store', help='Display configuration of a rule')
|
||||
parser.add_argument('--style', action='store', default=None, choices=get_predefined_styles(), help='Use predefined style')
|
||||
parser.add_argument('-v', '--version', default=False, action='store_true', help='Displays version information')
|
||||
parser.add_argument('-ap', '--all_phases', default=False, action='store_true', help='Do not stop when a violation is detected.')
|
||||
parser.add_argument('--debug', default=False, action='store_true', help='Displays verbose debug information')
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
|
|
@ -380,7 +381,7 @@ def main():
|
|||
|
||||
oRules.oSeverityList.clear_severity_counts()
|
||||
oRules.clear_violations()
|
||||
oRules.check_rules(commandLineArguments.skip_phase)
|
||||
oRules.check_rules(bAllPhases=commandLineArguments.all_phases, lSkipPhase=commandLineArguments.skip_phase)
|
||||
oRules.report_violations(commandLineArguments.output_format)
|
||||
fExitStatus = update_exit_status(fExitStatus, oRules)
|
||||
|
||||
|
|
|
|||
|
|
@ -189,14 +189,15 @@ class rule_list():
|
|||
lReturn.append(oRule)
|
||||
return lReturn
|
||||
|
||||
def check_rules(self, lSkipPhase=[]):
|
||||
def check_rules(self, bAllPhases=False, lSkipPhase=[]):
|
||||
'''
|
||||
Analyzes all rules in increasing phase order.
|
||||
If there is a violation in a phase, analysis is halted.
|
||||
|
||||
Parameters:
|
||||
|
||||
lSkipPhase : (list of integers)
|
||||
bAllPhases : (boolean)
|
||||
lSkipPhase : (list of integers)
|
||||
'''
|
||||
self.iNumberRulesRan = 0
|
||||
iFailures = 0
|
||||
|
|
@ -214,7 +215,7 @@ class rule_list():
|
|||
iFailures += len(oRule.violations)
|
||||
self.iNumberRulesRan += 1
|
||||
self.lastPhaseRan = phase
|
||||
if iFailures > 0:
|
||||
if iFailures > 0 and not bAllPhases:
|
||||
self.violations = True
|
||||
break
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue