Ejemplo n.º 1
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var delegateRaws = syntaxRoot.DescendantNodes().OfType <DelegateDeclarationSyntax>();

            foreach (var delegateRaw in delegateRaws)
            {
                var delegateName = delegateRaw.Identifier.ToString();

                if (pascalCasing.HasDefect(delegateName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, delegateRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }

                if (!suffixNaming.HasDefect(new NamingSet
                {
                    currentName = delegateName,
                    basicWord = DexterCRCUtil.DELEGATE_SUFFIX
                }))
                {
                    PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, delegateRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Ejemplo n.º 2
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var methodRaws = syntaxRoot.DescendantNodes().OfType <MethodDeclarationSyntax>();

            if (!methodRaws.Any())
            {
                return;
            }

            foreach (var methodRaw in methodRaws)
            {
                string methodName = methodRaw.Identifier.ToString();

                if (withoutUnderscore.HasDefect(methodName))
                {
                    PreOccurence preOcc = withoutUnderscore.MakeDefect(config, checker, methodRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
                if (pascalCasing.HasDefect(methodName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, methodRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
                if (verbNaming.HasDefect(methodName))
                {
                    PreOccurence preOcc = verbNaming.MakeDefect(config, checker, methodRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Ejemplo n.º 3
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var interfaceRaws = syntaxRoot.DescendantNodes().OfType <InterfaceDeclarationSyntax>();

            if (!interfaceRaws.Any())
            {
                return;
            }
            foreach (var interfaceRaw in interfaceRaws)
            {
                string interfaceName = interfaceRaw.Identifier.ToString();

                if (prefixNaming.HasDefect(new NamingSet
                {
                    currentName = interfaceName,
                    basicWord = "I"
                }))
                {
                    PreOccurence preOcc = prefixNaming.MakeDefect(config, checker, interfaceRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }

                if (underscore.HasDefect(interfaceName)) // Underscore Naming
                {
                    PreOccurence preOcc = underscore.MakeDefect(config, checker, interfaceRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }

                if (pascalCasing.HasDefect(interfaceName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, interfaceRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Ejemplo n.º 4
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var propertyRaws = syntaxRoot.DescendantNodes().OfType <PropertyDeclarationSyntax>();

            if (!propertyRaws.Any())
            {
                return;
            }
            foreach (var propertyRaw in propertyRaws)
            {
                string propertyName = propertyRaw.Identifier.ToString();
                if (pascalCasing.HasDefect(propertyName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, propertyRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
                if (DexterUtil.IsPropertyDeclarationBoolean(propertyRaw))
                {
                    if (booleanPropertyPrefixing.HasDefect(propertyName))
                    {
                        PreOccurence preOcc = booleanPropertyPrefixing.MakeDefect(config, checker, propertyRaw);
                        result.AddDefectWithPreOccurence(preOcc);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 private bool HasCamelCasingDefect(SeparatedSyntaxList <VariableDeclaratorSyntax> variables)
 {
     foreach (var variable in variables)
     {
         if (pascalCasing.HasDefect(variable.Identifier.ToString()))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 6
0
        private List <string> GetCamelCasingVariables(SeparatedSyntaxList <VariableDeclaratorSyntax> variables)
        {
            List <string> tempVariables = new List <string>();

            foreach (var variable in variables)
            {
                if (pascalCasing.HasDefect(variable.Identifier.ToString()))
                {
                    tempVariables.Add(variable.Identifier.ToString());
                }
            }
            return(tempVariables);
        }
Ejemplo n.º 7
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var namespaceRaws = syntaxRoot.DescendantNodes().OfType <NamespaceDeclarationSyntax>();

            foreach (var namespaceRaw in namespaceRaws)
            {
                string namespaceName = namespaceRaw.Name.ToString();
                if (pascalCasing.HasDefect(namespaceName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, namespaceRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Ejemplo n.º 8
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var enumRaws = syntaxRoot.DescendantNodes().OfType <EnumDeclarationSyntax>();

            foreach (var enumRaw in enumRaws)
            {
                var enumName = enumRaw.Identifier.ToString();
                if (pascalCasing.HasDefect(enumName))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, enumRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Ejemplo n.º 9
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var classRaws = syntaxRoot.DescendantNodes().OfType <ClassDeclarationSyntax>();

            if (!classRaws.Any())
            {
                return;
            }

            foreach (var classRaw in classRaws)
            {
                string className = classRaw.Identifier.ToString();
                if (underscore.HasDefect(className))
                {
                    PreOccurence preOcc = underscore.MakeDefect(config, checker, classRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
                if (pascalCasing.HasDefect(className))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, classRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
                if (nounNaming.HasDefect(className))
                {
                    PreOccurence preOcc = nounNaming.MakeDefect(config, checker, classRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }

                if (classRaw.BaseList == null)
                {
                    continue;
                }
                else if (HasBaseTypeNamingDefect(className, classRaw.BaseList.Types))
                {
                    PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, classRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }