jeremiah-c-leary / vhdl-style-guide

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

Add keyword exception for prefix and suffix rule #1070

Closed javValverde closed 9 months ago

javValverde commented 9 months ago

Is your feature request related to a problem? Please describe. In our naming conventions we enforce generics to start with g_. We have however tons of VUnit testbenches, which at least contains the generic RUNNER_CFG.

Describe the solution you'd like I'm unsure as to what the best approach is. One possibility is to add something like exceptions : [RUNNER_CFG] to rule generic_007. This kind of exceptions could apply to more rules, so there might be better ideas

Describe alternatives you've considered I could add vsg_off/vsg_on to all my testbenches, but I find it too invasive

jeremiah-c-leary commented 9 months ago

Afternoon @javValverde ,

It sounds like you would want to enforce the prefix except when generics are a specific value.

  generic (
      g_WIDTH : natural := 32;
      g_DEPTH : natural := 256;
      RUNNER_CFG : ??
  )

I added an exceptions option to allow for this behavior:

{
  "rule": {
    "generic_020": {
      "disable": false,
      "prefixes": [
        "g_"
      ],
      "exceptions": [
        "runner_cfg"
     ]
    }
  }
}

The exceptions are case insensitive. You can use rule generic_007 to enforce the case of the generic.

I pushed an update to the issue-1070 branch. When you get a chance could you check it out on your end and let me know if it works for you?

Thanks,

--Jeremy

javValverde commented 9 months ago

I tested it, and it is exactly what I needed. thanks @jeremiah-c-leary

jeremiah-c-leary commented 9 months ago

Morning @javValverde ,

Awesome...I will push this to master.

--Jeremy