Repository: microsoft/ApplicationInspector
File: AppInspector/Commands/VerifyRulesCommand.cs (C#)

Code before:
    /// </summary>
    /// <returns>output results</returns>
    public VerifyRulesResult GetResult()
    {
        _logger.LogTrace("VerifyRulesCommand::Run");
        _logger.LogInformation(MsgHelp.GetString(MsgHelp.ID.CMD_RUNNING), "Verify Rules");

        VerifyRulesResult verifyRulesResult = new() { AppVersion = Utils.GetVersionString() };

        try
        {
            var analyzer = new ApplicationInspectorAnalyzer();
            RulesVerifierOptions options = new()
            {
                Analyzer = analyzer,
                DisableRequireUniqueIds = _options.DisableRequireUniqueIds,
                RequireMustMatch = _options.RequireMustMatch,
                RequireMustNotMatch = _options.RequireMustNotMatch,
                LoggerFactory = _loggerFactory,
                LanguageSpecs = Languages.FromConfigurationFiles(_loggerFactory, _options.CustomCommentsPath, _options.CustomLanguagesPath),
                EnableNonBacktrackingRegex= _options.EnableNonBacktrackingRegex,
            };
            RulesVerifier verifier = new(options);
            verifyRulesResult.ResultCode = VerifyRulesResult.ExitCode.Verified;

            RuleSet? ruleSet = new(_loggerFactory, _options.EnableNonBacktrackingRegex);
            if (_options.VerifyDefaultRules)
            {
                ruleSet = RuleSetUtils.GetDefaultRuleSet(_loggerFactory);
            }

            try
            {
                if (_options.CustomRulesPath != null)
                {
                    if (Directory.Exists(_options.CustomRulesPath))
                    {
                        ruleSet.AddDirectory(_options.CustomRulesPath);
                    }
                    else if (File.Exists(_options.CustomRulesPath))
                    {
                        ruleSet.AddFile(_options.CustomRulesPath);
                    }
                }
            }
            catch (JsonException e)
            {
                _logger.LogError(e.Message);
                verifyRulesResult.ResultCode = VerifyRulesResult.ExitCode.CriticalError;
                return verifyRulesResult;
            }

Review comment (suggestion):
Nit. Should use the `EnableNonBackTrackingRegex` property that was set a few lines earlier instead of referencing the options twice.

Code after:
    /// </summary>
    /// <returns>output results</returns>
    public VerifyRulesResult GetResult()
    {
        _logger.LogTrace("VerifyRulesCommand::Run");
        _logger.LogInformation(MsgHelp.GetString(MsgHelp.ID.CMD_RUNNING), "Verify Rules");

        VerifyRulesResult verifyRulesResult = new() { AppVersion = Utils.GetVersionString() };

        try
        {
            var analyzer = new ApplicationInspectorAnalyzer();
            RulesVerifierOptions options = new()
            {
                Analyzer = analyzer,
                DisableRequireUniqueIds = _options.DisableRequireUniqueIds,
                RequireMustMatch = _options.RequireMustMatch,
                RequireMustNotMatch = _options.RequireMustNotMatch,
                LoggerFactory = _loggerFactory,
                LanguageSpecs = Languages.FromConfigurationFiles(_loggerFactory, _options.CustomCommentsPath, _options.CustomLanguagesPath),
                EnableNonBacktrackingRegex = _options.EnableNonBacktrackingRegex,
            };
            RulesVerifier verifier = new(options);
            verifyRulesResult.ResultCode = VerifyRulesResult.ExitCode.Verified;

            RuleSet? ruleSet = new(_loggerFactory) { EnableNonBacktrackingRegex = options.EnableNonBacktrackingRegex };

            if (_options.VerifyDefaultRules)
            {
                ruleSet = RuleSetUtils.GetDefaultRuleSet(_loggerFactory);
            }

            try
            {
                if (_options.CustomRulesPath != null)
                {
                    if (Directory.Exists(_options.CustomRulesPath))
                    {
                        ruleSet.AddDirectory(_options.CustomRulesPath);
                    }
                    else if (File.Exists(_options.CustomRulesPath))
                    {
                        ruleSet.AddFile(_options.CustomRulesPath);
                    }
                }
            }
            catch (JsonException e)
            {
                _logger.LogError(e.Message);
                verifyRulesResult.ResultCode = VerifyRulesResult.ExitCode.CriticalError;
                return verifyRulesResult;