Compare commits

..

3 Commits

7758 changed files with 118959 additions and 168771 deletions

View File

@ -1,8 +0,0 @@
dentity
din
dout
elemente
inout
leary
synopsys
toi

4
.coveragerc Normal file
View File

@ -0,0 +1,4 @@
[run]
omit = vsg/tests/*

View File

@ -1,7 +0,0 @@
[flake8]
max-line-length = 160
ignore =
# Whitespace before ':': conflict with black
E203
# Line break occurred before a binary operator: conflict with black
W503

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
[core]
* text=auto eol=lf

View File

@ -13,7 +13,10 @@ name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '17 9 * * 5'
@ -35,7 +38,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
@ -45,11 +48,11 @@ jobs:
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
@ -58,7 +61,7 @@ jobs:
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |

View File

@ -2,132 +2,41 @@
name: CI
# Controls when the action will run.
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
BUILD_PYTHON_FOR_BUILD: "3.10"
BUILD_PYTHON_FOR_BUILD_ALIAS: "py310"
SKIP_TEST_ON_GITHUB: "True"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
dist:
name: dist
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # cannot be shallow as version will not be generated
- name: python.install
uses: actions/setup-python@v5
with:
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
- name: dependencies.install
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: dist
run: |
tox -e wheel-${{ env.BUILD_PYTHON_FOR_BUILD_ALIAS }}
- name: archive.upload
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist/wheel-${{ env.BUILD_PYTHON_FOR_BUILD_ALIAS }}
style:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: python.install
uses: actions/setup-python@v5
with:
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
- name: dependencies.install
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: test
run: |
tox -e style
docs:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: python.install
uses: actions/setup-python@v5
with:
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
- name: dependencies.install
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: build
run: |
tox -e docs
- name: archive.upload
if: always()
uses: actions/upload-artifact@v4
with:
name: docs
path: |
build.out/docs
# This workflow contains a single job called "build"
build:
name: ${{ matrix.python-version }}-build
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: checkout
uses: actions/checkout@v4
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: python.install ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: dependencies.install
- name: Run Unit Tests
run: python -m unittest
- name: Generate Code Coverage Report
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: build
run: |
tox
pip install coverage
coverage run -m unittest
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: build.out
- name: archive.upload
if: always()
uses: actions/upload-artifact@v4
with:
name: build.out-${{ matrix.python-version }}
path: |
build.out
uses: codecov/codecov-action@v1
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:

View File

@ -14,3 +14,4 @@ jobs:
with:
project-url: https://github.com/users/jeremiah-c-leary/projects/3
github-token: ${{ secrets.ADD_TO_PROJECT_WORKFLOW_PAT }}

17
.gitignore vendored
View File

@ -8,21 +8,14 @@ dist
# Sphinx
_build
# Tox
.tox
build.out/
# Ignore release notes
release_notes.txt
# This version file should never be committed
vsg/version_info.*
# IDE files
.idea/
.vscode/
.venv/
.uv-cache/
.uv-python/
.ci-*/
.package-build/
venv
# Ignore external repos used for tests
tests/external_repos/repos
vsg/tests/external_repos/repos

View File

@ -1,85 +0,0 @@
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
# These are abuse of python import mechanism
# please conisder to remove in favor of direct module import.
exclude: "^(\
vsg/rules/__init__\\.py|\
vsg/vhdlFile/extract/__init__\\.py\
)$"
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
# repeat as above changes may cause rework
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-tabs
exclude: '^(.*\.vhd|.*\.svg)$'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
# * config_error - intentional
# * *_run_config.json - legacy not json compliant
exclude: "^(\
tests/vsg/config_error\\.json\
)$"
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
exclude: '^(.*\.svg)$'
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: fix-byte-order-marker
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: "^(\
tests/styles/code_examples/trailing_whitespace\\.vhd|\
tests/styles/jcl/trailing_whitespace.fixed\\.vhd|\
tests/whitespace/.*\\.vhd\
)$"
- id: fix-encoding-pragma
# - repo: https://github.com/mgedmin/check-manifest
# rev: "0.50"
# hooks:
# - id: check-manifest
# additional_dependencies:
# - setuptools-git-versioning
# args:
# - --no-build-isolation
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args:
- -I.codespell-ignore
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks: []
#- id: flake8

21
.prospector.yaml Normal file
View File

@ -0,0 +1,21 @@
test-warnings: false
disable:
- prospector_N801
- prospector_N802
- prospector_N806
pep8:
full: true
disable:
- N801
- N802
- N806
prospector:
disable:
- N801
- N802
- N806

View File

@ -1,12 +1,36 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
commands:
- pip install tox
- tox -e docs
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true
# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt

30
.travis.yml Normal file
View File

@ -0,0 +1,30 @@
env:
global:
- CC_TEST_REPORTER_ID=05478298c5451cbc18f01aab36344f7f9327bcb1346d90db96df76321ae1e3f8
# command to install
install:
- pip install codecov
- python setup.py install
language:
- python
python:
- "3.8"
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# command to run tests
script:
- coverage run setup.py test
after_success:
- codecov
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

View File

@ -1,104 +0,0 @@
# Authorship, LLM Use, and Safety Disclosure
This document describes the narrow stream-integration fork of VSG: how it was
developed, where an LLM was used, what is tested, and which operations can
affect source code. It does not make claims about the development process of
the complete upstream project.
## Authorship
The original VSG parser, rule library, fix engine, command-line application,
and most of this repository predate the fork. They are the work of Jeremy C.
Leary and upstream contributors. The fork maintainer chose the integration
requirements, keeps the patch set deliberately narrow, and accepts releases.
The fork-specific standard-input and standard-output integration,
machine-readable diagnostics, rule-scoped fix adapter, packaging automation,
tests, and related documentation were developed or refined with an LLM coding
assistant under maintainer direction. Development has been iterative, so this
repository does not claim reliable line-by-line attribution between human and
LLM-assisted work. The fork commits above the tracked upstream branch keep the
integration changes reviewable as a separate patch series.
## What the fork adds
The fork builds on VSG's existing `--stdin` and `--no-failure` options and adds
a small command-line boundary around existing behavior:
- `--diagnostics_json` emits a versioned diagnostic document;
- `--stdout` emits corrected VHDL instead of writing it to a source file;
- `--fix_rule RULE:LINE` adapts a selection to VSG's existing `--fix_only`
mechanism; and
- packaging and CI exercise the complete stream interface as an installed
artifact.
The parser, rules, phase ordering, and correction engine remain VSG's. The fork
does not add a second VHDL parser or formatter.
## Diagnostic JSON and side effects
`--diagnostics_json` requires `--stdin` and is incompatible with fixing and
other options that claim standard output. VSG parses the submitted text and
runs its normal rules, then serializes the resulting findings and effective
rule metadata. The JSON does not contain or execute replacement text and does
not introduce a path that writes back to the submitted source.
In this mode, producing JSON cannot change the VHDL, its behavior, or its
formatting. Output is always one valid JSON document: successful analysis is
marked complete, while argument, configuration, parsing, or unexpected failures
produce an incomplete envelope with empty findings and structured error
metadata. Details may also go to standard error. The process does not use or
contact an LLM at runtime.
This source-integrity statement is specifically about diagnostic mode. VSG
still reads explicitly supplied configuration and local-rule files, and local
rules are Python code that must be trusted. Operating-system logging, wrappers,
or custom rules are outside this fork's boundary.
Fixing is intentionally different. With `--stdin --fix --stdout`, VSG returns
corrected VHDL on standard output and does not write the input to a source file;
a caller such as the bridge may choose to apply that output. If parsing or
fixing cannot complete, this stream mode returns the original input unchanged;
an empty or partial result is never presented as a correction. Existing VSG
file workflows retain their upstream behavior, including any explicitly
requested file changes.
## What is tested
Focused fork tests cover:
- required and conflicting option validation;
- deterministic, versioned JSON and empty diagnostic collections;
- effective severity, fixability, documentation metadata, and Unicode text;
- invalid VHDL, invalid configuration, and unexpected failures with a valid
incomplete JSON document, including parser locations when available;
- rule selector parsing, validation, and deduplication;
- selected rules on the same line and across correction phases;
- corrections that insert lines; and
- unchanged output when a selected rule is unknown.
CI also runs the upstream unit and style suites, builds both wheel and source
distributions, and installs and smoke-tests the wheel through both pip and uv.
The smoke tests exercise stdin/stdout formatting from the installed artifact.
The tests cover known cases; they are not formal verification. In particular,
they do not prove VHDL semantic equivalence after formatting, cover every
third-party local rule, or remove upstream parser limitations such as embedded
PSL and VHDL 2019.
## Risk by operation
| Operation | Source-change risk | Main remaining risk |
| --- | --- | --- |
| `--stdin --diagnostics_json` | None by design | A finding or its metadata may be incomplete or incorrect. |
| `--stdin --stdout --fix` | Returns changed text by design | Applying the output may introduce an unwanted formatting change. |
| `--fix_rule` | Returns selected changes by design | Correction phases can move later findings, making original line selections stale. |
| Existing file-based VSG commands | Unchanged by the fork | They retain the behavior and risks documented by upstream VSG. |
The machine interface uses one-based line ranges because VSG does not provide
generally valid character spans. Consumers must validate the schema and must
not reinterpret internal token indexes as source columns.
For important or safety-critical HDL, keep work in version control, inspect
corrected output, and run the normal simulation, synthesis, linting, and review
process before accepting a change.

172
Jenkinsfile vendored
View File

@ -1,172 +0,0 @@
// Add the Gitea webhook configured for this Jenkins installation.
pipeline {
agent { label 'rust_no_docker' }
options {
disableConcurrentBuilds()
skipDefaultCheckout(true)
}
environment {
PYTHONUNBUFFERED = '1'
UV_CACHE_DIR = "${WORKSPACE}/.uv-cache"
UV_PYTHON_INSTALL_DIR = "${WORKSPACE}/.uv-python"
}
stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
sh 'git fetch --force --tags origin'
}
}
stage('Set up development environment') {
steps {
sh '''
set -eu
command -v uv >/dev/null 2>&1 || {
echo "ERROR: uv is required on the Jenkins worker." >&2
exit 1
}
uv --version
command -v python3
python3 --version
uv venv --python python3 .venv
uv pip install --python .venv/bin/python -e '.[tests,dev]'
'''
}
}
stage('Style') {
steps {
sh 'uv run --no-sync pre-commit run --all-files'
}
}
stage('Tests') {
steps {
sh 'uv run --no-sync python -m unittest'
}
}
stage('Build package') {
steps {
sh './build-package.sh'
}
}
stage('Wheel install with pip') {
steps {
sh '''
set -eu
wheel="$(find dist -maxdepth 1 -type f -name 'vsg-*.whl' -print -quit)"
test -n "${wheel}" || {
echo "ERROR: built wheel was not found." >&2
exit 1
}
python3 -m venv .ci-pip-venv
.ci-pip-venv/bin/python -m pip install "${wheel}"
output="$(
printf 'entity smoke is\nend entity smoke;\n' |
.ci-pip-venv/bin/vsg --stdin --stdout --fix --style jcl --no-failure
)"
printf '%s\n' "${output}" | grep -F 'entity SMOKE is'
'''
}
}
stage('Wheel install with uv') {
steps {
sh '''
set -eu
wheel="$(find dist -maxdepth 1 -type f -name 'vsg-*.whl' -print -quit)"
test -n "${wheel}" || {
echo "ERROR: built wheel was not found." >&2
exit 1
}
uv venv --python .venv/bin/python .ci-uv-venv
uv pip install --python .ci-uv-venv/bin/python "${wheel}"
output="$(
printf 'entity smoke is\nend entity smoke;\n' |
.ci-uv-venv/bin/vsg --stdin --stdout --fix --style jcl --no-failure
)"
printf '%s\n' "${output}" | grep -F 'entity SMOKE is'
'''
}
}
stage('Archive package') {
steps {
archiveArtifacts artifacts: 'dist/*', fingerprint: true, onlyIfSuccessful: true
}
}
stage('Publish package') {
when {
branch 'master'
}
steps {
withCredentials([
string(
credentialsId: 'vsg-gitea-package-token',
variable: 'GITEA_TOKEN'
)
]) {
sh '''
set +x
set -eu
test -n "${GITEA_TOKEN}" || {
echo "ERROR: Jenkins supplied an empty Gitea package token." >&2
exit 1
}
for artifact in dist/vsg-*.tar.gz dist/vsg-*.whl; do
test -f "${artifact}" || {
echo "ERROR: expected package artifact was not found: ${artifact}" >&2
exit 1
}
done
UV_PUBLISH_USERNAME='Dandaedre' \
UV_PUBLISH_PASSWORD="${GITEA_TOKEN}" \
uv publish \
--publish-url 'https://proxy.dandaedre.com/gitea/api/packages/MadGobblins/pypi' \
--check-url 'https://proxy.dandaedre.com/gitea/api/packages/MadGobblins/pypi/simple/' \
--no-attestations \
dist/vsg-*.tar.gz \
dist/vsg-*.whl
'''
}
}
}
}
post {
success {
publishChecks(
conclusion: 'SUCCESS',
name: 'VSG fork CI',
summary: 'VSG tests and package installation checks passed.',
text: 'The wheel was tested through both pip and uv, including stdin/stdout formatting.',
title: 'Build Successful'
)
}
failure {
publishChecks(
conclusion: 'FAILURE',
name: 'VSG fork CI',
summary: 'A VSG fork check failed.',
text: 'Review the Jenkins log for style, tests, build, installation, or publishing failures.',
title: 'Build Failed'
)
}
}
}

View File

