You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently any rule file used in an NsiqCppStyle session (e.g., RULE_3_1_A_do_not_start_filename_with_underbar) must reside in the nsiqcppstyle\rules package folder. You can see this in nsiqcppstyle_runmanager.py:
def LoadRules(self, checkingRuleNames):
...
for ruleName in checkingRuleNames:
ruleModule = __import__("rules." + ruleName)
self.loadedRule.append(ruleModule)
...
I have written many proprietary rules that I do not want to return to the NsiqCppStyle repository. To include them in my NsiqCppStyle checking runs, I must copy my rules to the rules folder. Should I upgrade NsiqCppStyle to a newer version I may need to copy all of my proprietary rules again. Should I push changes through a GitHub pull request, I have to be careful not to add my proprietary rules to the commit. In general, I want to keep my proprietary rules totally separate from the NsiqCppStyle package.
Proposed Solution
The proposal is to support a new command-line option for specifying one or more additional paths that should be searched for rules. These paths can be anywhere in the file system. For all rule names in the filefilter.txt file, NsiqCppStyle should search first the rules folder, followed by any additional folders. If found, the engine should import the rule file. The following Stack Overflow post provides Python code that can be used to import the rule file from anywhere. Here is a test script I wrote:
+1 for this. It could allow total separation of rule and engine. Then we could have groups of rules as well instead of putting _A, _B etc. on the rules
mosherubin
changed the title
Support running user rule files outside of the NsiqCppStyle package
Support running user rule files located outside of the NsiqCppStyle package
Jul 12, 2022
Problem Description
Currently any rule file used in an NsiqCppStyle session (e.g.,
RULE_3_1_A_do_not_start_filename_with_underbar
) must reside in thensiqcppstyle\rules
package folder. You can see this in nsiqcppstyle_runmanager.py:I have written many proprietary rules that I do not want to return to the NsiqCppStyle repository. To include them in my NsiqCppStyle checking runs, I must copy my rules to the
rules
folder. Should I upgrade NsiqCppStyle to a newer version I may need to copy all of my proprietary rules again. Should I push changes through a GitHub pull request, I have to be careful not to add my proprietary rules to the commit. In general, I want to keep my proprietary rules totally separate from the NsiqCppStyle package.Proposed Solution
The proposal is to support a new command-line option for specifying one or more additional paths that should be searched for rules. These paths can be anywhere in the file system. For all rule names in the
filefilter.txt
file, NsiqCppStyle should search first therules
folder, followed by any additional folders. If found, the engine should import the rule file. The following Stack Overflow post provides Python code that can be used to import the rule file from anywhere. Here is a test script I wrote:d:\junk\import-from-anywhere\main.py
d:\junk\test.py
Running main.py shows the import in action:
The text was updated successfully, but these errors were encountered: