MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
592 stars 132 forks source link

moduleInstantiationPrefix check cannot be controlled with config file #873

Closed abradd closed 8 months ago

abradd commented 8 months ago

Describe the bug When using slang-tidy and disabling the moduleInstantiationPrefix check. I get a warning: The check: moduleInstantiationPrefix does not exist

I tested on cd2a5e50a345ed9a6ed030a107cd96b956a7cbb9.

To Reproduce

.slang-tidy file looks like:

CheckConfigs:
    clkName: clock,
    inputPortSuffix: ,
    outputPortSuffix: ,
    moduleInstantiationPrefix:  ,
    resetIsActiveHigh: true

Running slang-tidy on the following test will generate the warning and ignore the setting in the config file:

module test ();

    module for_inst ();
    endmodule 

    for_inst inst_1();

endmodule 
Warning while parsing slang-tidy config .slang-tidy 4:27
        The check: moduleInstantiationPrefix does not exist

...

[EnforceModuleInstantiationPrefix] FAIL
test.sv:6:14: warning: port 'inst_1' is not correctly suffixed with suffix: i_
    for_inst inst_1();
             ^

I removed all the irrelevant rules from the output above.

As far as I can tell, this is due to a missing conditional branch in TidyConfig.h:

else if (configName == "moduleInstantiationPrefix") {
    visit(checkConfigs.moduleInstantiationPrefix);
    return;
}

I also couldn't find any tests for moduleInstantiationPrefix in TidyConfigParserTest.cpp.

MikePopoloski commented 8 months ago

Fixed in a060f15cdc6b04f5a84ba83cdeedacc8a9123b4b