Esempio n. 1
0
        internal bool CheckAll(TextWriter textWriter)
        {
            var allGood = true;

            foreach (var filePath in Directory.GetFiles(_targetDir))
            {
                var fileName = Path.GetFileName(filePath);
                if (fileName == "README.md")
                {
                    continue;
                }

                textWriter.WriteLine($"Checking {fileName}");
                if (SharedUtil.IsPropsFile(filePath))
                {
                    allGood &= CheckProps(new ProjectUtil(filePath), textWriter);
                }
                else if (SharedUtil.IsTargetsFile(filePath))
                {
                    allGood &= CheckTargets(new ProjectUtil(filePath), textWriter);
                }
                else if (SharedUtil.IsXslt(filePath))
                {
                    // Nothing to verify
                }
                else
                {
                    textWriter.WriteLine("Unrecognized file type");
                    allGood = false;
                }
            }

            return(allGood);
        }
Esempio n. 2
0
        private bool CheckTargets(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;

            foreach (var project in GetImportProjects(util))
            {
                if (SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Targets files should not Import props files");
                    allGood = false;
                }
            }

            return(allGood);
        }
Esempio n. 3
0
        private bool CheckProps(ProjectUtil util, TextWriter textWriter)
        {
            var allGood = true;

            foreach (var project in GetImportProjects(util))
            {
                if (!SharedUtil.IsPropsFile(project))
                {
                    textWriter.WriteLine($"Props files should only Import other props files");
                    allGood = false;
                }
            }

            if (util.GetTargets().Any())
            {
                textWriter.WriteLine($"Props files should not contain <Target> elements");
                allGood = false;
            }

            return(allGood);
        }