Hosting StyleCop in a custom environment

I want to host a StyleCop in a custom environment, the example code provided in the SDK uses this one foreach(string myProject in this.myProjects)

. String

does not have the same properties as Path.GetHashCode()

and FilesToAnalyze

, does anyone know what it is this.myProjects

?

List<CodeProject> projects = new List<CodeProject>();    

// what is this.myProject?
foreach (string myProject in this.myProjects)
{
     CodeProject project = new CodeProject(
         myProject.Path.GetHashCode(), myProject.Path, configuration);

    // Add each source file to this project.
    foreach (string sourceFilePath in myProject.FilesToAnalyze)
    {
        console.Core.Environment.AddSourceCode(project, sourceFilePath, null);
    }

    projects.Add(project);
}

      

+2


source to share


2 answers


After looking at the example in the SDK, I think this myProject

is just a placeholder to indicate how to build an instance CodeProject

.

If you like, you can define the class as shown below, or store the root path and files for analysis in a different data structure.



public class MyProject
{
    public string Path { get { ... } }

    public IEnumerable<string> FilesToAnalyze { get { ... } }
}

      

+2


source


Yes it just means an example of pseudocode. Your best bet is to go to stylecop.codeplex.com and just look at the actual StyleCop code. There are many examples in the code showing how to host the StyleCop.



0


source







All Articles