コード例 #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);
                }
            }
        }
コード例 #2
0
ファイル: EventCRC.cs プロジェクト: cnxtech/Dexter-1
        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);
                }
            }
        }
コード例 #3
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);
                }
            }
        }