jeremiah-c-leary / vhdl-style-guide

Style guide enforcement for VHDL
GNU General Public License v3.0
189 stars 38 forks source link

Report warnings as errors + How to update configuration YAML for newer versions #1247

Open obruendl opened 1 week ago

obruendl commented 1 week ago

Hi Jeremiah,

I am using VSG to lint my open-source FPGA standard library Open Logic.

I have two questions:

  1. Is there a way to report warnings as errors? For development I tend to accept some warnings until my code works but in CI I would like the pipeline to fail if there are any warnings left.
  2. I have a YAML configuration file that works for vsg 3.27. However, if I upgrade to a newer version (3.3.0 or higher) it fails with various errors for the indentation configuration. Can you provide some guidance how I can update the YAML to work with newer configurations? I couldn't find an exact documentation what changed in the configuration files - and for maintenance reasons of course it is difficult to always sort out and apply many manual changes if vsg is upgraded to a newer version (in this case even a minor version increment).
jeremiah-c-leary commented 1 week ago

Evening @obruendl ,

I am using VSG to lint my open-source FPGA standard library Open Logic.

Nice project, btw.

Is there a way to report warnings as errors? For development I tend to accept some warnings until my code works but in CI I would like the pipeline to fail if there are any warnings left.

You could use a global configuration for your CI pipeline:

rule:
  global:
     severity: "Error"

That would force all rules to report an error. If you named that configuration as vsg-ci.yaml then you would call it last in the configuration list when you call VSG:

$ vsg -c config1.yaml vsg-ci.yaml

I have a YAML configuration file that works for vsg 3.27. However, if I upgrade to a newer version (3.3.0 or higher) it fails with various errors for the indentation configuration.

I am little confused on the 3.27 versus 3.3.0 since 3.27 is greater than 3.3.0. Could you please clarify.

Also, could you elaborate on the errors with the indentation configuration?

Thanks,

--Jeremy

obruendl commented 1 week ago

Thank you for the treat warning as errors case.

Regarding the versions: Silly me - I was confused becasue readthedocs seems to order version numbers as if 3.26 was 3.2.6 and the version number showing up last is 3.9.0.

image

Sorry for the silly question. Resolved.

obruendl commented 1 week ago

@jeremiah-c-leary

I tried the "error as warnings" as you suggested with a second configuration file but this fails.

I created a second YAML file with the global severity "Error" rule as you suggested (vsg_warnings_as_errors.yml). However, if I pass both configs - first my main config and then the warnings-as-errors one - VSG seems to not recognize the rules from my main config file anymore.

You can easily reproduce this by the following steps:

  1. Checkout open-logic (https://github.com/open-logic/open-logic)
  2. Navigate to the root folder of the repo
  3. Switch to the branch feature/linting-warnings
    • This contains a file I modified to produce a warning (olo_base_cc_handshake_tb.vhd`)
  4. Run linting with main config only: vsg -c ./lint/config/vsg_config.yml -f ./test/base/olo_base_cc_handshake/olo_base_cc_handshake_tb.vhd
    • This produces exactly one warning for an alignment problem
  5. Run linting with the warnings-as-errors config added: vsg -c ./lint/config/vsg_config.yml ./lint/config/vsg_warnings_as_errors.yml -f ./test/base/olo_base_cc_handshake/olo_base_cc_handshake_tb.vhd
    • I would expect the exact same alignment problem to show up - just as error now.
    • I get many errors because it looks my main config file is not consiered (or only partially)