internal bool TryGetApplicableRule(ISymbol symbol, out NamingRule applicableRule)
        {
            if (NamingRules == null)
            {
                applicableRule = null;
                return false;
            }

            if (!IsSymbolNameAnalyzable(symbol))
            {
                applicableRule = null;
                return false;
            }
            
            foreach (var namingRule in NamingRules)
            {
                if (namingRule.AppliesTo(symbol))
                {
                    applicableRule = namingRule;
                    return true;
                }
            }

            applicableRule = null;
            return false;
        }
        internal bool TryGetApplicableRule(ISymbol symbol, out NamingRule applicableRule)
        {
            if (NamingRules == null)
            {
                applicableRule = null;
                return(false);
            }

            if (!IsSymbolNameAnalyzable(symbol))
            {
                applicableRule = null;
                return(false);
            }

            foreach (var namingRule in NamingRules)
            {
                if (namingRule.AppliesTo(symbol))
                {
                    applicableRule = namingRule;
                    return(true);
                }
            }

            applicableRule = null;
            return(false);
        }
        internal bool TryGetApplicableRule(ISymbol symbol, ISymbolCategorizationService categorizationService, out NamingRule applicableRule)
        {
            if (NamingRules == null)
            {
                applicableRule = null;
                return false;
            }

            var matchingRule = NamingRules.FirstOrDefault(r => r.AppliesTo(symbol, categorizationService));
            if (matchingRule == null)
            {
                applicableRule = null;
                return false;
            }

            applicableRule = matchingRule.GetBestMatchingRule(symbol, categorizationService);
            return true;
        }
Esempio n. 4
0
        internal bool TryGetApplicableRule(ISymbol symbol, out NamingRule applicableRule)
        {
            if (NamingRules != null &&
                IsSymbolNameAnalyzable(symbol))
            {
                foreach (var namingRule in NamingRules)
                {
                    if (namingRule.SymbolSpecification.AppliesTo(symbol))
                    {
                        applicableRule = namingRule;
                        return(true);
                    }
                }
            }

            applicableRule = default;
            return(false);
        }
        internal bool TryGetApplicableRule(ISymbol symbol, ISymbolCategorizationService categorizationService, out NamingRule applicableRule)
        {
            if (NamingRules == null)
            {
                applicableRule = null;
                return(false);
            }

            var matchingRule = NamingRules.FirstOrDefault(r => r.AppliesTo(symbol, categorizationService));

            if (matchingRule == null)
            {
                applicableRule = null;
                return(false);
            }

            applicableRule = matchingRule.GetBestMatchingRule(symbol, categorizationService);
            return(true);
        }