Beispiel #1
0
        /// <summary>
        /// Creates a code project using a project file.
        /// </summary>
        /// <param name="projectFile">The project file path.</param>
        /// <param name="environment">The StyleCop environment.</param>
        /// <returns>The code project.</returns>
        public static CodeProject CreateCodeProject(string projectFile, StyleCopEnvironment environment)
        {
            string projectPath = Path.GetDirectoryName(projectFile);

            IEnumerable<string> codeFiles = ProjectUtility.GetAllCodeFile(projectFile);

            return ProjectUtility.CreateCodeProject(codeFiles, projectPath, environment);
        }
        /// <summary>
        /// Initializes a new instance of the SettingsMerger class.
        /// </summary>
        /// <param name="localSettings">
        /// The settings which should be merged.
        /// </param>
        /// <param name="environment">
        /// The environment in which StyleCop is running.
        /// </param>
        public SettingsMerger(Settings localSettings, StyleCopEnvironment environment)
        {
            Param.RequireNotNull(localSettings, "localSettings");
            Param.RequireNotNull(environment, "environment");

            this.localSettings = localSettings;
            this.environment = environment;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the SettingsMerger class.
        /// </summary>
        /// <param name="localSettings">
        /// The settings which should be merged.
        /// </param>
        /// <param name="environment">
        /// The environment in which StyleCop is running.
        /// </param>
        public SettingsMerger(Settings localSettings, StyleCopEnvironment environment)
        {
            Param.RequireNotNull(localSettings, "localSettings");
            Param.RequireNotNull(environment, "environment");

            this.localSettings = localSettings;
            this.environment   = environment;
        }
Beispiel #4
0
        public XmlDocument WriteSettingsToDocument(StyleCopEnvironment environment)
        {
            Param.RequireNotNull(environment, "environment");

            // Create a new document for the settings.
            XmlDocument document = WritableSettings.NewDocument();

            this.SaveSettingsIntoXmlDocument(document, environment, document.DocumentElement, this);

            return(document);
        }
Beispiel #5
0
        public static CodeProject CreateCodeProject(IEnumerable<string> codeFiles, string location, StyleCopEnvironment environment)
        {
            var codeProject = new CodeProject(Guid.NewGuid().GetHashCode(), location, new Configuration(new string[0]));

            foreach (string codeFile in codeFiles)
            {
                if (!File.Exists(codeFile))
                {
                    throw new FileNotFoundException("File " + codeFile + " not found.", codeFile);
                }

                environment.AddSourceCode(codeProject, Path.GetFullPath(codeFile), null);
            }

            return codeProject;
        }
Beispiel #6
0
        /// <summary>
        /// Determines the type of merge to perform, based on the local settings file.
        /// </summary>
        /// <param name="settings">
        /// The settings file
        /// </param>
        /// <param name="environment">
        /// The environment.
        /// </param>
        /// <returns>
        /// Returns the merge type.
        /// </returns>
        private static string DetermineMergeType(Settings settings, StyleCopEnvironment environment)
        {
            Param.AssertNotNull(settings, "settings");
            Param.Ignore(environment);

            StringProperty mergeTypeProperty = settings.GlobalSettings.GetProperty(SettingsMerger.MergeSettingsFilesProperty) as StringProperty;

            string mergeType = SettingsMerger.MergeStyleParent;

            if (mergeTypeProperty != null)
            {
                mergeType = mergeTypeProperty.Value;
            }

            // If the merge style is set to link but the current environment doesn't support linking, change it to parent.
            if ((environment == null || !environment.SupportsLinkedSettings) && string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                mergeType = SettingsMerger.MergeStyleParent;
            }

            return(mergeType);
        }
        public XmlDocument WriteSettingsToDocument(StyleCopEnvironment environment)
        {
            Param.RequireNotNull(environment, "environment");

            // Create a new document for the settings.
            XmlDocument document = WritableSettings.NewDocument();

            // Get the parent settings if there are any.
            SettingsMerger merger = new SettingsMerger(this, environment);
            Settings parentSettings = merger.ParentMergedSettings;

            // Add the global settings if there are any.
            if (this.GlobalSettings != null && this.GlobalSettings.Count > 0)
            {
                // Get the global settings from the parent.
                PropertyCollection parentGlobalSettings = null;
                if (parentSettings != null)
                {
                    parentGlobalSettings = parentSettings.GlobalSettings;
                }

                SavePropertyCollection(document.DocumentElement, "GlobalSettings", this.GlobalSettings, parentGlobalSettings, true, null);
            }

            // Add the parser settings if there are any.
            if (this.ParserSettings.Count > 0)
            {
                bool parserSettingsAdded = false;
                XmlElement parsersNode = document.CreateElement("Parsers");

                foreach (AddInPropertyCollection parserSettings in this.ParserSettings)
                {
                    // Add the settings for this parser if there are any.
                    if (parserSettings.Count > 0)
                    {
                        // Create a node for this parser.
                        XmlElement parserNode = document.CreateElement("Parser");
                        XmlAttribute parserIdAttribute = document.CreateAttribute("ParserId");
                        parserIdAttribute.Value = parserSettings.AddIn.Id;
                        parserNode.Attributes.Append(parserIdAttribute);

                        // Get the parser settings from the parent.
                        PropertyCollection parentParserSettings = null;
                        if (parentSettings != null)
                        {
                            parentParserSettings = parentSettings.GetAddInSettings(parserSettings.AddIn);
                        }

                        if (SavePropertyCollection(parserNode, "ParserSettings", parserSettings, parentParserSettings, true, null))
                        {
                            parsersNode.AppendChild(parserNode);
                            parserSettingsAdded = true;
                        }
                    }
                }

                if (parserSettingsAdded)
                {
                    document.DocumentElement.AppendChild(parsersNode);
                }
            }

            // Add the analyzer settings if there are any.
            if (this.AnalyzerSettings.Count > 0)
            {
                bool analyzerSettingsAdded = false;
                XmlElement analyzersNode = document.CreateElement("Analyzers");

                foreach (AddInPropertyCollection analyzerSettings in this.AnalyzerSettings)
                {
                    // Add the settings for this analyzer if there are any.
                    if (analyzerSettings.Count > 0)
                    {
                        // Create a node for this analzyer.
                        XmlElement analyzerNode = document.CreateElement("Analyzer");
                        XmlAttribute analyzerIdAttribute = document.CreateAttribute("AnalyzerId");
                        analyzerIdAttribute.Value = analyzerSettings.AddIn.Id;
                        analyzerNode.Attributes.Append(analyzerIdAttribute);

                        // Get the analyzer settings from the parent.
                        PropertyCollection parentAnalyzerSettings = null;
                        if (parentSettings != null)
                        {
                            parentAnalyzerSettings = parentSettings.GetAddInSettings(analyzerSettings.AddIn);
                        }

                        if (SavePropertyCollection(analyzerNode, "AnalyzerSettings", analyzerSettings, parentAnalyzerSettings, true, null))
                        {
                            analyzersNode.AppendChild(analyzerNode);
                            analyzerSettingsAdded = true;
                        }
                    }
                }

                if (analyzerSettingsAdded)
                {
                    document.DocumentElement.AppendChild(analyzersNode);
                }
            }

            return document;
        }
        /// <summary>
        /// Determines the type of merge to perform, based on the local settings file.
        /// </summary>
        /// <param name="settings">
        /// The settings file
        /// </param>
        /// <param name="environment">
        /// The environment.
        /// </param>
        /// <returns>
        /// Returns the merge type.
        /// </returns>
        private static string DetermineMergeType(Settings settings, StyleCopEnvironment environment)
        {
            Param.AssertNotNull(settings, "settings");
            Param.Ignore(environment);

            StringProperty mergeTypeProperty = settings.GlobalSettings.GetProperty(SettingsMerger.MergeSettingsFilesProperty) as StringProperty;

            string mergeType = SettingsMerger.MergeStyleParent;
            if (mergeTypeProperty != null)
            {
                mergeType = mergeTypeProperty.Value;
            }

            // If the merge style is set to link but the current environment doesn't support linking, change it to parent.
            if ((environment == null || !environment.SupportsLinkedSettings) && string.CompareOrdinal(mergeType, SettingsMerger.MergeStyleLinked) == 0)
            {
                mergeType = SettingsMerger.MergeStyleParent;
            }

            return mergeType;
        }
Beispiel #9
0
        public StyleCopCore(StyleCopEnvironment environment, object hostTag)
        {
            Param.Ignore(environment);
            Param.Ignore(hostTag);
            StyleCopTrace.In(environment, hostTag);

            this.environment = environment;
            this.hostTag = hostTag;

            // If no environment was provided, use the file based environment.
            if (this.environment == null)
            {
                this.environment = new FileBasedEnvironment();
            }

            this.environment.Core = this;
            
            // Load the core xml initialization document.
            try
            {
                using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("StyleCop.CoreParser.xml"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    string xml = reader.ReadToEnd();
                    XmlDocument parserXml = new XmlDocument();
                    parserXml.LoadXml(xml);
                    this.coreParser.Initialize(this, parserXml, true, true);
                }
            }
            catch (XmlException)
            {
                AlertDialog.Show(this, null, Strings.StyleCopUnableToLoad, Strings.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (ArgumentException argex)
            {
                AlertDialog.Show(this, null, string.Format(CultureInfo.CurrentUICulture, Strings.StyleCopUnableToLoad, argex.Message), Strings.Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            StyleCopTrace.Out();
        }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the StyleCopCore class.
 /// </summary>
 /// <param name="environment">The environment that StyleCop is running under.</param>
 public StyleCopCore(StyleCopEnvironment environment) : this(environment, null)
 {
     Param.Ignore(environment);
 }
        /// <summary>
        /// Saves the Settings provided into the XmlDocument.
        /// </summary>
        /// <param name="document">
        /// The root document.
        /// </param>
        /// <param name="environment">
        /// The environment that StyleCop is running under, if any.
        /// </param>
        /// <param name="rootElement">
        /// The element to save our settings to.
        /// </param>
        /// <param name="settingsToSave">
        /// The settings to save.
        /// </param>
        private void SaveSettingsIntoXmlDocument(XmlDocument document, StyleCopEnvironment environment, XmlElement rootElement, Settings settingsToSave)
        {
            // Get the parent settings if there are any.
            SettingsMerger merger = new SettingsMerger(settingsToSave, environment);
            Settings parentSettings = merger.ParentMergedSettings;

            // Add the global settings if there are any.
            if (settingsToSave.GlobalSettings != null && settingsToSave.GlobalSettings.Count > 0)
            {
                // Get the global settings from the parent.
                PropertyCollection parentGlobalSettings = null;
                if (parentSettings != null)
                {
                    parentGlobalSettings = parentSettings.GlobalSettings;
                }

                SavePropertyCollection(rootElement, "GlobalSettings", settingsToSave.GlobalSettings, parentGlobalSettings, true, null);
            }

            // Add the parser settings if there are any.
            if (settingsToSave.ParserSettings.Count > 0)
            {
                bool parserSettingsAdded = false;
                XmlElement parsersNode = document.CreateElement("Parsers");

                foreach (AddInPropertyCollection parserSettings in settingsToSave.ParserSettings)
                {
                    // Add the settings for this parser if there are any.
                    if (parserSettings.Count > 0)
                    {
                        // Create a node for this parser.
                        XmlElement parserNode = document.CreateElement("Parser");
                        XmlAttribute parserIdAttribute = document.CreateAttribute("ParserId");
                        parserIdAttribute.Value = parserSettings.AddIn.Id;
                        parserNode.Attributes.Append(parserIdAttribute);

                        // Get the parser settings from the parent.
                        PropertyCollection parentParserSettings = null;
                        if (parentSettings != null)
                        {
                            parentParserSettings = parentSettings.GetAddInSettings(parserSettings.AddIn);
                        }

                        if (SavePropertyCollection(parserNode, "ParserSettings", parserSettings, parentParserSettings, true, null))
                        {
                            parsersNode.AppendChild(parserNode);
                            parserSettingsAdded = true;
                        }
                    }
                }

                if (parserSettingsAdded)
                {
                    rootElement.AppendChild(parsersNode);
                }
            }

            // Add the analyzer settings if there are any.
            if (settingsToSave.AnalyzerSettings.Count > 0)
            {
                bool analyzerSettingsAdded = false;
                XmlElement analyzersNode = document.CreateElement("Analyzers");

                foreach (AddInPropertyCollection analyzerSettings in settingsToSave.AnalyzerSettings)
                {
                    // Add the settings for this analyzer if there are any.
                    if (analyzerSettings.Count > 0)
                    {
                        // Create a node for this analzyer.
                        XmlElement analyzerNode = document.CreateElement("Analyzer");
                        XmlAttribute analyzerIdAttribute = document.CreateAttribute("AnalyzerId");
                        analyzerIdAttribute.Value = analyzerSettings.AddIn.Id;
                        analyzerNode.Attributes.Append(analyzerIdAttribute);

                        // Get the analyzer settings from the parent.
                        PropertyCollection parentAnalyzerSettings = null;
                        if (parentSettings != null)
                        {
                            parentAnalyzerSettings = parentSettings.GetAddInSettings(analyzerSettings.AddIn);
                        }

                        if (SavePropertyCollection(analyzerNode, "AnalyzerSettings", analyzerSettings, parentAnalyzerSettings, true, null))
                        {
                            analyzersNode.AppendChild(analyzerNode);
                            analyzerSettingsAdded = true;
                        }
                    }
                }

                if (analyzerSettingsAdded)
                {
                    rootElement.AppendChild(analyzersNode);
                }
            }

            // Add the sourcefilelists settings if there are any.
            if (settingsToSave.SourceFileLists.Count > 0)
            {
                foreach (SourceFileListSettings sourceFileListSettings in settingsToSave.SourceFileLists)
                {
                    XmlElement sourceFileListNode = document.CreateElement("SourceFileList");

                    foreach (string sourceFileListSetting in sourceFileListSettings.SourceFiles)
                    {
                        XmlElement sourceFileNode = document.CreateElement("SourceFile");
                        sourceFileNode.InnerText = sourceFileListSetting;
                        sourceFileListNode.AppendChild(sourceFileNode);
                    }

                    XmlElement settingsNode = document.CreateElement("Settings");

                    this.SaveSettingsIntoXmlDocument(document, environment, settingsNode, sourceFileListSettings.Settings);

                    sourceFileListNode.AppendChild(settingsNode);
                    rootElement.AppendChild(sourceFileListNode);
                }
            }
        }
        public XmlDocument WriteSettingsToDocument(StyleCopEnvironment environment)
        {
            Param.RequireNotNull(environment, "environment");

            // Create a new document for the settings.
            XmlDocument document = WritableSettings.NewDocument();

            this.SaveSettingsIntoXmlDocument(document, environment, document.DocumentElement, this);

            return document;
        }
Beispiel #13
0
        public XmlDocument WriteSettingsToDocument(StyleCopEnvironment environment)
        {
            Param.RequireNotNull(environment, "environment");

            // Create a new document for the settings.
            XmlDocument document = WritableSettings.NewDocument();

            // Get the parent settings if there are any.
            SettingsMerger merger         = new SettingsMerger(this, environment);
            Settings       parentSettings = merger.ParentMergedSettings;

            // Add the global settings if there are any.
            if (this.GlobalSettings != null && this.GlobalSettings.Count > 0)
            {
                // Get the global settings from the parent.
                PropertyCollection parentGlobalSettings = null;
                if (parentSettings != null)
                {
                    parentGlobalSettings = parentSettings.GlobalSettings;
                }

                SavePropertyCollection(document.DocumentElement, "GlobalSettings", this.GlobalSettings, parentGlobalSettings, true, null);
            }

            // Add the parser settings if there are any.
            if (this.ParserSettings.Count > 0)
            {
                bool       parserSettingsAdded = false;
                XmlElement parsersNode         = document.CreateElement("Parsers");

                foreach (AddInPropertyCollection parserSettings in this.ParserSettings)
                {
                    // Add the settings for this parser if there are any.
                    if (parserSettings.Count > 0)
                    {
                        // Create a node for this parser.
                        XmlElement   parserNode        = document.CreateElement("Parser");
                        XmlAttribute parserIdAttribute = document.CreateAttribute("ParserId");
                        parserIdAttribute.Value = parserSettings.AddIn.Id;
                        parserNode.Attributes.Append(parserIdAttribute);

                        // Get the parser settings from the parent.
                        PropertyCollection parentParserSettings = null;
                        if (parentSettings != null)
                        {
                            parentParserSettings = parentSettings.GetAddInSettings(parserSettings.AddIn);
                        }

                        if (SavePropertyCollection(parserNode, "ParserSettings", parserSettings, parentParserSettings, true, null))
                        {
                            parsersNode.AppendChild(parserNode);
                            parserSettingsAdded = true;
                        }
                    }
                }

                if (parserSettingsAdded)
                {
                    document.DocumentElement.AppendChild(parsersNode);
                }
            }

            // Add the analyzer settings if there are any.
            if (this.AnalyzerSettings.Count > 0)
            {
                bool       analyzerSettingsAdded = false;
                XmlElement analyzersNode         = document.CreateElement("Analyzers");

                foreach (AddInPropertyCollection analyzerSettings in this.AnalyzerSettings)
                {
                    // Add the settings for this analyzer if there are any.
                    if (analyzerSettings.Count > 0)
                    {
                        // Create a node for this analzyer.
                        XmlElement   analyzerNode        = document.CreateElement("Analyzer");
                        XmlAttribute analyzerIdAttribute = document.CreateAttribute("AnalyzerId");
                        analyzerIdAttribute.Value = analyzerSettings.AddIn.Id;
                        analyzerNode.Attributes.Append(analyzerIdAttribute);

                        // Get the analyzer settings from the parent.
                        PropertyCollection parentAnalyzerSettings = null;
                        if (parentSettings != null)
                        {
                            parentAnalyzerSettings = parentSettings.GetAddInSettings(analyzerSettings.AddIn);
                        }

                        if (SavePropertyCollection(analyzerNode, "AnalyzerSettings", analyzerSettings, parentAnalyzerSettings, true, null))
                        {
                            analyzersNode.AppendChild(analyzerNode);
                            analyzerSettingsAdded = true;
                        }
                    }
                }

                if (analyzerSettingsAdded)
                {
                    document.DocumentElement.AppendChild(analyzersNode);
                }
            }

            return(document);
        }
Beispiel #14
0
        /// <summary>
        /// Saves the Settings provided into the XmlDocument.
        /// </summary>
        /// <param name="document">
        /// The root document.
        /// </param>
        /// <param name="environment">
        /// The environment that StyleCop is running under, if any.
        /// </param>
        /// <param name="rootElement">
        /// The element to save our settings to.
        /// </param>
        /// <param name="settingsToSave">
        /// The settings to save.
        /// </param>
        private void SaveSettingsIntoXmlDocument(XmlDocument document, StyleCopEnvironment environment, XmlElement rootElement, Settings settingsToSave)
        {
            // Get the parent settings if there are any.
            SettingsMerger merger         = new SettingsMerger(settingsToSave, environment);
            Settings       parentSettings = merger.ParentMergedSettings;

            // Add the global settings if there are any.
            if (settingsToSave.GlobalSettings != null && settingsToSave.GlobalSettings.Count > 0)
            {
                // Get the global settings from the parent.
                PropertyCollection parentGlobalSettings = null;
                if (parentSettings != null)
                {
                    parentGlobalSettings = parentSettings.GlobalSettings;
                }

                SavePropertyCollection(rootElement, "GlobalSettings", settingsToSave.GlobalSettings, parentGlobalSettings, true, null);
            }

            // Add the parser settings if there are any.
            if (settingsToSave.ParserSettings.Count > 0)
            {
                bool       parserSettingsAdded = false;
                XmlElement parsersNode         = document.CreateElement("Parsers");

                foreach (AddInPropertyCollection parserSettings in settingsToSave.ParserSettings)
                {
                    // Add the settings for this parser if there are any.
                    if (parserSettings.Count > 0)
                    {
                        // Create a node for this parser.
                        XmlElement   parserNode        = document.CreateElement("Parser");
                        XmlAttribute parserIdAttribute = document.CreateAttribute("ParserId");
                        parserIdAttribute.Value = parserSettings.AddIn.Id;
                        parserNode.Attributes.Append(parserIdAttribute);

                        // Get the parser settings from the parent.
                        PropertyCollection parentParserSettings = null;
                        if (parentSettings != null)
                        {
                            parentParserSettings = parentSettings.GetAddInSettings(parserSettings.AddIn);
                        }

                        if (SavePropertyCollection(parserNode, "ParserSettings", parserSettings, parentParserSettings, true, null))
                        {
                            parsersNode.AppendChild(parserNode);
                            parserSettingsAdded = true;
                        }
                    }
                }

                if (parserSettingsAdded)
                {
                    rootElement.AppendChild(parsersNode);
                }
            }

            // Add the analyzer settings if there are any.
            if (settingsToSave.AnalyzerSettings.Count > 0)
            {
                bool       analyzerSettingsAdded = false;
                XmlElement analyzersNode         = document.CreateElement("Analyzers");

                foreach (AddInPropertyCollection analyzerSettings in settingsToSave.AnalyzerSettings)
                {
                    // Add the settings for this analyzer if there are any.
                    if (analyzerSettings.Count > 0)
                    {
                        // Create a node for this analzyer.
                        XmlElement   analyzerNode        = document.CreateElement("Analyzer");
                        XmlAttribute analyzerIdAttribute = document.CreateAttribute("AnalyzerId");
                        analyzerIdAttribute.Value = analyzerSettings.AddIn.Id;
                        analyzerNode.Attributes.Append(analyzerIdAttribute);

                        // Get the analyzer settings from the parent.
                        PropertyCollection parentAnalyzerSettings = null;
                        if (parentSettings != null)
                        {
                            parentAnalyzerSettings = parentSettings.GetAddInSettings(analyzerSettings.AddIn);
                        }

                        if (SavePropertyCollection(analyzerNode, "AnalyzerSettings", analyzerSettings, parentAnalyzerSettings, true, null))
                        {
                            analyzersNode.AppendChild(analyzerNode);
                            analyzerSettingsAdded = true;
                        }
                    }
                }

                if (analyzerSettingsAdded)
                {
                    rootElement.AppendChild(analyzersNode);
                }
            }

            // Add the sourcefilelists settings if there are any.
            if (settingsToSave.SourceFileLists.Count > 0)
            {
                foreach (SourceFileListSettings sourceFileListSettings in settingsToSave.SourceFileLists)
                {
                    XmlElement sourceFileListNode = document.CreateElement("SourceFileList");

                    foreach (string sourceFileListSetting in sourceFileListSettings.SourceFiles)
                    {
                        XmlElement sourceFileNode = document.CreateElement("SourceFile");
                        sourceFileNode.InnerText = sourceFileListSetting;
                        sourceFileListNode.AppendChild(sourceFileNode);
                    }

                    XmlElement settingsNode = document.CreateElement("Settings");

                    this.SaveSettingsIntoXmlDocument(document, environment, settingsNode, sourceFileListSettings.Settings);

                    sourceFileListNode.AppendChild(settingsNode);
                    rootElement.AppendChild(sourceFileListNode);
                }
            }
        }
Beispiel #15
0
 /// <summary>
 /// Creates a code project using only one file.
 /// </summary>
 /// <param name="codeFile">The code file.</param>
 /// <param name="settingsLocation">The StyleCop.settings file location.</param>
 /// <param name="environment">The StyleCop environment.</param>
 /// <returns>The code project.</returns>
 public static CodeProject CreateOneFileProject(string codeFile, string settingsLocation,
                                                StyleCopEnvironment environment)
 {
     return ProjectUtility.CreateCodeProject(new List<string> { codeFile }, settingsLocation, environment);
 }
Beispiel #16
0
        /// <summary>
        /// Creates a code project using only one file.
        /// </summary>
        /// <param name="codeFile">The code file.</param>
        /// <param name="environment">The StyleCop environment.</param>
        /// <returns>The code project.</returns>
        public static CodeProject CreateOneFileProject(string codeFile, StyleCopEnvironment environment)
        {
            string filePath = Path.GetDirectoryName(codeFile);

            return ProjectUtility.CreateCodeProject(new List<string> { codeFile }, filePath, environment);
        }
Beispiel #17
0
 /// <summary>
 /// Creates a code project using a list of code file.
 /// </summary>
 /// <param name="codeFiles">The code file list.</param>
 /// <param name="environment">The StyleCop environment.</param>
 /// <returns>The code project.</returns>
 public static CodeProject CreateCodeProject(IEnumerable<string> codeFiles, StyleCopEnvironment environment)
 {
     return ProjectUtility.CreateCodeProject(codeFiles, PathUtility.GetCommonRootPath(codeFiles), environment);
 }