Beispiel #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);
                }
            }
        }
Beispiel #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);
                }
            }
        }
Beispiel #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);
                }
            }
        }
Beispiel #4
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var eventRaws = syntaxRoot.DescendantNodes().OfType <EventFieldDeclarationSyntax>();

            foreach (var eventRaw in eventRaws)
            {
                string eventTypeName = eventRaw.Declaration.Type.ToString();
                if (suffixNaming.HasDefect(new NamingSet
                {
                    currentName = eventTypeName,
                    basicWord = DexterCRCUtil.EVENT_TYPE_SUFFIX
                }))
                {
                    PreOccurence preOcc = suffixNaming.MakeDefect(config, checker, eventRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }

                List <string> variables = GetCamelCasingVariables(eventRaw.Declaration.Variables);
                foreach (string variable in variables)
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, eventRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Beispiel #5
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);
                    }
                }
            }
        }
Beispiel #6
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);
                }
            }
        }
Beispiel #7
0
        public void Analyze(AnalysisConfig config, AnalysisResult result, Checker checker, SyntaxNode syntaxRoot)
        {
            var baseFieldRaws = syntaxRoot.DescendantNodes().OfType <FieldDeclarationSyntax>();

            foreach (var fieldRaw in baseFieldRaws)
            {
                if (HasFieldModifier(fieldRaw.Modifiers) &&
                    HasCamelCasingDefect(fieldRaw.Declaration.Variables))
                {
                    PreOccurence preOcc = pascalCasing.MakeDefect(config, checker, fieldRaw);
                    result.AddDefectWithPreOccurence(preOcc);
                }
            }
        }
Beispiel #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);
                }
            }
        }
Beispiel #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);
                }
            }
        }