Go to file
Jeremiah Leary d9a402ad5d
Imd1 issue 686 (#756)
* Updates for issue #636

Adding severity to output of --json argument.

  1)  Added test to expose the issue
  2)  Updated code to output severity

* Updates for issue #636

Fixing comments in test.

* Updates for issue #642 (#658)

* Updates for issue #642

Updating prefix/suffix rules to also check for matching ending lable/identifiers.

  1)  Updated tests to expose issue
  2)  Updated rules
      a)  generate_007
      b)  generate_600
      c)  package_016
      d)  package_017

* Updates for issue #642

Updating unrelated test that is failing CI due to file ordering in output.

* Updates for issue #642

Another attempt to get a test to pass.

* Updates for issue #642

Another attempt to get a test to pass.

* Updates for issue #642

Seeing if switching to a single core will fix testing issue.

* Disabling three tests just for this release.

* Preparing for release 3.3.1

* Updates for issue #663 (#665)

* Updates for issue #663

Fixing rule if_002 to honor whitespace when removing parenthesis.

  1)  Updated test to expose the issue
  2)  Updated rule to ensure whitespace is preserved

* Refactoring _check_remove_parenthesis to improve readability.

* Refactored check_insert_parenthesis to improve readability.

* Refactoring _fix_violation method to improve readability.

* Updates for codeclimate.

* Removing unused variable.

* Improving tests to increase code coverage.

* Updates for issue #664 (#666)

* Updates for issue #664

Colons in subprogram_declarative_parts were being aligned with process_declarative_parts.

  1)  Updated tests to expose the issue
  2)  Updated rule process_033 to exclude subprogram_declarative_parts

* Fixing codeclimate issue.

* Preparing for release 3.3.2

* start on suffix rule

* added suffix rule

* added documentation

* added prefix rule

* Fixing documentation to match current method.

* Adding exception checking to fix crash of rule if_002.

* Addressing CodeClimate issues.