@ -1,29 +1,4 @@
include *.properties
include .codespell-ignore
include .flake8
include .gitattributes
include .gitignore
include .pre-commit-config.yaml
include .pre-commit-hooks.yaml
include .readthedocs.yaml
include CODE_OF_CONDUCT.md
include bin/vsg
include bin/vsg_parser
include bin/vsg_rule_doc_gen
include docs/conf.py
include docs/example_configuration_json_file.json
include tox.ini
recursive-include .github *.md
recursive-include .github *.yml
recursive-include docs *.gif
recursive-include docs *.png
recursive-include docs *.rst
recursive-include docs *.svg
recursive-include docs *.csv
recursive-include tests *.json
recursive-include tests *.py
recursive-include tests *.rst
recursive-include tests *.txt
recursive-include tests *.vhd
recursive-include tests *.xml
recursive-include tests *.yaml
include README.rst
prune vsg/tests
include vsg/styles/*.yaml
include vsg/vhdlFile/indent/*.yaml

View File

@ -22,14 +22,22 @@ VHDL Style Guide (VSG)
Announcements
-------------
Update 11/09/2025
Update 02/10/2024
Where has Jeremy been?
For Release 3.22.0.
Just wanted to let everyone know that I have not abandoned this project.
There was a family emergency I had to handle and now work is taking a significant amount of my time.
In an attempt to be more consistent in the configuration files, the following options are changing from camelCase to snake_case:
I plan to start working on this again in December.
+---------------+--------------+
| option | Changed To |
+===============+==============+
| indentSize | indent_size |
+---------------+--------------+
| indentStyle | indent_style |
+---------------+--------------+
An Error message will be generated if the old style is encountered.
A reminder to change the option to snake_case will be given.
Regards,
@ -136,91 +144,11 @@ The latest development version can be cloned...
git clone https://github.com/jeremiah-c-leary/vhdl-style-guide.git
Install prerequisites.
...and then installed locally...
.. code-block:: bash
pip install tox
Build locally, artifacts will appear in ``dist`` directory.
.. code-block:: bash
tox
Fork for ``vsg_bridge_ls``
~~~~~~~~~~~~~~~~~~~~~~~~~
This fork adds stream integration options so VSG can serve editor buffers.
``--diagnostics_json`` reads VHDL from ``--stdin`` and always writes one
versioned JSON diagnostic document to standard output. Failed analysis is a
valid document marked incomplete rather than missing or malformed JSON. Parser
failures include their best available one-based line and column so an editor can
replace stale style findings with a useful syntax error.
``--stdout`` writes fixed VHDL to standard output; if stdin cannot be parsed or
fixing otherwise fails, it returns the original input unchanged so callers get
a safe no-op rather than an empty replacement. Repeatable ``--fix_rule
RULE:LINE`` arguments restrict
``--fix`` to selected rules and one-based lines; they require ``--fix`` and
cannot be combined with ``--fix_only``. ``--no-failure`` permits diagnostic
findings without a nonzero process status. It is the VSG backend required for
`vsg_bridge_ls <https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls>`_.
The bridge README is the main user guide for installing both projects and
configuring an editor.
LLM disclosure and safety
^^^^^^^^^^^^^^^^^^^^^^^^^
* **Human foundation:** the original VSG parser, rules, fix engine, and command
line tool predate this fork and are the work of Jeremy C. Leary and upstream
contributors. The fork maintainer chooses its scope and accepts releases.
* **LLM-assisted work:** the fork-specific stream interface, machine-readable
diagnostics, scoped-fix adapter, packaging, tests, and related documentation
were developed or refined with an LLM coding assistant under maintainer
direction.
* **What is tested:** focused tests cover option validation, deterministic JSON,
Unicode, clean and invalid input, stdout/stderr separation, selected fixes,
and unchanged output for an unknown rule. CI also runs the upstream test and
style suites, builds the package, and smoke-tests installed wheels through
both pip and uv. Tests reduce risk; they do not prove the absence of defects.
* **Practical risk:** ``--diagnostics_json`` only serializes information
collected during normal parsing and rule analysis. It does not modify the
submitted VHDL, change formatting, write the source file, or use an LLM at
runtime. Existing VSG behavior is unchanged when the fork options are absent.
Explicit ``--fix``/``--stdout`` operations are different: they intentionally
return corrected VHDL, which a caller may then apply. Review generated edits
and use version control, especially for safety-critical HDL. See the
`full authorship, testing, and risk disclosure <DISCLOSURE.md>`_ for details.
The preferred installation uses uv and the prebuilt Gitea package:
.. code-block:: bash
uv venv .venv
uv pip install --python .venv/bin/python \
--index https://proxy.dandaedre.com/gitea/api/packages/MadGobblins/pypi/simple/ \
vsg
Installing from ``master`` also works with uv, and either source works with
standard pip. See the bridge's
`installation guide <https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls/src/branch/main/doc/installation.md>`_
for all supported commands and environment setup.
Fork maintainers can build locally with ``./build-package.sh`` and publish the
new artifacts with:
.. code-block:: bash
./build-package.sh ../gitea_token.txt --publish
On ``master``, Jenkins fetches the Git tags used by
``setuptools-git-versioning``, runs both installation smoke tests, archives the
generated distributions, and publishes those exact artifacts to Gitea. The
required Jenkins credential is documented in the bridge development guide.
Use ``./update-fork.sh`` to fetch upstream tags and rebase the small fork patch
series onto the latest upstream ``master``. The script requires a clean
worktree and automatically aborts a failed rebase.
python setup.py install
Usage
-----

View File

@ -1,16 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import os
# Get the path to the executable
executablePath = os.path.dirname(os.path.realpath(__file__))
# Import program modules
sys.path.append(os.path.join(executablePath, ".."))
sys.path.append(os.path.join(executablePath, '..'))
from vsg.__main__ import main
if __name__ == "__main__":
if __name__ == '__main__':
main()

View File

@ -1,16 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import os
# Get the path to the executable
executablePath = os.path.dirname(os.path.realpath(__file__))
# Import program modules
sys.path.append(os.path.join(executablePath, ".."))
sys.path.append(os.path.join(executablePath, '..'))
from vsg.__parser__ import main
if __name__ == "__main__":
if __name__ == '__main__':
main()

View File

@ -1,16 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import os
# Get the path to the executable
executablePath = os.path.dirname(os.path.realpath(__file__))
# Import program modules
sys.path.append(os.path.join(executablePath, ".."))
sys.path.append(os.path.join(executablePath, '..'))
from vsg.__rule_doc_gen__ import main
if __name__ == "__main__":
if __name__ == '__main__':
main()

View File

@ -1,135 +0,0 @@
#!/usr/bin/env bash
set -Eeuo pipefail
show_help() {
cat <<'EOF'
Usage: ./build-package.sh [TOKEN_FILE] [--publish]
Build the VSG source distribution and wheel. With --publish, upload the newly
built artifacts to Gitea. TOKEN_FILE overrides all other token sources.
Optional publishing settings:
GITEA_TOKEN token value used when TOKEN_FILE is omitted
GITEA_TOKEN_FILE
token file used when TOKEN_FILE and GITEA_TOKEN are omitted
(default: ../gitea_token.txt)
GITEA_USERNAME Gitea login name (default: Dandaedre)
GITEA_OWNER package owner (default: MadGobblins)
GITEA_URL Gitea base URL (default: https://proxy.dandaedre.com/gitea)
EOF
}
fail_usage() {
echo "ERROR: $1" >&2
show_help >&2
exit 2
}
publish=false
token_file_argument=""
while [ "$#" -gt 0 ]; do
case "$1" in
--publish)
[ "${publish}" = false ] || fail_usage "--publish was specified more than once."
publish=true
;;
-h|--help)
show_help
exit 0
;;
-*)
fail_usage "unknown option: $1"
;;
*)
[ -z "${token_file_argument}" ] || fail_usage "more than one token file was specified."
token_file_argument="$1"
;;
esac
shift
done
if [ -n "${token_file_argument}" ] && [ "${publish}" = false ]; then
fail_usage "TOKEN_FILE requires --publish."
fi
repo_root="$(git rev-parse --show-toplevel 2>/dev/null)" || {
echo "ERROR: build-package.sh must run inside a Git worktree." >&2
exit 1
}
gitea_token="${GITEA_TOKEN:-}"
if [ -n "${token_file_argument}" ]; then
gitea_token=""
gitea_token_file="${token_file_argument}"
else
gitea_token_file="${GITEA_TOKEN_FILE:-${repo_root}/../gitea_token.txt}"
fi
if [ "${publish}" = true ] && [ -z "${gitea_token}" ]; then
if [ ! -f "${gitea_token_file}" ] || [ ! -r "${gitea_token_file}" ]; then
fail_usage "token file is not a readable regular file: ${gitea_token_file}"
fi
IFS= read -r gitea_token <"${gitea_token_file}" || :
fi
if [ "${publish}" = true ] && [ -z "${gitea_token}" ]; then
fail_usage "token file is empty: ${gitea_token_file}"
fi
cd "${repo_root}"
if ! command -v uv >/dev/null 2>&1; then
echo "ERROR: uv is required to build the package." >&2
exit 1
fi
if [ ! -x .venv/bin/python ]; then
echo "Creating the required local virtual environment..."
uv venv .venv
fi
readonly build_dir=".package-build"
if [ -e "${build_dir}" ]; then
rm -rf -- "${build_dir}"
fi
echo "Building the source distribution and wheel..."
uv build --no-sources --out-dir "${build_dir}"
shopt -s nullglob
artifacts=("${build_dir}"/vsg-*.tar.gz "${build_dir}"/vsg-*.whl)
if [ "${#artifacts[@]}" -lt 2 ]; then
echo "ERROR: uv build completed without producing both expected package formats." >&2
exit 1
fi
mkdir -p dist
built_artifacts=()
for artifact in "${artifacts[@]}"; do
destination="dist/${artifact##*/}"
cp -- "${artifact}" "${destination}"
built_artifacts+=("${destination}")
done
rm -rf -- "${build_dir}"
echo "Built package artifacts:"
printf ' %s\n' "${built_artifacts[@]}"
if [ "${publish}" = true ]; then
readonly gitea_username="${GITEA_USERNAME:-Dandaedre}"
readonly gitea_owner="${GITEA_OWNER:-MadGobblins}"
readonly gitea_url="${GITEA_URL:-https://proxy.dandaedre.com/gitea}"
echo
echo "Publishing package artifacts to Gitea..."
UV_PUBLISH_USERNAME="${gitea_username}" \
UV_PUBLISH_PASSWORD="${gitea_token}" \
uv publish \
--publish-url "${gitea_url}/api/packages/${gitea_owner}/pypi" \
--check-url "${gitea_url}/api/packages/${gitea_owner}/pypi/simple/" \
--no-attestations \
"${built_artifacts[@]}"
echo "Published package artifacts successfully."
fi
echo
echo "Install the wheel into a uv environment with:"
printf ' uv pip install %q\n' "${built_artifacts[-1]}"

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = vhdl-style-guide
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -54,7 +54,7 @@ after_002
|phase_5| |disabled| |error| |alignment|
This rule checks the **after** keywords are aligned in a clock process.
This rule checks the *after* keywords are aligned in a clock process.
|configuring_keyword_alignment_rules_link|
@ -93,7 +93,7 @@ after_003
|phase_1| |disabled| |error| |structure|
This rule checks the **after** keywords do not exist in the reset portion of a clock process.
This rule checks the *after* keywords do not exist in the reset portion of a clock process.
**Violation**
@ -125,23 +125,3 @@ This rule checks the **after** keywords do not exist in the reset portion of a c
end if;
end process clk_proc;
after_500
#########
|phase_6| |error| |case| |case_keyword|
This rule checks the **after** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
a <= 1 AFTER 10 ns;
**Fix**
.. code-block:: vhdl
a <= 1 after 10 ns;

View File

@ -1,9 +0,0 @@
.. include:: includes.rst
Aggregate Rules
---------------
aggregate_500
#############
This rule has been deprecated and replaced with rule `choice_500 <choice_rules.html#choice-500>`_.

View File

@ -263,11 +263,11 @@ This rule checks for consistent capitalization of alias designators.
alias_declaration_600
#####################
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid prefixes on alias designators.
Default prefix is *a_*.
Default prefix is *a\_*.
|configuring_prefix_and_suffix_rules_link|
@ -288,11 +288,11 @@ Default prefix is *a_*.
alias_declaration_601
#####################
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid suffixes on alias designators.
Default prefix is *_a*.
Default prefix is *\_a*.
|configuring_prefix_and_suffix_rules_link|
@ -309,3 +309,4 @@ Default prefix is *_a*.
alias header_a is name;
alias footer_a is name;

13
docs/api.rst Normal file
View File

@ -0,0 +1,13 @@
API
---
VSG was written to be included in other tools.
The command line script provides one means of using VSG.
It also provides an example of how to use the API.
There are two main modules you will use when incorporating VSG into another program:
.. toctree::
vsg.vhdlFile
vsg.rule_list

View File

@ -511,12 +511,11 @@ It is clearer to the reader to state which architecture the end statement is clo
architecture_025
################
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid names for the architecture.
Typical architecture names are: RTL, EMPTY, and BEHAVE.
This rule allows the user to restrict what can be used for an architecture name.
Note that regular expressions are accepted in the **names** field.
.. NOTE:: This rule is disabled by default.
You can enable and configure the names using the following configuration.
@ -532,7 +531,6 @@ Note that regular expressions are accepted in the **names** field.
- rtl
- empty
- behave
- my_pattern.*
**Violation**
@ -884,3 +882,4 @@ This rule checks for consistent capitalization of port names in an architecture
register <= I_DATA;
end architecture rtl;

View File

@ -1,47 +0,0 @@
.. include:: includes.rst
Array Constraint Rules
----------------------
array_constraint_100
####################
|phase_2| |error| |whitespace|
This rule checks for whitespace before the opening parenthesis.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
subtype my_array3 is my_array2 (open)(7 downto 0);
**Fix**
.. code-block:: vhdl
subtype my_array3 is my_array2(open)(7 downto 0);
array_constraint_500
####################
|phase_6| |error| |case| |case_keyword|
This rule checks the **open** keyword in array constraints has the proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
subtype t_my_array is t_array(OPEN)(t_range);
**Fix**
.. code-block:: vhdl
subtype t_my_array is t_array(open)(t_range);

View File

@ -340,3 +340,4 @@ This rule checks the **severity** keyword has proper case.
assert WIDTH > 16
report "FIFO width is limited to 16 bits."
severity FAILURE;

View File

@ -128,3 +128,4 @@ This rule checks the *type_mark* has proper case.
.. code-block:: vhdl
attribute max_delay : time;

View File

@ -6,7 +6,7 @@ Attribute Rules
attribute_001
#############
This rule has been superseded by:
This rule has been superceeded by:
* `attribute_declaration_300 <attribute_declaration_rules.html#attribute-declaration-300>`_
* `attribute_specification_300 <attribute_specification_rules.html#attribute-specification-300>`_
@ -14,7 +14,7 @@ This rule has been superseded by:
attribute_002
#############
This rule has been superseded by:
This rule has been superceeded by:
* `attribute_declaration_500 <attribute_declaration_rules.html#attribute-declaration-500>`_
* `attribute_specification_500 <attribute_specification_rules.html#attribute-specification-500>`_
@ -39,3 +39,4 @@ This rule checks predefined attributes have the proper case.
.. code-block:: vhdl
signal data : std_logic_vector(g_width'range);

View File

@ -155,3 +155,4 @@ This rule checks the **is** keyword has proper case.
.. code-block:: vhdl
attribute coordinate of comp_1 : component is (0.0, 17.5);

View File

@ -1,50 +0,0 @@
.. include:: includes.rst
Bit String Literal Rules
------------------------
bit_string_literal_500
######################
|phase_6| |error| |case|
This rule checks the base specifier has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
signal test : my_vector := X"FFF";
**Fix**
.. code-block:: vhdl
signal test : my_vector := x"FFF";
bit_string_literal_501
######################
|phase_6| |error| |case|
This rule checks the bit value has proper case.
|configuring_uppercase_and_lowercase_rules_link|
The default style is :code:`upper`.
**Violation**
.. code-block:: vhdl
signal test : my_vector := x"FFF";
**Fix**
.. code-block:: vhdl
signal test : my_vector := x"fff";

View File

@ -23,7 +23,7 @@ Block Comment Rules
block_comment_001
#################
|phase_1| |disabled| |error| |unfixable| |structure|
|phase_1| |disabled| |error| |structure|
This rule checks the block comment header is correct.
@ -50,7 +50,7 @@ This rule checks the block comment header is correct.
block_comment_002
#################
|phase_1| |disabled| |error| |unfixable| |structure|
|phase_1| |disabled| |error| |structure|
This rule checks the **comment_left** attribute exists for all comments.
@ -77,7 +77,7 @@ This rule checks the **comment_left** attribute exists for all comments.
block_comment_003
#################
|phase_1| |disabled| |error| |unfixable| |structure|
|phase_1| |disabled| |error| |structure|
This rule checks the block comment footer is correct.
@ -100,3 +100,4 @@ This rule checks the block comment footer is correct.
--| Comment
--| Comment
--+--------------------------[ Footer ]=

View File

@ -153,7 +153,7 @@ block_100
|phase_2| |error| |whitespace|
This rule checks for a single space between the following block elements: label, label colon, **block** keyword, guard open parenthesis, guard close parenthesis, and **is** keywords.
This rule checks for a single space between the following block elements: label, label colon, **block** keyword, guard open parenthesis, guart close parenthesis, and **is** keywords.
|configuring_whitespace_rules_link|
@ -644,7 +644,7 @@ This rule checks the label has proper case on the end block declaration.
block_600
#########
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid suffixes on block labels.
The default suffix is *_blk*.
@ -666,7 +666,7 @@ The default suffix is *_blk*.
block_601
#########
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid prefixes on block labels.
The default prefix is *blk_*.
@ -684,3 +684,4 @@ The default prefix is *blk_*.
.. code-block:: vhdl
blk_block_label : block is

View File

@ -3,111 +3,6 @@
Case Generate Alternative Rules
-------------------------------
case_generate_alternative_100
#############################
|phase_2| |error| |whitespace|
This rule checks for a single space after the **when** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
case data generate
when 3 =>
**Fix**
.. code-block:: vhdl
case data generate
when 3 =>
case_generate_alternative_101
#############################
|phase_2| |error| |whitespace|
This rule checks for a single space before the **=>** operator.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
case data generate
when 3 =>
**Fix**
.. code-block:: vhdl
case data generate
when 3 =>
case_generate_alternative_200
#############################
|phase_3| |error| |blank_line|
This rule checks for a blank line below the **=>** keyword.
|configuring_blank_lines_link|
**Violation**
.. code-block:: vhdl
when 0 =>
a <= b;
**Fix**
.. code-block:: vhdl
when 0 =>
a <= b;
case_generate_alternative_201
#############################
|phase_3| |error| |blank_line|
This rule checks for blank lines or comments above the **when** keyword.
|configuring_previous_line_rules_link|
The default style is :code:`allow_comment`.
**Violation**
.. code-block:: vhdl
case data is
when 3 =>
-- Comment
when 4 =>
**Fix**
.. code-block:: vhdl
case data is
when 3 =>
-- Comment
when 4 =>
case_generate_alternative_300
#############################
@ -118,7 +13,7 @@ case_generate_alternative_500
|phase_6| |error| |case| |case_keyword|
This rule checks the **when** keyword has proper case.
This rule checks the *when* keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
@ -137,4 +32,21 @@ This rule checks the **when** keyword has proper case.
case_generate_alternative_501
#############################
This rule has been deprecated and replaced with rule `choice_500 <choice_rules.html#choice-500>`_.
|phase_6| |error| |case| |case_keyword|
This rule checks the *others* keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
when OTHERS =>
**Fix**
.. code-block:: vhdl
when others =>

View File

@ -3,75 +3,6 @@
Case Generate Statement Rules
-----------------------------
case_generate_statement_100
###########################
|phase_2| |error| |whitespace|
This rule checks for a single space after the **case** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
case data generate
**Fix**
.. code-block:: vhdl
case data generate
case_generate_statement_101
###########################
|phase_2| |error| |whitespace|
This rule checks for a single space before the **generate** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
case data generate
**Fix**
.. code-block:: vhdl
case data generate
case_generate_statement_200
###########################
|phase_3| |error| |blank_line|
This rule checks for blank lines or comments above the **end** keyword.
|configuring_blank_lines_link|
**Violation**
.. code-block:: vhdl
when others =>
null;
end generate;
**Fix**
.. code-block:: vhdl
when others =>
null;
end generate;
case_generate_statement_400
###########################
@ -108,7 +39,7 @@ case_generate_statement_500
|phase_6| |error| |case| |case_keyword|
This rule checks the **case** keyword has proper case.
This rule checks the *case* keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
@ -129,7 +60,7 @@ case_generate_statement_501
|phase_6| |error| |case| |case_keyword|
This rule checks the **generate** keyword has proper case.
This rule checks the *generate* keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
@ -144,3 +75,4 @@ This rule checks the **generate** keyword has proper case.
.. code-block:: vhdl
case expression generate

View File

@ -290,7 +290,29 @@ This rule checks for code after the **=>** operator.
case_013
########
This rule has been superseded by `null_statement_300 <null_statement_rules.html#null-statement-300>`_.
|phase_4| |error| |indent|
This rule checks the indent of the **null** keyword.
**Violation**
.. code-block:: vhdl
when others =>
null;
when others =>
null;
**Fix**
.. code-block:: vhdl
when others =>
null;
when others =>
null;
case_014
########
@ -533,30 +555,3 @@ The default style is :code:`allow_comment`.
-- Comment
when 4 =>
case_300
########
|phase_4| |error| |indent|
This rule checks the indentation of the label.
**Violation**
.. code-block:: vhdl
case_label : case data is
end case;
**Fix**
.. code-block:: vhdl
case_label : case data is
end case;
case_500
########
This rule has been deprecated and replaced with rule `choice_500 <choice_rules.html#choice-500>`_.

View File

@ -1,25 +0,0 @@
.. include:: includes.rst
Choice Rules
------------
choice_500
##########
|phase_6| |error| |case| |case_keyword|
This rule checks the **others** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
'0' when OTHERS;
**Fix**
.. code-block:: vhdl
'0' when others;

View File

@ -3,7 +3,7 @@ Code Tags
VSG supports inline tags embedded into code to enable or disable rules.
This can be useful in fine tuning rule exceptions within a file.
The code tags are embedded in comments similar to pragmas, and must be on its own line.
The code tags are embedded in comments similar to pragmas, and must be on it's own line.
Full rule exclusion
-------------------
@ -86,7 +86,7 @@ Multiple identifiers can be added to a single tag..
-- vsg_disable_next_line process_018
end process;
In the above example, process_016 will only be disabled for the line with the **process** keyword.
In the above example, process_016 will only be disabled for the line with the process keyword.
Successive processes without labels will be flagged by process_016.
Sequential next line exclusions will also be honored:
@ -102,7 +102,7 @@ Sequential next line exclusions will also be honored:
-- vsg_disable_next_line process_018
end process;
In the above example, both process_002 and process_016 will be disabled for the line starting with the **process** keyword.
In the above example, both process_002 and process_016 will be disabled for the line starting with the process keyword.
Comments in code tags
---------------------
@ -119,3 +119,4 @@ The colon character, :, can be used to document why the code tag exists.
b <= read;
end process;
-- vsg_on process_016 process_018 : Done with exclusion until VSG is fixed

View File

@ -33,14 +33,12 @@ comment_010
This rule checks the indent lines starting with comments.
|configuring_comment_indenting_link|
**Violation**
.. code-block:: vhdl
-- Libraries
library ieee;
libary ieee;
-- Define architecture
architecture rtl of fifo is
@ -56,7 +54,7 @@ This rule checks the indent lines starting with comments.
.. code-block:: vhdl
-- Libraries
library ieee;
libary ieee;
-- Define architecture
architecture rtl of fifo is
@ -93,7 +91,7 @@ The indent of the comment will be set to the indent of the current line.
comment_012
###########
|phase_1| |disabled| |warning| |unfixable| |structure|
|phase_1| |disabled| |warning| |structure|
This rule checks for user defined keywords in comments.
@ -138,3 +136,4 @@ This rule checks for a single space after the **--**.
--|Comment 2
---Comment
---------------------------

View File

@ -433,7 +433,7 @@ component_019
|phase_1| |error| |structure|
This rule checks for comments at the end of the port and generic clauses in component declarations.
These comments represent additional maintenance.
These comments represent additional maintainence.
They will be out of sync with the entity at some point.
Refer to the entity for port types, port directions and purpose.
@ -521,27 +521,3 @@ This rule inserts the optional **is** keyword if it does not exist.
end my_component;
component_022
#############
|phase_1| |error| |structure| |structure_optional|
This rule inserts the optional **component_simple_name** if it does not exist.
|configuring_optional_items_link|
**Violation**
.. code-block:: vhdl
component my_component
end component;
**Fix**
.. code-block:: vhdl
component my_component is
end component my_component;

View File

@ -59,7 +59,7 @@ concurrent_003
|phase_5| |error| |alignment|
This rule checks alignment of multiline concurrent simple signal assignments.
Successive lines should align to the space after the assignment operator.
Succesive lines should align to the space after the assignment operator.
However, there is a special case if there are parenthesis in the assignment.
If the parenthesis are not closed on the same line, then the next line will be aligned to the parenthesis.
Aligning to the parenthesis improves readability.
@ -363,3 +363,4 @@ This rule checks the alignment of multiline concurrent simple signal assignments
65535,
32768
);