Co-authored-by: imd <ian.davis@roke.co.uk>
2022-04-30 08:09:51 -05:00
.github Temporarily removing sonarcloud. 2021-10-25 21:58:10 -05:00
bin Updates for issue #651 (#662) 2022-01-01 17:46:43 -06:00
docs Imd1 issue 686 (#756) 2022-04-30 08:09:51 -05:00
vsg Imd1 issue 686 (#756) 2022-04-30 08:09:51 -05:00
.coveragerc Updates for issue #226 2019-04-05 07:25:11 -05:00
.gitignore Updating git to ignore all versions of version_info.* 2022-02-09 20:28:14 -06:00
.prospector.yaml Minor formatting updates for Codacy issues. 2020-01-02 11:58:48 -06:00
.readthedocs.yaml Attempting to fix ReadtheDocs build. 2021-10-28 07:51:23 -05:00
.travis.yml Preparing for Release 1.0. 2019-11-25 20:40:49 -06:00
CODE_OF_CONDUCT.md
…
LICENSE
…
MANIFEST.in Updates for issue #487: 2021-02-08 20:20:42 -06:00
README.rst Fixing formatting. 2022-04-22 08:26:24 -05:00
setup.cfg Switching README to restructured text. 2019-06-09 14:07:25 -05:00
setup.py Fixing version reporting. 2021-03-20 10:05:29 -05:00
sonar-project.properties Adding sonarcloud analysis. 2021-03-20 15:08:20 -05:00

README.rst

VHDL Style Guide (VSG)
======================

**Coding style enforcement for VHDL.**

.. image:: https://img.shields.io/github/tag/jeremiah-c-leary/vhdl-style-guide.svg?style=flat-square
   :target: https://github.com/jeremiah-c-leary/vhdl-style-guide
   :alt: Github Release
.. image:: https://img.shields.io/pypi/v/vsg.svg?style=flat-square
   :target: https://pypi.python.org/pypi/vsg
   :alt: PyPI Version
.. image:: https://img.shields.io/travis/jeremiah-c-leary/vhdl-style-guide/master.svg?style=flat-square
   :target: https://travis-ci.org/jeremiah-c-leary/vhdl-style-guide
   :alt: Build Status
.. image:: https://img.shields.io/codecov/c/github/jeremiah-c-leary/vhdl-style-guide/master.svg?style=flat-square
   :target: https://codecov.io/github/jeremiah-c-leary/vhdl-style-guide
   :alt: Test Coverage
.. image:: https://img.shields.io/readthedocs/vsg.svg?style=flat-square
   :target: http://vhdl-style-guide.readthedocs.io/en/latest/index.html
   :alt: Read The Docs
.. image:: https://api.codacy.com/project/badge/Grade/42744dca97544824b93cfc99e8030063
   :target: https://www.codacy.com/app/jeremiah-c-leary/vhdl-style-guide?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=jeremiah-c-leary/vhdl-style-guide&amp;utm_campaign=Badge_Grade
   :alt: Codacy

Announcements
-------------

Update 04/22/2022

The Release 3.11.0 will include a change to comment indenting.
Prior to this release comments were indented at the current indent level.
This would result in comment indents being enforced like this:

.. code-block:: vhdl

    architecture rtl of fifo is

      -- Define FIFO control signals
      signal wr_en : std_logic;
      signal rd_en : std_logic;

      -- Comment

    begin


Release 3.11.0 will employ a forward looking comment indent.
The rationale being that comments are describing what comes next and therefore should be indented to match the code that comes next.
The code snippet above will now be formatted as:

.. code-block:: vhdl

    architecture rtl of fifo is

      -- Define FIFO control signals
      signal wr_en : std_logic;
      signal rd_en : std_logic;

    -- Comment

    begin

With the comment **-- Comment** matching the indent of the **begin** keyword.

There are existing rules in 3.10.0 which enforce this behavior, for example **case_021**.
These will eventually be deprecated in a future release as they are no longer required.

Regards,

--Jeremy

.. image:: https://github.com/jeremiah-c-leary/vhdl-style-guide/blob/master/docs/img/vim_macro.gif

Table of Contents
-----------------

*   `Overview`_
*   `Key Benefits`_
*   `Key Features`_
*   `Known Limitations`_
*   `Installation`_
*   `Usage`_
*   `Documentation`_
*   `Contributing`_

Overview
--------

VSG was created after participating in a code review where a real issue in the code was masked by a coding style issue.
A finding was created for the style issue, while the real issue was missed.
When the code was re-reviewed, the real issue was discovered.

Depending on your process, style issues can take a lot of time to resolve.

#. Create finding/ticket/issue
#. Disposition finding/ticket/issue
#. Fix
#. Verify fix

Spending less time on style issues leaves more time to analyze the substance of the code.
This ultimately reduces the amount of time performing code reviews.
It also allows reviewers to focus on the substance of the code.
This will result in a higher quality code base.

Key Benefits
------------

* Define VHDL coding standards
* Makes coding standards visible to everyone
* Improve code reviews
* Quickly bring code up to current standards

VSG allows the style of the code to be defined and enforced over part or the entire code base.
Configurations allow for multiple coding standards.

Key Features
------------

* Command line tool

  * integrate into continuous integration flow with JUnit output

* Reports and fixes issues found

  * whitespace

    * horizontal
    * vertical

  * upper and lower case
  * keyword alignments
  * etc...

* Fully configurable rules via JSON or YAML configuration file

  * Disable rules
  * Alter behavior of existing rules

* Localize rule sets

  * Create your own rules using python
  * Use existing rules as a template
  * Fully integrates into base rule set

* Built in styles

  * Use existing style or create your own

Known Limitations
-----------------

VSG is a continual work in progress.
As such, this version has the following known limitations:

* Parser will not process configurations
* Parser will not process embedded PSL
* Parser will not process VHDL 2019

Installation
------------

You can get the latest released version of VSG via **pip**.

.. code-block:: bash

    pip install vsg

The latest development version can be cloned...

.. code-block:: bash

    git clone https://github.com/jeremiah-c-leary/vhdl-style-guide.git

...and then installed locally...

.. code-block:: bash

    python setup.py install

Usage
-----

VSG is a both a command line tool and a python package.
The command line tool can be invoked with:

.. code-block:: bash

   $ vsg
   usage: VHDL Style Guide (VSG) [-h] [-f FILENAME [FILENAME ...]] [-lr LOCAL_RULES] [-c CONFIGURATION [CONFIGURATION ...]] [--fix]
                                 [-fp FIX_PHASE] [-j JUNIT] [-js JSON] [-of {vsg,syntastic,summary}] [-b] [-oc OUTPUT_CONFIGURATION]
                                 [-rc RULE_CONFIGURATION] [--style {indent_only,jcl}] [-v] [-ap] [--fix_only FIX_ONLY] [-p JOBS]
                                 [--debug]
   
   Analyzes VHDL files for style guide violations. Reference documentation is located at: http://vhdl-style-guide.readthedocs.io/en/latest/index.html
   
   optional arguments:
     -h, --help            show this help message and exit
     -f FILENAME [FILENAME ...], --filename FILENAME [FILENAME ...]
                           File to analyze
     -lr LOCAL_RULES, --local_rules LOCAL_RULES
                           Path to local rules
     -c CONFIGURATION [CONFIGURATION ...], --configuration CONFIGURATION [CONFIGURATION ...]
                           JSON or YAML configuration file(s)
     --fix                 Fix issues found
     -fp FIX_PHASE, --fix_phase FIX_PHASE
                           Fix issues up to and including this phase
     -j JUNIT, --junit JUNIT
                           Extract Junit file
     -js JSON, --json JSON
                           Extract JSON file
     -of {vsg,syntastic,summary}, --output_format {vsg,syntastic,summary}
                           Sets the output format.
     -b, --backup          Creates a copy of input file for comparison with fixed version.
     -oc OUTPUT_CONFIGURATION, --output_configuration OUTPUT_CONFIGURATION
                           Write configuration to file name.
     -rc RULE_CONFIGURATION, --rule_configuration RULE_CONFIGURATION
                           Display configuration of a rule
     --style {indent_only,jcl}
                           Use predefined style
     -v, --version         Displays version information
     -ap, --all_phases     Do not stop when a violation is detected.
     --fix_only FIX_ONLY   Restrict fixing via JSON file.
     -p JOBS, --jobs JOBS  number of parallel jobs to use, default is the number of cpu cores
     --debug               Displays verbose debug information

Here is an example output running against a test file:

.. image:: https://github.com/jeremiah-c-leary/vhdl-style-guide/blob/master/docs/img/fixing_single_file.gif

Documentation
-------------

All documentation for VSG is hosted at `read-the-docs <http://vhdl-style-guide.readthedocs.io/en/latest/index.html>`_.

Contributing
------------

I welcome any contributions to this project.
No matter how small or large.

There are several ways to contribute:

* Bug reports
* Code base improvements
* Feature requests
* Pull requests

Please refer to the documentation hosted at `read-the-docs <http://vhdl-style-guide.readthedocs.io/en/latest/index.html>`_ for more details on contributing.