View File

@ -128,3 +128,4 @@ This rule checks the **else** keyword has proper case.
.. code-block:: vhdl
wr_en <= '0' when (rd_en = '0') else '1';

View File

@ -176,3 +176,4 @@ This rule checks the **else** keyword has proper case.
.. code-block:: vhdl
wr_en <= '0' when (rd_en = '0') else '1';

View File

@ -18,8 +18,7 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath('..'))
import vsg.version
@ -32,47 +31,48 @@ import vsg.version
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.coverage", "sphinx.ext.autodoc", "sphinx.ext.autosectionlabel", "sphinx_rtd_theme"]
suppress_warnings = ["autosectionlabel.*"]
extensions = ['sphinx.ext.coverage', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', 'sphinx_rtd_theme']
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
source_suffix = '.rst'
# The master toctree document.
master_doc = "index"
master_doc = 'index'
# General information about the project.
project = "vhdl-style-guide"
copyright = "2017-2020, Jeremiah C Leary"
author = "Jeremiah C Leary"
project = u'vhdl-style-guide'
copyright = u'2017-2020, Jeremiah C Leary'
author = u'Jeremiah C Leary'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
version = vsg.version.get_version()
# The short X.Y version.
version = str(vsg.version.sVersion)
# The full version, including alpha/beta/rc tags.
release = str(vsg.version.sVersion)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@ -83,29 +83,31 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
"logo_only": False,
"prev_next_buttons_location": "bottom",
"style_external_links": False,
"vcs_pageview_mode": "",
# ToC options
"collapse_navigation": False,
"sticky_navigation": True,
"navigation_depth": 3,
"includehidden": False,
"titles_only": False,
'logo_only': False,
'display_version': True,
'prev_next_bottons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
# 'style_nav_header_background': 'white',
# ToC options
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 3,
'includehidden': False,
'titles_only': False
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
@ -113,17 +115,17 @@ html_theme_options = {
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
"**": [
"relations.html", # needs 'show_related': True theme option to display
"searchbox.html",
],
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = "vhdl-style-guidedoc"
htmlhelp_basename = 'vhdl-style-guidedoc'
# -- Options for LaTeX output ---------------------------------------------
@ -132,12 +134,15 @@ latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
@ -147,7 +152,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "vhdl-style-guide.tex", "vhdl-style-guide Documentation", "Jeremiah C Leary", "manual"),
(master_doc, 'vhdl-style-guide.tex', u'vhdl-style-guide Documentation',
u'Jeremiah C Leary', 'manual'),
]
@ -155,7 +161,10 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "vhdl-style-guide", "vhdl-style-guide Documentation", [author], 1)]
man_pages = [
(master_doc, 'vhdl-style-guide', u'vhdl-style-guide Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
@ -164,5 +173,7 @@ man_pages = [(master_doc, "vhdl-style-guide", "vhdl-style-guide Documentation",
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, "vhdl-style-guide", "vhdl-style-guide Documentation", author, "vhdl-style-guide", "One line description of project.", "Miscellaneous"),
(master_doc, 'vhdl-style-guide', u'vhdl-style-guide Documentation',
author, 'vhdl-style-guide', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -9,7 +9,6 @@ Configuring
configuring_array_multiline_structure_rules.rst
configuring_blank_lines.rst
configuring_block_comments.rst
configuring_comment_indenting.rst
configuring_comment_keywords.rst
configuring_conditional_multiline_indent_rules.rst
configuring_consecutive_blank_line_rules.rst
@ -19,15 +18,12 @@ Configuring
configuring_indent_rules.rst
configuring_keyword_alignment_rules.rst
configuring_length_rules.rst
configuring_library_and_package_name_restriction_rules.rst
configuring_move_token_rules.rst
configuring_multiline_assert_rule.rst
configuring_multiline_constraint_rules.rst
configuring_multiline_indent_rules.rst
configuring_number_of_signals_in_signal_declaration.rst
configuring_number_of_variables_in_variable_declaration.rst
configuring_optional_items.rst
configuring_port_map_new_line.rst
configuring_port_mode_alignment.rst
configuring_pragmas.rst
configuring_prefix_and_suffix_rules.rst
@ -39,7 +35,6 @@ Configuring
configuring_type_of_instantiations.rst
configuring_uppercase_and_lowercase_rules.rst
configuring_use_clause_indenting.rst
configuring_user_error_messages.rst
configuring_whitespace_rules.rst
configuring_whitespace_after_comment_rules.rst
configuring_vhdl_reserved_words.rst

View File

@ -163,7 +163,7 @@ The following code snippet is used in the following examples:
constant c_stimulus : t_stimulus_array :=
(
(
name =>
name =>
"Hold in reset",
clk_in => "01",
rst_in => "11",
@ -187,10 +187,10 @@ Example: |first_paren_new_line| set to |yes|
.. code-block:: vhdl
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name =>
@ -245,7 +245,7 @@ Example: |last_paren_new_line| set to |yes|
constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")
); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name =>
@ -300,7 +300,7 @@ Example: |open_paren_new_line| set to |yes|
name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (
name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name =>
@ -352,7 +352,7 @@ Example: |close_paren_new_line| set to |yes|
)
); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name =>
@ -408,7 +408,7 @@ Example: |new_line_after_comma| set to |yes|
cnt_en_in => "00",
cnt_out => "00")); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name =>
@ -444,10 +444,10 @@ Example: |assign_on_single_line| set to |yes|
.. code-block:: vhdl
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name => "Hold in reset",
@ -523,7 +523,7 @@ would result in the following formatting:
.. code-block:: vhdl
constant c_stimulus : t_stimulus_array :=
constant c_stimulus : t_stimulus_array :=
(
(
name => "Hold in reset",
@ -566,6 +566,4 @@ Rules Enforcing Array Multiline Structure Rules
* `concurrent_012 <concurrent_rules.html#concurrent-012>`_
* `constant_016 <constant_rules.html#constant-016>`_
* `sequential_009 <sequential_rules.html#sequential-009>`_
* `signal_403 <signal_rules.html#signal-403>`_
* `variable_403 <variable_rules.html#variable-403>`_
* `variable_assignment_008 <variable_assignment_rules.html#variable-assignment-008>`_

View File

@ -146,8 +146,6 @@ Rules Enforcing Blank Lines
* `case_009 <case_rules.html#case-009>`_
* `case_010 <case_rules.html#case-010>`_
* `case_200 <case_rules.html#case-200>`_
* `case_generate_alternative_200 <case_generate_alternative_rules.html#case-generate-alternative-200>`_
* `case_generate_statement_200 <case_generate_statement_rules.html#case-generate-statement-200>`_
* `component_016 <component_rules.html#component-016>`_
* `component_018 <component_rules.html#component-018>`_
* `constant_200 <constant_rules.html#constant-200>`_
@ -168,11 +166,10 @@ Rules Enforcing Blank Lines
* `package_body_201 <package_body_rules.html#package-body-201>`_
* `package_body_202 <package_body_rules.html#package-body-202>`_
* `package_body_203 <package_body_rules.html#package-body-203>`_
* `package_instantiation_201 <package_instantiation_rules.html#package-instantiation-201>`_
* `port_001 <port_rules.html#port-001>`_
* `port_map_200 <port_map_rules.html#port-map-200>`_
* `pragma_401 <pragma_rules.html#pragma-401>`_
* `pragma_403 <pragma_rules.html#pragma-403>`_
* `pragma_401 <../pragma_rules.html#pragma-401>`_
* `pragma_403 <../pragma_rules.html#pragma-403>`_
* `process_011 <process_rules.html#process-011>`_
* `process_021 <process_rules.html#process-021>`_
* `process_022 <process_rules.html#process-022>`_
@ -186,7 +183,5 @@ Rules Enforcing Blank Lines
* `subprogram_body_203 <subprogram_body_rules.html#subprogram-body-203>`_
* `subprogram_body_204 <subprogram_body_rules.html#subprogram-body-204>`_
* `subprogram_body_205 <subprogram_body_rules.html#subprogram-body-205>`_
* `subtype_200 <subtype_rules.html#subtype-200>`_
* `subtype_202 <subtype_rules.html#subtype-202>`_
* `type_011 <type_rules.html#type-011>`_
* `type_200 <type_rules.html#type-200>`_

View File

@ -121,20 +121,20 @@ To configure the following example...
rule:
block_comment_001:
disable: false
header_left:
header_left_repeat: '-'
header_string:
header_right_repeat:
disable : False
header_left : ''
header_left_repeat : '-'
header_string : ''
header_right_repeat : ''
block_comment_002:
disable: false
comment_left:
disable : False
comment_left : ''
block_comment_003:
disable: false
footer_left:
footer_left_repeat: '-'
footer_string:
footer_right_repeat:
disable : False
footer_left : ''
footer_left_repeat : '-'
footer_string : ''
footer_right_repeat : ''
Complex Block Comment
^^^^^^^^^^^^^^^^^^^^^

View File

@ -1,153 +0,0 @@
.. _configuring-comment-indenting:
Configuring Comment Indenting
-----------------------------
The desired indenting of comments can vary depending on where the comment occurs.
There are currently two options for configuring indents.
.. |boolean_value| replace::
:code:`<boolean>`
.. |True| replace::
:code:`True`
.. |False| replace::
:code:`False`
.. |align_with_end_of_declarative_part| replace::
:code:`align_with_end_of_declarative_part`
.. |align_with_end_of_statement_part| replace::
:code:`align_with_end_of_statement_part`
.. |align_with_end_of_part_default| replace::
|False|
.. |align_with_end_of_part_True| replace::
|True| = Sets indent to current indent level.
.. |align_with_end_of_part_False| replace::
|False| = Sets indent to next indent level.
+--------------------------------------+-----------------+---------------+----------------------------------+
| Option | Values | Default | Description |
+======================================+=================+===============+==================================+
| |align_with_end_of_declarative_part| | |boolean_value| | :code:`False` | * |align_with_end_of_part_True| |
| | | | * |align_with_end_of_part_False| |
+--------------------------------------+-----------------+---------------+----------------------------------+
| |align_with_end_of_statement_part| | |boolean_value| | :code:`False` | * |align_with_end_of_part_True| |
| | | | * |align_with_end_of_part_False| |
+--------------------------------------+-----------------+---------------+----------------------------------+
This is an example of how to configure these options.
.. code-block:: yaml
indent:
options:
comment:
align_with_end_of_declarative_part: False
align_with_end_of_statement_part: False
The following code snippet is used for all examples.
.. code-block:: vhdl
architecture rtl of fifo is
signal a : std_logic;
-- end of signal declarations
begin
o_output <= a;
-- end of output assignments
end architecture rtl;
Example: |align_with_end_of_declarative_part| set to |True|
###########################################################
The |align_with_end_of_declarative_part| option controls the indent of comments at the end of a declarative part.
Setting this option to |True| will set the indent of the comment to the previous indent level.
.. code-block:: vhdl
architecture rtl of fifo is
signal a : std_logic;
-- end of signal declarations
begin
o_output <= a;
-- end of output assignments
end architecture rtl;
Example: |align_with_end_of_declarative_part| set to |False|
############################################################
The |align_with_end_of_declarative_part| option controls the indent of comments at the end of a declarative part.
Setting this option to |False| will set the indent of the comment to the next indent level.
.. code-block:: vhdl
architecture rtl of fifo is
signal a : std_logic;
-- end of signal declarations
begin
o_output <= a;
-- end of output assignments
end architecture rtl;
Example: |align_with_end_of_statement_part| set to |True|
#########################################################
The |align_with_end_of_statement_part| option controls the indent of comments at the end of a statement part.
Setting this option to |True| will set the indent of the comment to the previous indent level.
.. code-block:: vhdl
architecture rtl of fifo is
signal a : std_logic;
-- end of signal declarations
begin
o_output <= a;
-- end of output assignments
end architecture rtl;
Example: |align_with_end_of_statement_part| set to |False|
##########################################################
The |align_with_end_of_statement_part| option controls the indent of comments at the end of a statement part.
Setting this option to |False| will set the indent of the comment to the next indent level.
.. code-block:: vhdl
architecture rtl of fifo is
signal a : std_logic;
-- end of signal declarations
begin
o_output <= a;
-- end of output assignments
end architecture rtl;
Rules Enforcing Comment Indenting
#################################
* `comment_010 <comment_rules.html#comment-010>`_

View File

@ -59,7 +59,7 @@ There are several options to these rules:
:code:`yes`
.. |default_no| replace::
:code:`no`
:code:`no`
+-----------------------+----------+---------------+------------------------------+
| Option | Values | Default | Description |
@ -100,12 +100,12 @@ The following code snippet is used for all examples and is formatted with the co
output <= '1' when input = "0000" or (input = "1111" and
input2 = "0101") else
sig_a or sig_b when input = "0001" and
sig_a or sig_b when input = "0001" and
input2 = "1001" else
sig_c and sig_d when input = "0010" else
'0';
.. NOTE:: Formatting in the following examples is performed by a separate rule.
.. NOTE:: Formatting in the following exampes is performed by a separate rule.
Example: |align_left| set to |default_yes|
##########################################
@ -225,3 +225,4 @@ Rules Enforcing Conditional Expression Alignment
* `concurrent_009 <concurrent_rules.html#concurrent-009>`_
* `sequential_401 <sequential_rules.html#sequential-401>`_
* `variable_assignment_400 <variable_assignment_400.html#variable-assignment-400>`_

View File

@ -59,9 +59,6 @@ Rules Disabled by Default
* `generic_map_601 <generic_map_rules.html#generic-map-601>`_
* `instantiation_600 <instantiation_rules.html#instantiation-600>`_
* `instantiation_601 <instantiation_rules.html#instantiation-601>`_
* `interface_incomplete_type_declaration_600 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-600>`_
* `interface_incomplete_type_declaration_601 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-601>`_
* `library_012 <library_rules.html#library-012>`_
* `loop_statement_006 <loop_statement_rules.html#loop-statement-006>`_
* `loop_statement_007 <loop_statement_rules.html#loop-statement-007>`_
* `loop_statement_600 <loop_statement_rules.html#loop-statement-600>`_
@ -72,8 +69,6 @@ Rules Disabled by Default
* `package_017 <package_rules.html#package-017>`_
* `package_body_600 <package_body_rules.html#package-body-600>`_
* `package_body_601 <package_body_rules.html#package-body-601>`_
* `package_instantiation_600 <package_instantiation_rules.html#package-instantiation-600>`_
* `package_instantiation_601 <package_instantiation_rules.html#package-instantiation-601>`_
* `port_011 <port_rules.html#port-011>`_
* `port_025 <port_rules.html#port-025>`_
* `port_600 <port_rules.html#port-600>`_
@ -95,13 +90,11 @@ Rules Disabled by Default
* `signal_600 <signal_rules.html#signal-600>`_
* `subtype_004 <subtype_rules.html#subtype-004>`_
* `subtype_100 <subtype_rules.html#subtype-100>`_
* `subtype_200 <subtype_rules.html#subtype-200>`_
* `subtype_600 <subtype_rules.html#subtype-600>`_
* `type_015 <type_rules.html#type-015>`_
* `type_100 <type_rules.html#type-100>`_
* `type_200 <type_rules.html#type-200>`_
* `type_600 <type_rules.html#type-600>`_
* `use_clause_001 <use_clause_rules.html#use-clause-001>`_
* `variable_012 <variable_rules.html#variable-012>`_
* `variable_100 <variable_rules.html#variable-100>`_
* `variable_600 <variable_rules.html#variable-600>`_

View File

@ -89,7 +89,7 @@ The following code snippet is used in the following examples:
signal wr_empty : std_logic;
signal rd_empty : std_logic;
Example: |compact_alignment| set to |yes|
#########################################
@ -105,7 +105,7 @@ Example: |compact_alignment| set to |yes|
signal wr_empty : std_logic;
signal rd_empty : std_logic;
Example: |blank_line_ends_group| set to |yes| others set to |no|
################################################################
@ -148,4 +148,3 @@ Rules Enforcing Identifier Alignment
* `package_019 <package_rules.html#package-019>`_
* `package_body_400 <package_body_rules.html#package-body-400>`_
* `procedure_010 <procedure_rules.html#procedure-010>`_
* `protected_type_body_400 <protected_type_body_rules.html#protected-type-body-400>`_

View File

@ -39,7 +39,7 @@ The :code:`indent_style` option can be set globally for all rules and locally fo
.. code-block:: yaml
rule:
rules:
global:
indent_style: 'smart_tabs'
indent_size: 2
@ -65,9 +65,9 @@ Setting the |option| option to |spaces| will result in leading whitespace being
begin
\tb <= "1000" when a = "00" else
\t\t"0100" when a = "01" else
\t\t"0010" when a = "10" else
\tb <= "1000" when a = "00" else
\t\t"0100" when a = "01" else
\t\t"0010" when a = "10" else
\t\t"0001" when a = "11";
end architecture rtl;
@ -82,9 +82,9 @@ Setting the |option| option to |spaces| will result in leading whitespace being
begin
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
"0001" when a = "11";
end architecture rtl;
@ -105,13 +105,13 @@ Tabs set the indent and spaces are used for alignment.
begin
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
b <= "1000" when a = "00" else
"0100" when a = "01" else
"0010" when a = "10" else
"0001" when a = "11";
end architecture rtl;
**Fix**
.. code-block:: text
@ -122,9 +122,10 @@ Tabs set the indent and spaces are used for alignment.
begin
\tb <= "1000" when a = "00" else
\t "0100" when a = "01" else
\t "0010" when a = "10" else
\tb <= "1000" when a = "00" else
\t "0100" when a = "01" else
\t "0010" when a = "10" else
\t "0001" when a = "11";
end architecture rtl;

View File

@ -5,7 +5,7 @@ Configuring Indentation
-----------------------
VSG follows a predefined set of rules when indenting VHDL code.
The indenting algorithm is driven by a YAML file.
The indenting alogrithm is driven by a YAML file.
The indent values feeding the algorithm can be obtained by using the **-oc** command line argument.
There will be a section starting with **indent**.
@ -46,7 +46,7 @@ where:
| | "+<integer>" | |
| | "-<integer>" | |
+-------------+--------------+-------------------------------------------------------------------+
The **group_name** and **token_name** keys provide unique identifier which can be matched to types of tokens after the file has been parsed.
There are more tokens than are currently defined in the indent configuration, as not all tokens require indenting rules.
@ -139,7 +139,7 @@ This file can then be applied with the **-c** option.
Example 2
#########
Instantiations default the indentation of port map and generic map to one more than the label:
Instantions default the indentation of port map and generic map to one more than the label:
.. code-block:: vhdl
@ -182,33 +182,33 @@ In this case, there is a file named `component_instantiation_statement.py` file:
.. code-block:: python
from vsg import parser
class instantiation_label(parser.label):
'''
unique_id = component_instantiation_statement : instantiation_label
'''
def __init__(self, sString):
super().__init__(sString)
parser.label.__init__(self, sString)
class label_colon(parser.label_colon):
'''
unique_id = component_instantiation_statement : label_colon
'''
def __init__(self):
super().__init__()
parser.label_colon.__init__(self)
class semicolon(parser.semicolon):
'''
unique_id = component_instantiation_statement : semicolon
'''
def __init__(self, sString=None):
super().__init__()
parser.semicolon.__init__(self)
Export indent configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -260,7 +260,7 @@ Update indent configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^
The default indent is to increase the indent by 1 after the `instantiation_label` is found and then decrease the indent by 1 when the `semicolon` is found.
To enforce the desired indent, change the `after` entry for both `instantiation_label` and `semicolon` to `"current"`.
To enforce the desired indent, change the `after` entiry for both `instantiation_label` and `semicolon` to `"current"`.
Using `"current"` tells VSG to not change the indent after the label and semicolon are encountered.
Extract the `component_instantiation_statement` section out of the JSON file and save it to a new configuration file or add it to an existing one.
@ -299,25 +299,25 @@ Using the above configuration on the following file...
architecture rtl of fifo is
begin
U_FIFO : FIFO
generic map ();
a <= b;
U_FIFO : FIFO
port map ();
a <= b;
U_FIFO : FIFO
generic map ()
port map ();
a <= b;
end architecture rtl;
...results in the following updates:
@ -325,23 +325,23 @@ Using the above configuration on the following file...
.. code-block:: vhdl
architecture rtl of fifo is
begin
u_fifo : component fifo
generic map ();
a <= b;
u_fifo : component fifo
port map ();
a <= b;
u_fifo : component fifo
generic map ()
port map ();
a <= b;
end architecture rtl;

View File

@ -41,10 +41,10 @@ There are several options to these rules:
:code:`separate_generic_port_alignment`
.. |separate_generic_port_alignment__yes| replace::
:code:`yes` = stop if **port** keyword detected.
:code:`yes` = stop if port keyword detected.
.. |separate_generic_port_alignment__no| replace::
:code:`no` = continue if **port** keyword detected.
:code:`no` = continue if port keyword detected.
.. |if_control_statements_ends_group| replace::
:code:`if_control_statements_ends_group`
@ -904,7 +904,7 @@ In the example below, the others aggregates are ignored which will allow the ENU
Example: |align_to| set to :code:`current_indent`
#################################################
For example in rule :code:`process_028` the close parenthesis will be aligned with the **process** keyword.
For example in rule :code:`process_028` the close parenthesis will be aligned with the process keyword.
**Violation**
@ -986,11 +986,7 @@ Rules Enforcing Keyword Alignment
* `process_035 <process_rules.html#process-035>`_
* `process_400 <process_rules.html#process-400>`_
* `process_401 <process_rules.html#process-401>`_
* `protected_type_body_401 <protected_type_body_rules.html#protected-type-body-401>`_
* `protected_type_body_402 <protected_type_body_rules.html#protected-type-body-402>`_
* `sequential_400 <sequential_rules.html#sequential-400>`_
* `signal_401 <signal_rules.html#signal-401>`_
* `subprogram_body_400 <subprogram_body_rules.html#subprogram-body-400>`_
* `subprogram_body_401 <subprogram_body_rules.html#subprogram-body-401>`_
* `type_400 <type_rules.html#type-400>`_
* `variable_401 <variable_rules.html#variable-401>`_

View File

@ -22,7 +22,7 @@ Use the following configuration to change the line length to 180.
length_001 :
length : 180
Overriding File Line Length
Overridding File Line Length
############################
Limiting the length of a VHDL file can improve readability.
@ -37,7 +37,7 @@ Use the following configuration to change the file length to 5000.
length_002 :
length : 5000
Overriding Process Line Length
Overridding Process Line Length
###############################
Limiting the length of a VHDL processes can improve readability.

View File

@ -1,70 +0,0 @@
.. _configuring-library-and-package-name-restriction-rules:
Configuring Library and Package Name Restriction Rules
------------------------------------------------------
There are rules which will check for invalid package names in library and use clauses.
These rules are disabled by default and must be enabled before they will perform any checks.
There is one option for these rules:
.. |names| replace::
:code:`names`
.. |default| replace::
:code:`std_logic_arith` for **use_clause_001**. None for **library_012**
.. |values__names| replace::
List of strings
.. |action__names| replace::
Search for libraries and packages with the user defined names
+--------------------------------------+-----------------+-----------+------------------------------------------------+
| Option | Values | Default | Description |
+======================================+=================+===========+================================================+
| |names| | |values__names| | |default| | * |action__names| |
+--------------------------------------+-----------------+-----------+------------------------------------------------+
This is an example of how to configure the option.
.. code-block:: yaml
rule :
library_012:
names:
- "work"
- "std_logic_arith"
.. NOTE:: All examples below are using the rule **use_clause_001**.
Example: |names| set to list ["std_logic_arith"]
################################################
The following code would fail with this option:
.. code-Block:: vhdl
library ieee;
use ieee.std_logic_arith.all;
Example: |names| set to ["std_logic_arith", "my_package"]
##############################################
The following code would fail three times with this option:
.. code-block:: vhdl
library ieee;
use ieee.std_logic_arith.all;
library work;
use work.my_package.all;
Rules Enforcing Valid Names
###########################
* `library_012 <library_rules.html#library-012>`_
* `use_clause_001 <use_clause_rules.html#use-clause-001>`_

View File

@ -14,13 +14,13 @@ The method of indenting can be configured using one of the following options:
The setting :code:`left` enforces multiline report statements using indents.
.. |report_description| replace::
The setting :code:`report` aligns multiline report statements to the **report** keyword.
The setting :code:`report` aligns multiline report statements to the report keyword.
.. |values| replace::
:code:`left`, :code:`report`
.. |default_value| replace::
:code:`report`
:code:`left`
.. |report| replace::
:code:'report`
@ -46,7 +46,7 @@ This is an example of how to configure these options.
Example: |alignment| set to |report|
####################################
Align report expressions with the **report** keyword.
Align report expressions with the report keyword.
.. code-block:: vhdl
@ -58,7 +58,7 @@ Align report expressions with the **report** keyword.
Example: |alignment| set to |left|
##################################
Align report expressions an additional indent level from the **report** keyword.
Align report expressions an additional indent level from the report keyword.
.. code-block:: vhdl
@ -72,3 +72,4 @@ Rules Enforcing Alignment
* `assert_400 <assert_rules.html#assert-400>`_
* `report_statement_400 <report_statement_rules.html#report-statement-400>`_

View File

@ -53,7 +53,7 @@ There are several options to the structure rules:
The setting :code:`all_in_one_line` will combine :code:`array_constraints` into a single line
.. |one_line_per_dimension| replace::
The setting :code:`one_line_per_dimension` will place each dimension on its own line
The setting :code:`one_line_per_dimension` will place each dimension on it's own line
.. |exceptions| replace::
Refer to :ref:`exceptions` for more information.

View File

@ -38,10 +38,10 @@ There are several options to these rules:
+---------------+----------+---------------+----------------------+
| Option | Values | Default | Description |
+===============+==========+===============+======================+
| |align_left| | |values| | |default_no| | * |align_left__yes| |
| |align_left| | |values| | |default_yes| | * |align_left__yes| |
| | | | * |align_left__no| |
+---------------+----------+---------------+----------------------+
| |align_paren| | |values| | |default_yes| | * |align_paren__yes| |
| |align_paren| | |values| | |default_no| | * |align_paren__yes| |
| | | | * |align_paren__no| |
+---------------+----------+---------------+----------------------+
@ -127,8 +127,6 @@ Rules Enforcing Multiline Indent Rules
* `sequential_004 <sequential_rules.html#sequential-004>`_
* `sequential_402 <sequential_rules.html#sequential-402>`_
* `signal_400 <signal_rules.html#signal-400>`_
* `signal_402 <signal_rules.html#signal-402>`_
* `variable_400 <signal_rules.html#variable-400>`_
* `variable_402 <variable_rules.html#variable-402>`_
* `variable_assignment_004 <variable_assignment_rules.html#variable-assignment-004>`_
* `variable_assignment_401 <variable_assignment_rules.html#variable-assignment-401>`_

View File

@ -5,7 +5,7 @@ Configuring Number of Signals in Signal Declaration
---------------------------------------------------
VHDL allows of any number of signals to be declared within a single signal declaration.
While this may be allowed, in practice there are limits imposed by the designers.
While this may be allowed, in practice there are limits impossed by the designers.
Limiting the number of signals declared improves the readability of VHDL code.
The default number of signals allowed, 2, can be set by configuring rule **signal_015**.

View File

@ -1,30 +0,0 @@
.. _configuring-number-of-variables-in-variable-declaration:
Configuring Number of Variables in Variable Declaration
-------------------------------------------------------
VHDL allows of any number of variables to be declared within a single variable declaration.
While this may be allowed, in practice there are limits imposed by the designers.
Limiting the number of variables declared improves the readability of VHDL code.
The default number of variables allowed, 2, can be set by configuring rule **variable_015**.
Overriding Number of variables
##############################
The default setting can be changed using a configuration.
We can use the following configuration to change the number of variables allowed to 1.
.. code-block:: yaml
---
rule :
variable_015 :
consecutive : 1
Rules Enforcing Number of variables
###################################
* `variable_015 <variable_rules.html#variable-015>`_

View File

@ -89,23 +89,19 @@ Rules Enforcing Optional Items
* `block_002 <block_rules.html#block-002>`_
* `block_007 <block_rules.html#block-007>`_
* `component_021 <component_rules.html#component-021>`_
* `component_022 <component_rules.html#component-022>`_
* `context_021 <context_rules.html#context-021>`_
* `context_022 <context_rules.html#context-022>`_
* `entity_015 <entity_rules.html#entity-015>`_
* `entity_019 <entity_rules.html#entity-019>`_
* `function_018 <function_rules.html#function-018>`_
* `function_020 <function_rules.html#function-020>`_
* `generate_011 <generate_rules.html#generate-011>`_
* `instantiation_033 <instantiation_rules.html#instantiation-033>`_
* `instantiation_036 <instantiation_rules.html#instantiation-036>`_
* `loop_statement_007 <loop_statement_rules.html#loop-statement-007>`_
* `package_007 <package_rules.html#package-007>`_
* `package_014 <package_rules.html#package-014>`_
* `package_body_002 <package_body_rules.html#package-body-002>`_
* `package_body_003 <package_body_rules.html#package-body-003>`_
* `procedure_012 <procedure_rules.html#procedure-012>`_
* `procedure_014 <procedure_rules.html#procedure-014>`_
* `process_012 <process_rules.html#process-012>`_
* `process_018 <process_rules.html#process-018>`_
* `record_type_definition_005 <record_type_definition_rules.html#record-type-definition-005>`_

View File

@ -1,7 +1,7 @@
Overview
========
VSG can use a configuration file to alter its behavior and/or include a list of files to analyze.
VSG can use a configuration file to alter it's behavior and/or include a list of files to analyze.
This is accomplished by passing JSON and/or YAML file(s) through the **--configuration** command line argument.
This is the basic form of a configuration file in JSON:
@ -10,22 +10,18 @@ This is the basic form of a configuration file in JSON:
{
"file_list": [
"fifo.vhd",
{
"source/spi.vhd": {
"rule": {
"ruleId_ruleNumber": "blah"
}
"source/spi.vhd": {
"rule": {
"ruleId_ruleNumber": "blah"
}
},
"$PATH_TO_FILE/spi_master.vhd",
"$OTHER_PATH/src/*.vhd"
],
"file_rules": [
{
"source/i2c.vhd": {
"rule": {
"ruleId_ruleNumber": "blah"
}
"source/i2c.vhd": {
"rule": {
"ruleId_ruleNumber": "blah"
}
}
],
@ -124,7 +120,7 @@ rule
Any attribute of any rule can be configured.
Using **global** will set the attribute for every rule.
Using **group** will set attributes for groups of rules.
Each rule is addressable by using its unique **ruleId** and **ruleNumber** combination. For example, whitespace_006 or port_010.
Each rule is addressable by using it's unique **ruleId** and **ruleNumber** combination. For example, whitespace_006 or port_010.
.. NOTE::
If **global** and unique attributes are set at the same time, the unique attribute will take precedence.
@ -196,14 +192,12 @@ If the same rule is defined in all four locations as in the example below, then
{
"file_list": [
{
"entity.vhd": {
"rule": {
"length_001":{
"disable": true
}
"entity.vhd": {
"rule": {
"length_001":{
"disable": true
}
}
}
},
"architecture.vhd",
"package.vhd"

View File

@ -1,118 +0,0 @@
.. _configuring-port-map-new-line:
Configuring Port Map New Line
-----------------------------
There is a rule which will check for new lines before the **port** keyword in port map aspects relative to what preceded it.
.. code-block:: text
block_header ::=
[ generic_clause [ generic_map_aspect ; ] ]
[ port_clause [ port_map_aspect ; ] ]
component_instantiation_statement ::=
instantiation_label :
instantiated_unit
[ generic_map_aspect ]
[ port_map_aspect ]
There are separate rules for the structure of the constraint and the indenting.
Both rules are required to ensure proper formatting of multiline constraints.
There are several options to the structure rules:
.. |values| replace::
:code:`add_new_line`, :code:`remove_new_line`
.. |add_new_line| replace::
The setting :code:`add_new_line` enforces a carriage return (alias "new line") [and, consequently by indentation rules kicking in, also (indirectly) enforces the indentation of the new line]
.. |remove_new_line| replace::
The setting :code:`remove_new_line` enforces the removal of any potential space and carriage return
.. |default_value| replace::
:code:`add_new_line`
+---------------------------------------+-----------+----------------------------+----------------------------+
| Option | Values | Default Value | Description |
+=======================================+===========+============================+============================+
| :code:`after_port_clause` | |values| | |default_value| | * |add_new_line| |
+---------------------------------------+ | | * |remove_new_line| |
| :code:`after_instantiated_unit` | | | |
+---------------------------------------+ | | |
| :code:`after_generic_map_aspect` | | | |
+---------------------------------------+-----------+----------------------------+----------------------------+
Example: :code:`after_port_clause` set to :code:`remove_new_line`
#################################################################
Setting the :code:`after_port_clause` option to :code:`remove_new_line` will result in the following formatting:
.. code-block:: vhdl
port (
); port map (
)
Example: :code:`after_port_clause` set to :code:`add_new_line`
##############################################################
Setting the :code:`after_port_clause` option to :code:`add_new_line` will result in the following formatting:
.. code-block:: vhdl
port (
);
port map (
)
Example: :code:`after_instantiated_unit` set to :code:`remove_new_line`
#######################################################################
Setting the :code:`after_instantiated_unit` option to :code:`remove_new_line` will result in the following formatting:
.. code-block:: vhdl
U_FIFO : FIFO port map (
)
Example: :code:`after_instantiated_unit` set to :code:`add_new_line`
####################################################################
Setting the :code:`after_instantiated_unit` option to :code:`add_new_line` will result in the following formatting:
.. code-block:: vhdl
U_FIFO : FIFO
port map (
)
Example: :code:`after_generic_map_aspect` set to :code:`remove_new_line`
########################################################################
Setting the :code:`after_generic_map_aspect` option to :code:`remove_new_line` will result in the following formatting:
.. code-block:: vhdl
generic map (
) port map (
)
Example: :code:`after_generic_map_aspect` set to :code:`add_new_line`
#####################################################################
Setting the :code:`after_generic_map_aspect` option to :code:`add_new_line` will result in the following formatting:
.. code-block:: vhdl
generic map (
)
port map (
)
Rules Enforcing This Configuration
##################################
* `instantiation_005 <instantiation_rules.html#instantiation-005>`_

View File

@ -93,8 +93,8 @@ would result in the following format being enforced:
O_OUTPUT : out std_logic;
IO_INOUT : inout std_logic;
Rules Enforcing Alignment
#########################
Rules Enforcing Aligment
########################
* `port_007 <port_rules.html#port-007>`_
* `port_008 <port_rules.html#port-008>`_

View File

@ -5,7 +5,7 @@ Configuring Pragmas
-------------------
Pragmas are comments with meta data used by various vendors.
These pragmas communicate information which can change how vendor tools interpret code.
These pragmas communicate information which can change how vendor tools interprate code.
There does not appear to be a standard for defining pragmas.
This presents a challenge to detecting them across all vendor tools.
@ -68,3 +68,4 @@ Rules Using Pragmas
* `pragma_401 <pragma_rules.html#pragma-401>`_
* `pragma_402 <pragma_rules.html#pragma-402>`_
* `pragma_403 <pragma_rules.html#pragma-403>`_

View File

@ -54,52 +54,48 @@ Exceptions to enforcing prefixes and suffixes can be given using the :code:`exce
# Each suffix rule needs to be enabled explicitly.
disable: false
suffixes: ['_i', '_o']
exceptions: ['CLK', '.*_FIELD']
exceptions: ['CLK']
The exceptions option provides a list of keywords, that when matched, prevents the rule from validating the prefix or suffix.
The keywords are treated as case insensitive and support regular expressions.
The keywords are treated as case insensitive.
Rules Enforcing Prefixes and Suffixes
#####################################
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| **Element** | **Prefix Rule** | **Suffix Rule** |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Block Label | `block_601 <block_rules.html#block-601>`_ | `block_600 <block_rules.html#block-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Constant Identifier | `constant_015 <constant_rules.html#constant-015>`_ | `constant_600 <constant_rules.html#constant-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Function Designator | `function_600 <function_rules.html#function-600>`_ | `function_601 <function_rules.html#function-601>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Generate Label | `generate_017 <generate_rules.html#generate-017>`_ | `generate_600 <generate_rules.html#generate-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Generate Parameter Identifier | `generate_601 <generate_rules.html#generate-601>`_ | `generate_602 <generate_rules.html#generate-602>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Generic Identifier | `generic_020 <generic_rules.html#generic-020>`_ | `generic_600 <generic_rules.html#generic-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Generic Map Identifier | `generic_map_601 <generic_map_rules.html#generic-map-601>`_ | `generic_map_600 <generic_map_rules.html#generic-map-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Loop Label | `loop_600 <loop_statement_rules.html#loop-statement-600>`_ | `loop_601 <loop_statement_rules.html#loop-statement-601>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Loop Parameter Identifier | `loop_602 <loop_statement_rules.html#loop-statement-602>`_ | `loop_603 <loop_statement_rules.html#loop-statement-603>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Generic Type Identifier | `interface_incomplete_type_declaration_600 <interface_incomplete_type_declaration.html#interface-incomplete-type-declaration-600>`_ | `interface_incomplete_type_declaration_601 <interface_incomplete_type_declaration.html#interface-incomplete-type-declaration-601>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Package Identifier | `package_017 <package_rules.html#package-017>`_ | `package_016 <package_rules.html#package-016>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Package Body Identifier | `package_body_601 <package_body_rules.html#package-body-601>`_ | `package_body_600 <package_body_rules.html#package-body-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Package Instantiation Identifier | `package_instantiation_601 <package_instantiation_rules.html#package-instantiation-601>`_ | `package_instantiation_600 <package_instantiation_rules.html#package-instantiation-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Port Identifier | `port_011 <port_rules.html#port-011>`_ | `port_025 <port_rules.html#port-025>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Process Label | `process_036 <process_rules.html#process-036>`_ | `process_600 <process_rules.html#process-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Signal Identifier | `signal_008 <signal_rules.html#signal-008>`_ | `signal_600 <signal_rules.html#signal-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Subtype Identifier | `subtype_004 <subtype_rules.html#subtype-004>`_ | `subtype_600 <subtype_rules.html#subtype-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Type Identifier | `type_definition_015 <type_rules.html#type-015>`_ | `type_definition_600 <type_rules.html#type-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
| Variable Identifier | `variable_012 <variable_rules.html#variable-012>`_ | `variable_600 <variable_rules.html#variable-600>`_ |
+----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| **Element** | **Prefix Rule** | **Suffix Rule** |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Block Label | `block_601 <block_rules.html#block-601>`_ | `block_600 <block_rules.html#block-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Constant Identifier | `constant_015 <constant_rules.html#constant-015>`_ | `constant_600 <constant_rules.html#constant-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Function Designator | `function_600 <function_rules.html#function-600>`_ | `function_601 <function_rules.html#function-601>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Generate Label | `generate_017 <generate_rules.html#generate-017>`_ | `generate_600 <generate_rules.html#generate-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Generate Parameter Identifier | `generate_601 <generate_rules.html#generate-601>`_ | `generate_602 <generate_rules.html#generate-602>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Generic Identifier | `generic_020 <generic_rules.html#generic-020>`_ | `generic_600 <generic_rules.html#generic-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Generic Map Identifier | `generic_map_601 <generic_map_rules.html#generic-map-601>`_ | `generic_map_600 <generic_map_rules.html#generic-map-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Loop Label | `loop_600 <loop_statement_rules.html#loop-statement-600>`_ | `loop_601 <loop_statement_rules.html#loop-statement-601>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Loop Parameter Identifier | `loop_602 <loop_statement_rules.html#loop-statement-602>`_ | `loop_603 <loop_statement_rules.html#loop-statement-603>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Package Identifier | `package_017 <package_rules.html#package-017>`_ | `package_016 <package_rules.html#package-016>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Package Body Identifier | `package_body_601 <package_body_rules.html#package-body-601>`_ | `package_body_600 <package_body_rules.html#package-body-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Port Identifier | `port_011 <port_rules.html#port-011>`_ | `port_025 <port_rules.html#port-025>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Process Label | `process_036 <process_rules.html#process-036>`_ | `process_600 <process_rules.html#process-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Signal Identifier | `signal_008 <signal_rules.html#signal-008>`_ | `signal_600 <signal_rules.html#signal-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Subtype Identifier | `subtype_004 <subtype_rules.html#subtype-004>`_ | `subtype_600 <subtype_rules.html#subtype-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Type Identifier | `type_definition_015 <type_rules.html#type-015>`_ | `type_definition_600 <type_rules.html#type-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+
| Variable Identifier | `variable_012 <variable_rules.html#variable-012>`_ | `variable_600 <variable_rules.html#variable-600>`_ |
+-------------------------------+----------------------------------------------------------------+----------------------------------------------------------------+

View File

@ -59,10 +59,10 @@ There are several options to these rules, which can be selected by using the :co
+======================+================+===================+===================================================+
| |style| | |style_values| | |default_value| | * |style__no_blank_line| |
| | | | * |style__require_blank_line| |
| | | | * |style__no_code| |
| | | | * |style__allow_comment| |
| | | | * |style__require_comment| |
| | | | * |style__no_blank_line_unless_different_library| |
| | | | * |style__no_code| |
| | | | * |style__allow_comment| |
| | | | * |style__require_comment| |
| | | | * |style__no_blank_line_unless_different_library| |
+----------------------+----------------+-------------------+---------------------------------------------------+
.. NOTE:: Unless stated in the rule description, the default style is :code:`require_blank_line`.
@ -241,7 +241,6 @@ Rules Enforcing Previous Lines
* `block_200 <block_rules.html#block-200>`_
* `case_007 <case_rules.html#case-007>`_
* `case_201 <case_rules.html#case-201>`_
* `case_generate_alternative_201 <case_generate_alternative_rules.html#case-generate-alternative-201>`_
* `component_003 <component_rules.html#component-003>`_
* `context_003 <context_rules.html#context-003>`_
* `entity_003 <entity_rules.html#entity-003>`_
@ -255,11 +254,9 @@ Rules Enforcing Previous Lines
* `loop_statement_202 <loop_statement_rules.html#loop-statement-202>`_
* `package_003 <package_rules.html#package-003>`_
* `package_body_200 <package_body_rules.html#package-body-200>`_
* `package_instantiation_200 <package_instantiation_rules.html#package-instantiation-200>`_
* `pragma_400 <pragma_rules.html#pragma-400>`_
* `pragma_402 <pragma_rules.html#pragma-402>`_
* `pragma_400 <../pragma_rules.html#pragma-400>`_
* `pragma_402 <../pragma_rules.html#pragma-402>`_
* `procedure_200 <procedure_rules.html#procedure-200>`_
* `process_015 <process_rules.html#process-015>`_
* `record_type_definition_201 <record_type_definition_rules.html#record-type-definition-201>`_
* `subtype_201 <subtype_rules.html#subtype-201>`_
* `type_010 <type_rules.html#type-010>`_

View File

@ -28,3 +28,4 @@ The following example configures the rules to:
disable: True
naming:
disable: True

View File

@ -636,4 +636,4 @@ The above configuration when applied to the code snippet will result in the foll
Rules Enforcing Selected Assignment Structure Rules
###################################################
* `selected_assignment_001 <selected_assignment_rules.html#selected-assignment-001>`_
* `selected_assignment_001 <selected_assingment_rules.html#selected-assignment-001>`_

View File

@ -7,10 +7,10 @@ Configuring Simple Multiline Structure Rules
:code:`new_line_after_assign`
.. |new_line_after_assign__yes| replace::
:code:`yes` = Adds a carriage return (alias "new line") after the assignment operator.
:code:`yes` = Adds a carriage return (alias "new line") after the assigment operator.
.. |new_line_after_assign__no| replace::
:code:`no` = Removes a carriage return (alias "new line") after the assignment operator.
:code:`no` = Removes a carriage return (alias "new line") after the assigment operator.
.. |new_line_after_assign__ignore| replace::
:code:`ignore` = Ignores any formatting after the assignment operator.
@ -43,7 +43,7 @@ There are several options to these rules:
+-------------------------+-------------+---------------+-----------------------------------+
| Method | Values | Default | Description |
+=========================+=============+===============+===================================+
| |new_line_after_assign| | |values1| | |default_no| | * |new_line_after_assign__yes| |
| |new_line_after_assign| | |values1| | |default_yes| | * |new_line_after_assign__yes| |
| | | | * |new_line_after_assign__no| |
| | | | * |new_line_after_assign__ignore| |
+-------------------------+-------------+---------------+-----------------------------------+

View File

@ -41,7 +41,7 @@ This is an example of how to configure these options.
.. code-block:: yaml
rule :
instantiation_034:
instantiation_010:
method: 'component'
Example: |method| set to |component_option|

View File

@ -23,20 +23,14 @@ There are several options to these rules:
.. |camelCase_value| replace::
:code:`camelCase`
.. |relaxedCamelCase_value| replace::
:code:`relaxedCamelCase`
.. |PascalCase_value| replace::
:code:`PascalCase`
.. |RelaxedPascalCase_value| replace::
:code:`RelaxedPascalCase`
.. |upper_snake_case_value| replace::
:code:`UPPER_SNAKE_CASE`
.. |PascalSnakeCase_value| replace::
:code:`Pascal_Snake_Case`
.. |regex_value| replace::
:code:`regex`
.. |lower_snake_case_value| replace::
:code:`lower_snake_case`
.. |case_option__upper| replace::
|upper_value| = Enforce upper case
@ -48,25 +42,13 @@ There are several options to these rules:
|upper_or_lower_value| = Allow upper or lower case
.. |case_option__camelCase| replace::
|camelCase_value| = Enforce camelCase with two allowed uppercase characters in a row
.. |case_option__relaxedCamelCase| replace::
|relaxedCamelCase_value| = Enforce camelCase with any number of uppercase characters in a row
|camelCase_value| = Enforce camelCase
.. |case_option__PascalCase| replace::
|PascalCase_value| = Enforce PascalCase with two allowed uppercase characters in a row
.. |case_option__RelaxedPascalCase| replace::
|RelaxedPascalCase_value| = Enforce PascalCase with any number of uppercase characters in a row
.. |case_option__PascalSnakeCase| replace::
|PascalSnakeCase_value| = Enforce Pascal_Snake_Case
.. |case_option__regex| replace::
|regex_value| = Enforce user defined regex
|PascalCase_value| = Enforce PascalCase
.. |case_values| replace::
|upper_value|, |lower_value|, |upper_or_lower_value|, |camelCase_value|, |relaxedCamelCase_value|, |PascalCase_value|, |RelaxedPascalCase_value|, |regex_value|
|upper_value|, |lower_value|, |upper_or_lower_value|, |camelCase_value|, |PascalCase_value|
.. |case_default_value| replace::
|lower_value|
@ -101,45 +83,28 @@ There are several options to these rules:
.. |ce_values| replace::
List of strings
.. |regex_values| replace::
String
.. |ce_default_value| replace::
Empty list
.. |regex_default_value| replace::
Empty String
.. |ce_description| replace::
Enforce case for items in the list.
.. |regex_option| replace::
:code:`regex`
+----------------------------+------------------------+----------------------+-----------------------------------+
| Option | Values | Default Value | Description |
+============================+========================+======================+===================================+
| |case_option| | |case_values| | |case_default_value| | * |case_option__upper| |
| | | | * |case_option__lower| |
| | | | * |case_option__upper_or_lower| |
| | | | * |case_option__camelCase| |
| | | | * |case_option__PascalCase| |
+----------------------------+------------------------+----------------------+-----------------------------------+
| |prefix_exceptions_option| | |pe_values| | |pe_default_value| | |pe_description| |
+----------------------------+------------------------+----------------------+-----------------------------------+
| |suffix_exceptions_option| | |se_values| | |se_default_value| | |se_description| |
+----------------------------+------------------------+----------------------+-----------------------------------+
| |case_exceptions_option| | |ce_values| | |ce_default_value| | |ce_description| |
+----------------------------+------------------------+----------------------+-----------------------------------+
.. |regex_description| replace::
Enforce case based on regex string
+----------------------------+---------------------------+-----------------------+------------------------------------+
| Option | Values | Default Value | Description |
+============================+===========================+=======================+====================================+
| |case_option| | |upper_value| | |case_default_value| | * |case_option__upper| |
| | |lower_value| | | * |case_option__lower| |
| | |upper_or_lower_value| | | * |case_option__upper_or_lower| |
| | |camelCase_value| | | * |case_option__camelCase| |
| | |relaxedCamelCase_value| | | * |case_option__relaxedCamelCase| |
| | |PascalCase_value| | | * |case_option__PascalCase| |
| | |RelaxedPascalCase_value| | | * |case_option__RelaxedPascalCase| |
| | |PascalSnakeCase_value| | | * |case_option__PascalSnakeCase| |
| | |regex_value| | | * |case_option__regex| |
+----------------------------+---------------------------+-----------------------+------------------------------------+
| |prefix_exceptions_option| | |pe_values| | |pe_default_value| | |pe_description| |
+----------------------------+---------------------------+-----------------------+------------------------------------+
| |suffix_exceptions_option| | |se_values| | |se_default_value| | |se_description| |
+----------------------------+---------------------------+-----------------------+------------------------------------+
| |case_exceptions_option| | |ce_values| | |ce_default_value| | |ce_description| |
+----------------------------+---------------------------+-----------------------+------------------------------------+
| |regex_option| | |regex_values| | |regex_default_value| | |regex_description| |
+----------------------------+---------------------------+-----------------------+------------------------------------+
This is an example of how to configure these options.
@ -153,8 +118,7 @@ This is an example of how to configure these options.
suffix_exceptions:
- '_G'
case_exceptions:
- 'IEEE'
regex: ''
= 'IEEE'
The following code snippet is used in the following examples:
@ -215,16 +179,6 @@ Example: |case_option| set to |upper_value| and |case_exceptions_option| set to
constant C_DATA_WIDTH : positive := 32;
constant addr_WIDTH_c : positive := 8;
Example: |case_option| set to |regex_value| and |regex_option| set to :code:`[A-Z][A-Za-z\d]*`
##############################################################################################
The following constant identifiers would pass with the defined regular expression.
.. code-block:: vhdl
constant SPIAccess : std_logic;
constant ADCRegisters : std_logic;
Example: Changing Multiple Case Rules
#####################################
@ -242,8 +196,6 @@ For example, if you want to uppercase everything except the entity name, you cou
Rules Enforcing Case
####################
* `after_500 <after_rules.html#after-500>`_
* `alias_declaration_500 <alias_declaration_rules.html#alias-declaration-500>`_
* `alias_declaration_501 <alias_declaration_rules.html#alias-declaration-501>`_
* `alias_declaration_502 <alias_declaration_rules.html#alias-declaration-502>`_
@ -258,8 +210,6 @@ Rules Enforcing Case
* `architecture_021 <architecture_rules.html#architecture-021>`_
* `architecture_028 <architecture_rules.html#architecture-028>`_
* `array_constraint_500 <../array_constraint_rules.html#array-constraint-500>`_
* `assert_500 <assert_rules.html#assert-500>`_
* `assert_501 <assert_rules.html#assert-501>`_
* `assert_502 <assert_rules.html#assert-502>`_
@ -275,9 +225,6 @@ Rules Enforcing Case
* `attribute_specification_502 <attribute_specification_rules.html#attribute-specification-502>`_
* `attribute_specification_503 <attribute_specification_rules.html#attribute-specification-503>`_
* `bit_string_literal_500 <bit_string_literal_rules.html#bit-string-literal-500>`_
* `bit_string_literal_501 <bit_string_literal_rules.html#bit-string-literal-501>`_
* `block_500 <block_rules.html#block-500>`_
* `block_501 <block_rules.html#block-501>`_
* `block_502 <block_rules.html#block-502>`_
@ -293,12 +240,11 @@ Rules Enforcing Case
* `case_018 <case_rules.html#case-018>`_
* `case_generate_alternative_500 <case_generate_alternative_rules.html#case-generate-alternative-500>`_
* `case_generate_alternative_501 <case_generate_alternative_rules.html#case-generate-alternative-501>`_
* `case_generate_statement_500 <case_generate_statement_rules.html#case-generate-statement-500>`_
* `case_generate_statement_501 <case_generate_statement_rules.html#case-generate-statement-501>`_
* `choice_500 <choice_rules.html#choice-500>`_
* `component_004 <component_rules.html#component-004>`_
* `component_006 <component_rules.html#component-006>`_
* `component_008 <component_rules.html#component-008>`_
@ -315,9 +261,6 @@ Rules Enforcing Case
* `constant_002 <constant_rules.html#constant-002>`_
* `constant_004 <constant_rules.html#constant-004>`_
* `constrained_array_definition_500 <constrained_array_definition_rules.html#constrained-array-definition-500>`_
* `constrained_array_definition_501 <constrained_array_definition_rules.html#constrained-array-definition-501>`_
* `context_004 <context_rules.html#context-004>`_
* `context_012 <context_rules.html#context-012>`_
* `context_013 <context_rules.html#context-013>`_
@ -329,10 +272,6 @@ Rules Enforcing Case
* `context_ref_500 <context_ref_rules.html#context-ref-500>`_
* `context_ref_501 <context_ref_rules.html#context-ref-501>`_
* `delay_mechanism_500 <delay_mechanism_rules.html#delay-mechanism-500>`_
* `delay_mechanism_501 <delay_mechanism_rules.html#delay-mechanism-501>`_
* `delay_mechanism_502 <delay_mechanism_rules.html#delay-mechanism-502>`_
* `entity_004 <entity_rules.html#entity-004>`_
* `entity_006 <entity_rules.html#entity-006>`_
* `entity_008 <entity_rules.html#entity-008>`_
@ -345,26 +284,9 @@ Rules Enforcing Case
* `entity_specification_501 <entity_specification_rules.html#entity-specification-501>`_
* `entity_specification_503 <entity_specification_rules.html#entity-specification-503>`_
* `exit_statement_500 <exit_statement_rules.html#exit-statement-500>`_
* `exit_statement_501 <exit_statement_rules.html#exit-statement-501>`_
* `exponent_500 <exponent_rules.html#exponent-500>`_
* `external_constant_name_500 <external_constant_name_rules.html#external-constant-name-500>`_
* `external_signal_name_500 <external_signal_name_rules.html#external-signal-name-500>`_
* `external_variable_name_500 <external_variable_name_rules.html#external-variable-name-500>`_
* `file_open_information_500 <file_open_information_rules.html#file-open-information-500>`_
* `file_open_information_501 <file_open_information_rules.html#file-open-information-501>`_
* `file_open_information_502 <file_open_information_rules.html#file-open-information-502>`_
* `file_002 <file_rules.html#file-002>`_
* `file_500 <file_rules.html#file-500>`_
* `file_type_definition_500 <file_type_definition_rules.html#file-type-definition-500>`_
* `file_type_definition_501 <file_type_definition_rules.html#file-type-definition-501>`_
* `for_generate_statement_500 <for_generate_statement_rules.html#for-generate-statement-500>`_
* `for_generate_statement_501 <for_generate_statement_rules.html#for-generate-statement-501>`_
@ -372,15 +294,11 @@ Rules Enforcing Case
* `function_004 <function_rules.html#function-004>`_
* `function_005 <function_rules.html#function-005>`_
* `function_013 <function_rules.html#function-013>`_
* `function_014 <function_rules.html#function-014>`_
* `function_017 <function_rules.html#function-017>`_
* `function_501 <function_rules.html#function-501>`_
* `function_502 <function_rules.html#function-502>`_
* `function_506 <function_rules.html#function-506>`_
* `function_507 <function_rules.html#function-507>`_
* `function_509 <function_rules.html#function-509>`_
* `function_510 <function_rules.html#function-510>`_
* `function_511 <function_rules.html#function-511>`_
* `function_512 <function_rules.html#function-512>`_
* `generate_005 <generate_rules.html#generate-005>`_
* `generate_009 <generate_rules.html#generate-009>`_
@ -391,10 +309,13 @@ Rules Enforcing Case
* `generic_007 <generic_rules.html#generic-007>`_
* `generic_009 <generic_rules.html#generic-009>`_
* `generic_017 <generic_rules.html#generic-017>`_
* `generic_map_001 <generic_map_rules.html#generic-map-001>`_
* `generic_map_002 <generic_map_rules.html#generic-map-002>`_
* `ieee_500 <ieee_rules.html#ieee-500>`_
* `if_generate_statement_500 <if_generate_statement_rules.html#if-generate-statement-500>`_
* `if_generate_statement_501 <if_generate_statement_rules.html#if-generate-statement-501>`_
* `if_generate_statement_502 <if_generate_statement_rules.html#if-generate-statement-502>`_
@ -407,17 +328,11 @@ Rules Enforcing Case
* `if_029 <if_rules.html#if-029>`_
* `if_034 <if_rules.html#if-034>`_
* `index_subtype_definition_500 <index_subtype_definition_rules.html#index-subtype-definition-500>`_
* `instantiation_008 <instantiation_rules.html#instantiation-008>`_
* `instantiation_009 <instantiation_rules.html#instantiation-009>`_
* `instantiation_027 <instantiation_rules.html#instantiation-027>`_
* `instantiation_028 <instantiation_rules.html#instantiation-028>`_
* `instantiation_031 <instantiation_rules.html#instantiation-031>`_
* `instantiation_500 <instantiation_rules.html#instantiation-500>`_
* `interface_incomplete_type_declaration_500 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-500>`_
* `interface_incomplete_type_declaration_501 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-501>`_
* `iteration_scheme_500 <iteration_scheme_rules.html#iteration-scheme-500>`_
* `iteration_scheme_501 <iteration_scheme_rules.html#iteration-scheme-501>`_
@ -434,11 +349,6 @@ Rules Enforcing Case
* `loop_statement_503 <loop_statement_rules.html#loop-statement-503>`_
* `loop_statement_504 <loop_statement_rules.html#loop-statement-504>`_
* `next_statement_500 <next_statement_rules.html#next-statement-500>`_
* `next_statement_501 <next_statement_rules.html#next-statement-501>`_
* `null_statement_500 <null_statement_rules.html#null-statement-500>`_
* `package_004 <package_rules.html#package-004>`_
* `package_006 <package_rules.html#package-006>`_
* `package_008 <package_rules.html#package-008>`_
@ -455,36 +365,26 @@ Rules Enforcing Case
* `package_body_506 <package_body_rules.html#package-body-506>`_
* `package_body_507 <package_body_rules.html#package-body-507>`_
* `package_instantiation_500 <package_instantiation_rules.html#package-instantiation-500>`_
* `package_instantiation_501 <package_instantiation_rules.html#package-instantiation-501>`_
* `package_instantiation_502 <package_instantiation_rules.html#package-instantiation-502>`_
* `package_instantiation_503 <package_instantiation_rules.html#package-instantiation-503>`_
* `package_instantiation_504 <package_instantiation_rules.html#package-instantiation-504>`_
* `parameter_specification_500 <parameter_specification_rules.html#parameter-specification-500>`_
* `parameter_specification_501 <parameter_specification_rules.html#parameter-specification-501>`_
* `port_010 <port_rules.html#port-010>`_
* `port_017 <port_rules.html#port-017>`_
* `port_018 <port_rules.html#port-018>`_
* `port_019 <port_rules.html#port-019>`_
* `port_map_001 <port_map_rules.html#port-map-001>`_
* `port_map_002 <port_map_rules.html#port-map-002>`_
* `procedure_008 <procedure_rules.html#procedure-008>`_
* `procedure_009 <procedure_rules.html#procedure-009>`_
* `procedure_500 <procedure_rules.html#procedure-500>`_
* `procedure_501 <procedure_rules.html#procedure-501>`_
* `procedure_502 <procedure_rules.html#procedure-502>`_
* `procedure_503 <procedure_rules.html#procedure-503>`_
* `procedure_504 <procedure_rules.html#procedure-504>`_
* `procedure_505 <procedure_rules.html#procedure-505>`_
* `procedure_506 <procedure_rules.html#procedure-506>`_
* `procedure_508 <procedure_rules.html#procedure-508>`_
* `procedure_510 <procedure_rules.html#procedure-510>`_
* `procedure_511 <procedure_rules.html#procedure-511>`_
* `procedure_call_500 <procedure_call_rules.html#procedure-call-500>`_
* `procedure_call_501 <procedure_call_rules.html#procedure-call-501>`_
* `procedure_call_502 <procedure_call_rules.html#procedure-call-502>`_
* `process_004 <process_rules.html#process-004>`_
* `process_005 <process_rules.html#process-005>`_
@ -494,18 +394,6 @@ Rules Enforcing Case
* `process_017 <process_rules.html#process-017>`_
* `process_019 <process_rules.html#process-019>`_
* `protected_type_500 <protected_type_rules.html#protected-type-500>`_
* `protected_type_501 <protected_type_rules.html#protected-type-501>`_
* `protected_type_502 <protected_type_rules.html#protected-type-502>`_
* `protected_type_body_500 <protected_type_rules.html#protected-type-body-500>`_
* `protected_type_body_501 <protected_type_rules.html#protected-type-body-501>`_
* `protected_type_body_502 <protected_type_rules.html#protected-type-body-502>`_
* `protected_type_body_503 <protected_type_rules.html#protected-type-body-503>`_
* `protected_type_body_504 <protected_type_rules.html#protected-type-body-504>`_
* `range_constraint_500 <../range_constraint_rules.html#range-constraint-500>`_
* `range_001 <range_rules.html#range-001>`_
* `range_002 <range_rules.html#range-002>`_
@ -523,33 +411,18 @@ Rules Enforcing Case
* `selected_assignment_502 <selected_assignment_rules.html#selected-assignment-502>`_
* `selected_assignment_503 <selected_assignment_rules.html#selected-assignment-503>`_
* `shift_operator_500 <shift_operator_rules.html#shift-operator-500>`_
* `signal_002 <signal_rules.html#signal-002>`_
* `signal_004 <signal_rules.html#signal-004>`_
* `subprogram_instantiation_500 <subprogram_instantiation_rules.html#subprogram-instantiation-500>`_
* `subprogram_instantiation_501 <subprogram_instantiation_rules.html#subprogram-instantiation-501>`_
* `subprogram_instantiation_502 <subprogram_instantiation_rules.html#subprogram-instantiation-502>`_
* `subprogram_instantiation_503 <subprogram_instantiation_rules.html#subprogram-instantiation-503>`_
* `subprogram_kind_500 <subprogram_kind_rules.html#subprogram-kind-500>`_
* `subprogram_kind_501 <subprogram_kind_rules.html#subprogram-kind-501>`_
* `subtype_500 <subtype_rules.html#subtype-500>`_
* `subtype_501 <subtype_rules.html#subtype-501>`_
* `subtype_502 <subtype_rules.html#subtype-502>`_
* `subtype_500 <../subtype_rules.html#subtype-500>`_
* `subtype_501 <../subtype_rules.html#subtype-501>`_
* `subtype_502 <../subtype_rules.html#subtype-502>`_
* `type_002 <type_rules.html#type-002>`_
* `type_004 <type_rules.html#type-004>`_
* `type_013 <type_rules.html#type-013>`_
* `type_500 <type_rules.html#type-500>`_
* `type_mark_500 <type_mark_rules.html#type-mark-500>`_
* `unbounded_array_definition_500 <unbounded_array_definition_rules.html#unbounded-array-definition-500>`_
* `unbounded_array_definition_501 <unbounded_array_definition_rules.html#unbounded-array-definition-501>`_
* `use_clause_500 <use_clause_rules.html#use-clause-500>`_
* `use_clause_501 <use_clause_rules.html#use-clause-501>`_
* `use_clause_502 <use_clause_rules.html#use-clause-502>`_
@ -557,9 +430,3 @@ Rules Enforcing Case
* `variable_002 <variable_rules.html#variable-002>`_
* `variable_004 <variable_rules.html#variable-004>`_
* `variable_500 <variable_rules.html#variable-500>`_
* `wait_500 <wait_rules.html#wait-500>`_
* `wait_501 <wait_rules.html#wait-501>`_
* `wait_502 <wait_rules.html#wait-502>`_
* `wait_503 <wait_rules.html#wait-503>`_

View File

@ -52,10 +52,9 @@ This is an example of how to configure these options.
indent:
tokens:
use_clause:
keyword:
token_after_library_clause: '+1'
token_if_no_matching_library_clause: '+1'
use_clause:
token_after_library_clause: '+1'
token_if_no_matching_library_clause: '+1'
The following code snippet is used for all examples.
@ -66,6 +65,7 @@ The following code snippet is used for all examples.
use work.my_package.all;
Example: |token_if_no_matching_library_clause| set to |current_value|
#####################################################################
@ -110,7 +110,7 @@ Example: |token_after_library_clause| set to :code:`'+1'`
use work.my_package.all;
Rules Enforcing Use Clause Indenting
####################################
Rules Enforcing Keyword Alignment
#################################
* `library_008 <library_rules.html#library-008>`_

View File

@ -1,79 +0,0 @@
.. _configuring-user-error-messages:
Configuring User Error Messages
-------------------------------
There is an option to provide additional information to the user when a violation is found.
This is accomplished by using the :code:`user_error_message` option.
Setting this option for a rule will append the message to the normal output.
Example without :code:`user_error_message` defined
##################################################
Applying a custom regex does not provide additional information to the user.
Given the following configuration file which defines a custom regex:
.. code-block:: yaml
rule:
group:
case::name:
case: regex
regex: (?![a-z||0-9]\u005F)(?!.*\u005F[a-z||0-9]$)([a-z||0-9]+(?:\u005F[a-z||0-9]+)*)
The following error report is generated:
.. code-block:: bash
$vsg -f original.vhd -c config.yaml
================================================================================
File: original.vhd
================================================================================
Phase 6 of 7... Reporting
Total Rules Checked: 857
Total Violations: 2
Error : 2
Warning : 0
-------------+------------+------------+--------------------------------------
Rule | severity | line(s) | Solution
-------------+------------+------------+--------------------------------------
entity_008 | Error | 2 | Format FIFO to match defined regex
entity_012 | Error | 3 | Format FIFO to match defined regex
-------------+------------+------------+--------------------------------------
NOTE: Refer to online documentation at https://vhdl-style-guide.readthedocs.io/en/latest/index.html for more information.
Example with :code:`user_error_message` defined
###############################################
Adding a custom error message can provide additional information to the user:
.. code-block:: yaml
rule:
group:
case::name:
case: regex
regex: (?![a-z||0-9]\u005F)(?!.*\u005F[a-z||0-9]$)([a-z||0-9]+(?:\u005F[a-z||0-9]+)*)
user_error_message: "UPPERCASE and single letter prefix/suffix not allowed"
The following error report is generated:
.. code-block:: bash
$vsg -f original.vhd -c config.yaml
================================================================================
File: original.vhd
================================================================================
Phase 6 of 7... Reporting
Total Rules Checked: 857
Total Violations: 2
Error : 2
Warning : 0
-------------+------------+------------+--------------------------------------
Rule | severity | line(s) | Solution
-------------+------------+------------+--------------------------------------
entity_008 | Error | 2 | Format FIFO to match defined regex [user_error_message: UPPERCASE and single letter prefix/suffix not allowed]
entity_012 | Error | 3 | Format FIFO to match defined regex [user_error_message: UPPERCASE and single letter prefix/suffix not allowed]
-------------+------------+------------+--------------------------------------
NOTE: Refer to online documentation at https://vhdl-style-guide.readthedocs.io/en/latest/index.html for more information.

View File

@ -28,14 +28,11 @@ These rules provide the following options:
.. |standard__2008| replace::
:code:`2008` = Use reserved keywords from 2008 standard
.. |standard__2019| replace::
:code:`2019` = Use reserved keywords from 2019 standard
.. |standard__all| replace::
:code:`all` = Use reserved keywords from all standards
.. |values| replace::
:code:`1987`, :code:`1993`, :code:`2000`, :code:`2002`, :code:`2008`, :code:`2019`
:code:`1987`, :code:`1993`, :code:`2000`, :code:`2002`, :code:`2008`
.. |default_value| replace::
:code:`all`
@ -48,7 +45,6 @@ These rules provide the following options:
| | | | * |standard__2000| |
| | | | * |standard__2002| |
| | | | * |standard__2008| |
| | | | * |standard__2019| |
| | | | * |standard__all| |
+----------------------+----------+-----------------+----------------------------+
@ -100,20 +96,8 @@ The :code:`context` keyword is a reserved word in the 2008 standard.
end entity;
Example: |standard_option| set to :code:`2019`
##############################################
The :code:`private` keyword is a reserved word in the 2019 standard.
**Violation**
.. code-block:: yaml
entity private is
end entity;
Rules Enforcing Optional Items
##############################
* `reserved_001 <reserved_rules.html#reserved-001>`_

View File

@ -33,7 +33,7 @@ This behavior can be modified by using the :code:`exceptions` and :code:`pattern
+==========================+=======================+==========================+
| |exceptions_option| | |exceptions_defaults| | |exceptions_description| |
+--------------------------+-----------------------+--------------------------+
| |patterns_option| | |patterns_defaults| | |patterns_description| |
| |patterns_option| | |patterns_defaults| | |patterns_description| |
+--------------------------+-----------------------+--------------------------+
This is an example of how to configure these options.

View File

@ -14,6 +14,9 @@ There are a couple of options to these rules:
| number_of_spaces | Determines the number of whitespace characters to allow. |
+--------------------------+----------------------------------------------------------+
.. | align_to_next_tab | When true, will add spaces to align with next valid tab. |
.. +--------------------------+----------------------------------------------------------+
The :code:`number_of_spaces` option can accept several values:
+-----------------------+----------------------------------------------------------+
@ -27,10 +30,6 @@ The :code:`number_of_spaces` option can accept several values:
+-----------------------+----------------------------------------------------------+
| [0-9][0-9]*+ | The minimum number of spaces to enforce. |
+-----------------------+----------------------------------------------------------+
| <[0-9][0-9]* | The maximum number of spaces to enforce. |
+-----------------------+----------------------------------------------------------+
| <=[0-9][0-9]* | The maximum number of spaces to enforce. |
+-----------------------+----------------------------------------------------------+
These options combined with the values allow complete control over the number of whitespaces allowed.
@ -91,24 +90,6 @@ The same result could be achieved using this yaml:
signal_006:
number_of_spaces: '1+'
Example: allow at most 4 spaces before colon
#############################################
.. code-block:: yaml
rule :
signal_006:
number_of_spaces: '<=4'
In this example, there must be at most four whitespaces before the colon.
The third signal declaration would be a violation.
.. code-Block:: vhdl
signal wr_en : std_logic;
signal wr_en : std_logic;
signal wr_en : std_logic;
Rules Enforcing Whitespace
##########################
@ -122,7 +103,6 @@ Rules Enforcing Whitespace
* `architecture_031 <architecture_rules.html#architecture-031>`_
* `architecture_032 <architecture_rules.html#architecture-032>`_
* `architecture_033 <architecture_rules.html#architecture-033>`_
* `array_constraint_100 <array_constraint_rules.html#array-constraint-100>`_
* `assert_100 <assert_rules.html#assert-100>`_
* `assert_101 <assert_rules.html#assert-101>`_
* `assert_102 <assert_rules.html#assert-102>`_
@ -137,10 +117,6 @@ Rules Enforcing Whitespace
* `case_004 <case_rules.html#case-004>`_
* `case_005 <case_rules.html#case-005>`_
* `case_006 <case_rules.html#case-006>`_
* `case_generate_alternative_100 <case_generate_alternative_rules.html#case-generate-alternative-100>`_
* `case_generate_alternative_101 <case_generate_alternative_rules.html#case-generate-alternative-101>`_
* `case_generate_statement_100 <case_generate_statement_rules.html#case-generate-statement-100>`_
* `case_generate_statement_101 <case_generate_statement_rules.html#case-generate-statement-101>`_
* `comment_004 <comment_rules.html#comment-004>`_
* `component_002 <component_rules.html#component-002>`_
* `component_007 <component_rules.html#component-007>`_
@ -161,8 +137,6 @@ Rules Enforcing Whitespace
* `constant_010 <constant_rules.html#constant-010>`_
* `constant_100 <constant_rules.html#constant-100>`_
* `constant_101 <constant_rules.html#constant-101>`_
* `constrained_array_definition_100 <constrained_array_definition_rules.html#constrained-array-definition-100>`_
* `constrained_array_definition_101 <constrained_array_definition_rules.html#constrained-array-definition-101>`_
* `context_002 <context_rules.html#context-002>`_
* `context_017 <context_rules.html#context-017>`_
* `context_018 <context_rules.html#context-018>`_
@ -176,27 +150,7 @@ Rules Enforcing Whitespace
* `entity_013 <entity_rules.html#entity-013>`_
* `entity_specification_100 <entity_specification_rules.html#entity-specification-100>`_
* `entity_specification_101 <entity_specification_rules.html#entity-specification-101>`_
* `external_constant_name_100 <external_constant_name_rules.html#external-constant-name-100>`_
* `external_constant_name_101 <external_constant_name_rules.html#external-constant-name-101>`_
* `external_constant_name_102 <external_constant_name_rules.html#external-constant-name-102>`_
* `external_constant_name_103 <external_constant_name_rules.html#external-constant-name-103>`_
* `external_constant_name_104 <external_constant_name_rules.html#external-constant-name-104>`_
* `external_signal_name_100 <external_signal_name_rules.html#external-signal-name-100>`_
* `external_signal_name_101 <external_signal_name_rules.html#external-signal-name-101>`_
* `external_signal_name_102 <external_signal_name_rules.html#external-signal-name-102>`_
* `external_signal_name_103 <external_signal_name_rules.html#external-signal-name-103>`_
* `external_signal_name_104 <external_signal_name_rules.html#external-signal-name-104>`_
* `external_variable_name_100 <external_variable_name_rules.html#external-variable-name-100>`_
* `external_variable_name_101 <external_variable_name_rules.html#external-variable-name-101>`_
* `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>`_
@ -209,15 +163,10 @@ Rules Enforcing Whitespace
* `generic_014 <generic_rules.html#generic-014>`_
* `generic_map_006 <generic_map_rules.html#generic-map-006>`_
* `generic_map_007 <generic_map_rules.html#generic-map-007>`_
* `generic_map_100 <generic_map_rules.html#generic-map-100>`_
* `generic_map_101 <generic_map_rules.html#generic-map-101>`_
* `if_003 <if_rules.html#if-003>`_
* `if_004 <if_rules.html#if-004>`_
* `if_005 <if_rules.html#if-005>`_
* `if_015 <if_rules.html#if-015>`_
* `index_constraint_100 <index_constraint_rules.html#index-constraint-100>`_
* `index_subtype_definition_100 <index_subtype_definition_rules.html#index-subtype-definition-100>`_
* `index_subtype_definition_101 <index_subtype_definition_rules.html#index-subtype-definition-101>`_
* `instantiation_002 <instantiation_rules.html#instantiation-002>`_
* `instantiation_003 <instantiation_rules.html#instantiation-003>`_
* `instantiation_032 <instantiation_rules.html#instantiation-032>`_
@ -234,18 +183,9 @@ Rules Enforcing Whitespace
* `package_009 <package_rules.html#package-009>`_
* `package_body_100 <package_body_rules.html#package-body-100>`_
* `package_body_101 <package_body_rules.html#package-body-101>`_
* `package_instantiation_100 <package_instantiation_rules.html#package-instantiation-100>`_
* `package_instantiation_101 <package_instantiation_rules.html#package-instantiation-101>`_
* `package_instantiation_102 <package_instantiation_rules.html#package-instantiation-102>`_
* `package_instantiation_103 <package_instantiation_rules.html#package-instantiation-103>`_
* `port_003 <port_rules.html#port-003>`_
* `port_020 <port_rules.html#port-020>`_
* `port_100 <port_rules.html#port-100>`_
* `port_101 <port_rules.html#port-101>`_
* `port_map_006 <port_map_rules.html#port-map-006>`_
* `port_map_007 <port_map_rules.html#port-map-007>`_
* `port_map_100 <port_map_rules.html#port-map-100>`_
* `port_map_101 <port_map_rules.html#port-map-101>`_
* `procedure_100 <procedure_rules.html#procedure-100>`_
* `procedure_101 <procedure_rules.html#procedure-101>`_
* `procedure_call_100 <procedure_call_rules.html#procedure-call-100>`_
@ -255,8 +195,6 @@ Rules Enforcing Whitespace
* `process_014 <process_rules.html#process-014>`_
* `process_024 <process_rules.html#process-024>`_
* `process_025 <process_rules.html#process-025>`_
* `range_constraint_100 <range_constraint_rules.html#range-constraint-100>`_
* `range_constraint_101 <range_constraint_rules.html#range-constraint-101>`_
* `record_type_definition_100 <record_type_definition_rules.html#record-type-definition-100>`_
* `record_type_definition_101 <record_type_definition_rules.html#record-type-definition-101>`_
* `report_statement_100 <report_statement_rules.html#report-statement-100>`_
@ -276,28 +214,13 @@ Rules Enforcing Whitespace
* `signal_100 <signal_rules.html#signal-100>`_
* `signal_101 <signal_rules.html#signal-101>`_
* `signal_102 <signal_rules.html#signal-102>`_
* `subprogram_instantiation_100 <subprogram_instantiation_rules.html#subprogram-instantiation-100>`_
* `subprogram_instantiation_101 <subprogram_instantiation_rules.html#subprogram-instantiation-101>`_
* `subprogram_instantiation_102 <subprogram_instantiation_rules.html#subprogram-instantiation-102>`_
* `subprogram_instantiation_103 <subprogram_instantiation_rules.html#subprogram-instantiation-103>`_
* `subprogram_instantiation_104 <subprogram_instantiation_rules.html#subprogram-instantiation-104>`_
* `subtype_100 <subtype_rules.html#subtype-100>`_
* `subtype_101 <subtype_rules.html#subtype-101>`_
* `subtype_102 <subtype_rules.html#subtype-102>`_
* `type_006 <type_rules.html#type-006>`_
* `type_007 <type_rules.html#type-007>`_
* `type_100 <type_rules.html#type-100>`_
* `unbounded_array_definition_100 <unbounded_array_definition_rules.html#unbounded-array-definition-100>`_
* `unbounded_array_definition_101 <unbounded_array_definition_rules.html#unbounded-array-definition-101>`_
* `unbounded_array_definition_102 <unbounded_array_definition_rules.html#unbounded-array-definition-102>`_
* `variable_005 <variable_rules.html#variable-005>`_
* `variable_006 <variable_rules.html#variable-006>`_
* `variable_100 <variable_rules.html#variable-100>`_
* `variable_101 <variable_rules.html#variable-101>`_
* `variable_102 <variable_rules.html#variable-102>`_
* `variable_103 <variable_rules.html#variable-103>`_
* `variable_005 <variable_rules.html#variable-002>`_
* `variable_006 <variable_rules.html#variable-002>`_
* `variable_100 <variable_rules.html#variable-002>`_
* `variable_assignment_002 <variable_assignment_rules.html#variable-assignment-002>`_
* `variable_assignment_003 <variable_assignment_rules.html#variable-assignment-003>`_
* `whitespace_007 <whitespace_rules.html#whitespace-007>`_
* `whitespace_102 <whitespace_rules.html#whitespace-102>`_
* `whitespace_103 <whitespace_rules.html#whitespace-103>`_

View File

@ -17,7 +17,7 @@ This rule checks the indent of a constant declaration.
architecture RTL of FIFO is
constant size : integer := 1;
constant width : integer := 32;
constant width : integer := 32
**Fix**
@ -26,7 +26,7 @@ This rule checks the indent of a constant declaration.
architecture RTL of FIFO is
constant size : integer := 1;
constant width : integer := 32;
constant width : integer := 32
constant_002
############
@ -126,7 +126,7 @@ constant_007
|phase_1| |error| |structure|
This rule checks the **:=** is on the same line as the **constant** keyword.
This rule checks the **:=** is on the same line at the **constant** keyword.
**Violation**
@ -144,7 +144,7 @@ This rule checks the **:=** is on the same line as the **constant** keyword.
constant size : integer :=
1;
constant width : integer :=
32;
32
constant_010
############
@ -173,9 +173,9 @@ Having a space makes it clearer where the assignment occurs on the line.
constant_011
############
The function of this rule has been superseded by the following rules:
The function of this rule has been superceeded by the following rules:
* type_mark_500
* ieee_500
* subtype_002
* type_014
@ -303,10 +303,10 @@ This rule checks the indent of multiline constants that do not contain arrays.
constant_015
############
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid prefixes on constant identifiers.
The default constant prefix is *c_*.
The default constant prefix is *c\_*.
|configuring_prefix_and_suffix_rules_link|
@ -482,10 +482,10 @@ This rule checks the alignment of assignment keywords in constant declarations.
constant_600
############
|phase_7| |disabled| |error| |unfixable| |naming|
|phase_7| |disabled| |error| |naming|
This rule checks for valid suffixes on constant identifiers.
The default constant suffix is *_c*.
The default constant suffix is *\_c*.
|configuring_prefix_and_suffix_rules_link|
@ -500,3 +500,4 @@ The default constant suffix is *_c*.
.. code-block:: vhdl
constant my_const_c : integer;

View File

@ -1,88 +0,0 @@
.. include:: includes.rst
Constrained Array Definition Rules
----------------------------------
constrained_array_definition_100
################################
|phase_2| |error| |whitespace|
This rule checks for a single space before the **of** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;
**Fix**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;
constrained_array_definition_101
################################
|phase_2| |error| |whitespace|
This rule checks for a single space after the **of** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;
**Fix**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;
constrained_array_definition_500
################################
|phase_6| |error| |case| |case_keyword|
This rule checks the **array** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
type t_u_array is ARRAY(1 downto 0) of unsigned;
**Fix**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;
constrained_array_definition_501
################################
|phase_6| |error| |case| |case_keyword|
This rule checks the **of** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
type t_u_array is ARRAY(1 downto 0) of unsigned;
**Fix**
.. code-block:: vhdl
type t_u_array is array(1 downto 0) of unsigned;

View File

@ -241,3 +241,4 @@ This rule checks the context name called out in the selected name has proper cas
.. code-block:: vhdl
context my_lib.interfaces;

View File

@ -196,7 +196,7 @@ context_009
|phase_1| |error| |structure|
This rule checks the **context** keyword is on the same line as the **end** context keyword.
This rule checks the **context** keyword is on the same line as the end context keyword.
**Violation**
@ -217,7 +217,7 @@ context_010
|phase_1| |error| |structure|
This rule checks the context identifier is on the same line as the **end** context keyword.
This rule checks the context identifier is on the same line as the end context keyword.
**Violation**
@ -335,7 +335,7 @@ context_015
|phase_6| |error| |case| |case_keyword|
This rule checks the **context** keyword has proper case in the end context declaration.
This rule checks the context keyword has proper case in the end context declaration.
|configuring_uppercase_and_lowercase_rules_link|
@ -620,3 +620,4 @@ This rule checks for alignment of inline comments in the context declaration.
library ieee; -- Other comment
use ieee.std_logic_1164.all; -- Comment 3
end context c1; -- Comment 4

View File

@ -17,7 +17,7 @@ JUnit Report
VSG can generate a report of an analysis in JUnit XML format.
This report will include the filename along with any errors detected.
The rule which was violated, the line number where the violation occurred, and the proposed solution are provided.
The rule which was violated, the line number where the violation occured, and the proposed solution are provided.
This report can be used in most CI server applications to create a test report.
Refer to the documentation of your CI server application for how to integrate the JUnit report.
@ -62,7 +62,7 @@ The following items in the spec are populated.
A relative path to the file with code quality issues.
.. |location_lines_begin| replace::
The line number where the code quality issue occurred.
The line number where the code quality issue occured.
+----------------------+------------------------+
| Code Climate Spec | Description |
@ -91,7 +91,7 @@ An example of a code quality report is shown below:
"fingerprint": "323039ccd1801791163d7a302cfd5b25",
"severity": "critical",
"location": {
"path": "tests/tool_integration/quality_report/example.vhd",
"path": "vsg/tests/tool_integration/quality_report/example.vhd",
"lines": {
"begin": 8
}

View File

@ -57,6 +57,8 @@ VSG was developed using a Test Driven Development (TDD) process.
There are over 1000 tests which cover individual rules and other features of VSG.
For each pull request, an accompanying test to validate the pull request would be appreciated.
Refer to `Setting up a Development Environment <setting_up_a_development_environment.html#running-unit-tests>`_ for more information on how to get started.
Quality Control
###############
@ -67,3 +69,4 @@ This project uses the following open source tools to help with code quality:
* *Codcov* to check the code coverage of the tests.
The results will be available on the pull request GitHub page.

View File

@ -1,67 +0,0 @@
.. include:: includes.rst
Delay Mechanism Rules
---------------------
delay_mechanism_500
###################
|phase_6| |error| |case| |case_keyword|
This rule checks the **transport** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
a <= TRANSPORT 1 after 10 ns;
**Fix**
.. code-block:: vhdl
a <= transport 1 after 10 ns;
delay_mechanism_501
###################
|phase_6| |error| |case| |case_keyword|
This rule checks the **inertial** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
a <= INERTIAL 1 after 10 ns;
**Fix**
.. code-block:: vhdl
a <= inertial 1 after 10 ns;
delay_mechanism_502
###################
|phase_6| |error| |case| |case_keyword|
This rule checks the **reject** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
a <= REJECT 2ns inertial 1 after 10 ns;
**Fix**
.. code-block:: vhdl
a <= reject 2ns inertial 1 after 10 ns;

View File

@ -1,316 +0,0 @@
Adding a rule
-------------
Following the steps in the given order ensures everything is covered.
#. Create documentation
#. Create test
#. Create rule
.. NOTE:: If a similar rule already exists, copy that rules elements for each of the following steps.
Create Documentation
====================
A documentation first approach clarifies what a rule will address.
The documentation is located in the `docs` directory.
All rules for a rule group are kept in a file with the following pattern: :code:`<rule_group>_rules.rst`.
The rules are in alphabetical order within the documentation.
Rule documentation contains the following items:
#. Rule ID
#. Icons
#. Summary
#. Link to configuration options
#. Violation example
#. Fixed example
.. code-block:: rst
architecture_001
################
|phase_4| |error| |indent|
This rule checks for blank spaces before the **architecture** keyword.
**Violation**
.. code-block:: vhdl
architecture rtl of fifo is
begin
**Fix**
.. code-block:: vhdl
architecture rtl of fifo is
begin
The Rule ID identifies the rule and is unique through all versions of VSG.
A Rule ID will never be re-used.
Icons provide information about the rule at a quick glance.
These icons indicate the phase in which the rule is ran, whether it is disabled by default, etc...
Links to the icons are stored in a file named :code:`icons.rst` and is included into each file using an include at the top of every file.
The summary is a very brief description of what issue the rule is attempting to resolve.
If the rule has configuration options, a link to the configuration information will be given.
The links are stored in a file named :code:`links.rst` and in included into each file using an include at the top of every file.
The Violation Example provides a visual indicating what the issue is.
The Fixed example provides a visual indicating what the end state should be.
Create Test
===========
The next step is to create a test for the new rule.
Test directory structure
^^^^^^^^^^^^^^^^^^^^^^^^
The directory structure of the tests closely matches the rules directory.
Every rule group has its own directory.
.. code-block:: text
tests
├── after
├── alias_declaration
├── architecture
...
└── whitespace
Each rule will typically consist of at least three files:
#. test file of the form :code:`test_rule_[0-9][0-9][0-9].py`
#. input vhdl file with violations in the form of :code:`rule_[0-9][0-9][0-9]_test_input.vhd`
#. fixed vhdl file without violations in the form of :code:`rule_[0-9][0-9][0-9]_test_input.fixed.vhd`
.. code-block:: text
tests
└── architecture
   ├── rule_001_test_input.fixed.vhd
   ├── rule_001_test_input.vhd
└── test_rule_001.py
Test File Structure
^^^^^^^^^^^^^^^^^^^
The test file contains a class with the name of :code:`test_rule`.
The minimum number of tests will be one for those rules for which a fix is not available.
For rules in which a fix is available, a minimum of two tests will be required: one for detecting violations and another for verifying the violations can be fixed.
If the rule has configurable options, then additional tests are required based on the number of configurable items.
.. code-block:: python
class test_rule(unittest.TestCase):
def test_rule_001(self):
oRule = architecture.rule_001()
def test_fix_rule_001(self):
oRule = architecture.rule_001()
The :code:`test_rule_001` method operates on the test input file and returns a list of lines where a violation was detected.
The line numbers are then validated.
The :code:`test_fix_rule_001` method operations on the test input file and attempts to fix the violations.
The resulting fix is compared against the :code:`rule_001_test_input.fixed.vhd` file.
Any discrepancies are flagged.
Test Input File
^^^^^^^^^^^^^^^
The test input file provides examples of code passing and violating the particular rule.
It provides the conditions where the rule is checked.
Depending on the rule, this file can range from very simple to quite complex.
If configuration options are available for the rule, then this file should provide conditions for each configurable item.
.. code-block:: vhdl
architecture RTL of FIFO is begin end architecture RTL;
-- This should fail
architecture RTL of FIFO is
begin
end architecture RTL;
Fixed Input File
^^^^^^^^^^^^^^^^
This file provides the output product of running the rule in isolation.
Additional rules are not applied.
If configuration options are available for the rule, then additional files are required for each configuration.
.. code-block:: vhdl
architecture RTL of FIFO is begin end architecture RTL;
-- This should fail
architecture RTL of FIFO is
begin
end architecture RTL;
Run failing test
^^^^^^^^^^^^^^^^
VSG uses pytest and individual tests can be executed:
.. code-block:: text
$ pytest tests/architecture/test_rule_001.py
======================================== test session starts =========================================
platform linux -- Python 3.10.13, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/jcleary/projects/vsg-master
configfile: pyproject.toml
plugins: html-4.1.1, html-reporter-0.2.9, metadata-3.1.1
collected 2 items
tests/architecture/test_rule_001.py FF [100%]
============================================== FAILURES ==============================================
______________________________ test_architecture_rule.test_fix_rule_001 ______________________________
self = <tests.architecture.test_rule_001.test_architecture_rule testMethod=test_fix_rule_001>
def test_fix_rule_001(self):
> oRule = architecture.rule_001()
E AttributeError: module 'vsg.rules.architecture' has no attribute 'rule_001'. Did you mean: 'rule_002'?
tests/architecture/test_rule_001.py:39: AttributeError
________________________________ test_architecture_rule.test_rule_001 ________________________________
self = <tests.architecture.test_rule_001.test_architecture_rule testMethod=test_rule_001>
def test_rule_001(self):
> oRule = architecture.rule_001()
E AttributeError: module 'vsg.rules.architecture' has no attribute 'rule_001'. Did you mean: 'rule_002'?
tests/architecture/test_rule_001.py:28: AttributeError
====================================== short test summary info =======================================
FAILED tests/architecture/test_rule_001.py::test_architecture_rule::test_fix_rule_001 - AttributeError: module 'vsg.rules.architecture' has no attribute 'rule_001'. Did you mean: 'rule_...
FAILED tests/architecture/test_rule_001.py::test_architecture_rule::test_rule_001 - AttributeError: module 'vsg.rules.architecture' has no attribute 'rule_001'. Did you mean: 'rule_...
========================================= 2 failed in 0.43s ==========================================
The test failed because the rule does not yet exist.
Create Rule
===========
Updating __init__.py file
^^^^^^^^^^^^^^^^^^^^^^^^^
In order for a rule to be used, it must be added to the :code:`__init__.py` file in the rule group directory.
.. code-block:: python
# -*- coding: utf-8 -*-
from .rule_001 import rule_001
from .rule_002 import rule_002
Rule file structure
^^^^^^^^^^^^^^^^^^^
#. class name
#. docstring
#. rule implementation
The class name of the rule must follow this pattern: :code:`rule_[0-9][0-9][0-9]`.
The docstring must match the documentation but does not include the header or the icons.
The rule implementation could be unique or it could call a base rule.
.. code-block:: python
# -*- coding: utf-8 -*-
from vsg.rules import token_indent
from vsg.token import architecture_body as token
class rule_001(token_indent):
"""
This rule checks for blank spaces before the **architecture** keyword.
**Violation**
.. code-block:: vhdl
architecture rtl of fifo is
begin
**Fix**
.. code-block:: vhdl
architecture rtl of fifo is
begin
"""
def __init__(self):
super().__init__([token.architecture_keyword])
In this case the :code:`token_indent` base rule is used to check the indent of the architecture keyword.
Run passing test
^^^^^^^^^^^^^^^^
Re-run the test and make any changes until the test passes.
.. code-block:: text
======================================== test session starts =========================================
platform linux -- Python 3.10.13, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/jcleary/projects/vsg-master
configfile: pyproject.toml
plugins: html-4.1.1, html-reporter-0.2.9, metadata-3.1.1
collected 2 items
tests/architecture/test_rule_001.py .. [100%]
========================================= 2 passed in 0.34s ==========================================
Run regression tests
^^^^^^^^^^^^^^^^^^^^
Now that the single test runs, the entire suite of tests must be ran to ensure there no side effects.
.. code-block:: text
$ tox -e test-py38
======================================== test session starts =========================================
platform linux -- Python 3.8.10, pytest-8.1.1, pluggy-1.4.0
cachedir: .tox/test-py38/.pytest_cache
rootdir: /home/jcleary/projects/vsg-master
configfile: pyproject.toml
plugins: cov-5.0.0, html-4.1.1, xdist-3.5.0, html-reporter-0.2.9, metadata-3.1.1
8 workers [3005 items]
.............................................................................................. [ 3%]
.............................................................................................. [ 6%]
.............................................................................................. [ 97%]
....................................................................................... [100%]
---------- coverage: platform linux, python 3.8.10-final-0 -----------
Coverage HTML written to dir build.out/test-py38/coverage
Coverage XML written to file build.out/test-py38/coverage.xml
- Generated html report: file:///home/jcleary/projects/vsg-master/build.out/test-py38/test/pytest.html -
================================== 3005 passed in 72.67s (0:01:12) ===================================
test-py38: OK (81.82=setup[8.52]+cmd[73.30] seconds)
congratulations :) (81.87 seconds)

View File

@ -1,38 +0,0 @@
Development Environment
-----------------------
Follow these steps to setup the development environment.
Clone the repo
##############
Clone the repo with the following command:
.. code-block:: bash
$ git clone https://github.com/jeremiah-c-leary/vhdl-style-guide.git
Setup alias
###########
Set an alias to VSG as follows:
.. code-block:: bash
$ set alias vsg='python3 <path_to_clone_directory>/bin/vsg'
This allows you to execute VSG without installing it.
Install prerequisites
#####################
.. code-block:: bash
$ pip install PyYAML
$ pip install tox
Build locally, artifacts will appear in ``dist`` directory.
.. code-block:: bash
tox

View File

@ -1,70 +0,0 @@
Helpful Tools
-------------
vsg_parser
==========
:code:`vsg_parser` is a tool which will show the mapping of tokens to a given file.
It is located in the bin directory and can be invoked with:
.. code-block:: bash
$ bin/vsg_parser -f <filename>
This is the output when ran against the :code:`tests/architecture/rule_001_test_input.vhd` file:
.. code-block:: text
--------------------------------------------------------------------------------
0 |
--------------------------------------------------------------------------------
1 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
2 | architecture RTL of FIFO is begin end architecture RTL;
<class 'vsg.token.architecture_body.architecture_keyword'>
<class 'vsg.token.architecture_body.identifier'>
<class 'vsg.token.architecture_body.of_keyword'>
<class 'vsg.token.architecture_body.entity_name'>
<class 'vsg.token.architecture_body.is_keyword'>
<class 'vsg.token.architecture_body.begin_keyword'>
<class 'vsg.token.architecture_body.end_keyword'>
<class 'vsg.token.architecture_body.end_architecture_keyword'>
<class 'vsg.token.architecture_body.architecture_simple_name'>
<class 'vsg.token.architecture_body.semicolon'>
--------------------------------------------------------------------------------
3 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
4 | -- This should fail
<class 'vsg.parser.comment'>
--------------------------------------------------------------------------------
5 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
6 | architecture RTL of FIFO is
<class 'vsg.token.architecture_body.architecture_keyword'>
<class 'vsg.token.architecture_body.identifier'>
<class 'vsg.token.architecture_body.of_keyword'>
<class 'vsg.token.architecture_body.entity_name'>
<class 'vsg.token.architecture_body.is_keyword'>
--------------------------------------------------------------------------------
7 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
8 | begin
<class 'vsg.token.architecture_body.begin_keyword'>
--------------------------------------------------------------------------------
9 |
<class 'vsg.parser.blank_line'>
--------------------------------------------------------------------------------
10 | end architecture RTL;
<class 'vsg.token.architecture_body.end_keyword'>
<class 'vsg.token.architecture_body.end_architecture_keyword'>
<class 'vsg.token.architecture_body.architecture_simple_name'>
<class 'vsg.token.architecture_body.semicolon'>
Each line is printed and then each token is listed in the order they appear on the line.
Whitespace tokens can be shown using the :code:`-w` option.
:code:`vsg_parser` can be useful in rule generation to determine how vsg is assigning token types.

View File

@ -1,12 +0,0 @@
Developing
==========
Before developing for VSG, familiarize yourself with the **Theory of Operation** and **Processes** sections of the documentation.
.. toctree::
:maxdepth: 2
development_environment
helpful_tools
adding_a_rule
prepare_for_pull_request

View File

@ -1,13 +0,0 @@
Prepare for pull request
------------------------
Before creating a pull request use tox to perform all checks against the code base:
.. code-block:: bash
$ tox
This will run code style checks, unittests against multiple versions of python and attempt to perform a build.
When this passes create a pull request.
.. NOTE:: `Issue 1157 <https://github.com/jeremiah-c-leary/vhdl-style-guide/issues/1157>`_ is still being resolved and should not gate any PR creation.

View File

@ -23,7 +23,7 @@ Linting/Diagnostics with ALE
A custom linter can be defined for 'ALE <https://github.com/dense-analysis/ale>'_ if you use this. You can place the following contents into a file somewhere in your runtime path under `ale_linters/vhdl/`, this will generate a Linter that can give you diagnostics in Vim
.. code-block:: vim
.. code-block:: viml
function! ale_linters#vhdl#vsg_ale#GetCommand(buffer)
return "vsg --config ./vsg_config.yaml -of syntastic -f " . expand('%p')
@ -104,7 +104,7 @@ This works by taking the current buffer's contents and passing it into the stand
groups = { 'severity', 'row', 'code', 'message' },
overrides = {
severities = {
-- 2 is for warnings, nvim showing as an error can be obnoxious. Change if desired
-- 2 is for warnings, nvim showing as an erorr can be obnoxious. Change if desired
["ERROR"] = 2,
["WARNING"] = 3,
["INFORMATION"] = 3,

View File

@ -27,7 +27,7 @@ This will create a template **task.json** file:
Replace the contents of the template file with the following...
.. code-block:: text
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
@ -175,3 +175,4 @@ The violations are shown in the Problems tab:
The violations can be fixed manually, or by using `ctrl+f`...
.. image:: vscode_file_fixed.png

View File

@ -44,3 +44,4 @@ This rule checks for a single space after the => in an element_association.
.. code-block:: vhdl
a <= (others => (others => '0'));

View File

@ -52,7 +52,7 @@ entity_003
|phase_3| |error| |blank_line|
This rule checks for blank lines or comments above the **entity** keyword.
This rule checks for blank lines or comments above the entity keyword.
|configuring_previous_line_rules_link|
@ -903,3 +903,4 @@ This rule checks for consistent capitalization of generic names in entity declar
O_DATA : std_logic_vector(G_WIDTH - 1 downto 0)
);
end entity fifo;

View File

@ -118,3 +118,4 @@ This rule checks the *entity_class* has proper case.
.. code-block:: vhdl
attribute coordinate of comp_1 : component is (0.0, 17.5);

View File

@ -1,13 +1,13 @@
{
"rule": {
"global": {
"phase": 1
"rule":{
"global":{
"phase":1
},
"architecture_010": {
"disable": "True"
"architecture_010":{
"disable":"True"
},
"port_011": {
"port_direction": "Suffix"
"port_011":{
"port_direction":"Suffix"
}
}
}

View File

@ -26,67 +26,3 @@ This rule checks the indent of the **exit** keyword.
exit;
exit_statement_301
##################
|phase_4| |error| |indent|
This rule checks the indent of the label.
**Violation**
.. code-block:: vhdl
end if;
exit_label : exit;
**Fix**
.. code-block:: vhdl
end if;
exit_label : exit;
exit_statement_500
##################
|phase_6| |error| |case| |case_keyword|
This rule checks the **exit** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
EXIT when condition;
**Fix**
.. code-block:: vhdl
exit when condition;
exit_statement_501
##################
|phase_6| |error| |case| |case_keyword|
This rule checks the **when** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
exit WHEN condition;
**Fix**
.. code-block:: vhdl
exit when condition;

View File

@ -8,7 +8,7 @@ exponent_500
|phase_6| |error| |case| |case_keyword|
This rule checks the **e** keyword has proper case.
This rule checks the e keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
@ -25,3 +25,4 @@ This rule checks the **e** keyword has proper case.
12.5e-90
6e57

Some files were not shown because too many files have changed in this diff Show More