在自定义环境中托管 StyleCop

发布于 2024-08-03 21:21:54 字数 752 浏览 7 评论 0原文

我想在自定义环境中托管 StyleCop,SDK 中提供的示例代码使用此 foreach(string myProject in this.myProjects)String 没有 Path.GetHashCode()FilesToAnalyze 等属性,有谁知道 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);
}

I want to host StyleCop in a Custom Environment, the sample code provided in SDK uses this foreach(string myProject in this.myProjects). String doesn't have properties like Path.GetHashCode() and FilesToAnalyze, does anyone knows what 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);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

被翻牌 2024-08-10 21:21:54

查看 SDK 中的示例后,我认为 myProject 只是一个占位符,用于指示如何构造 CodeProject 实例。

如果您愿意,可以定义一个类,如下所示,或保留根路径和文件以在不同的数据结构中进行分析。

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

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

After looking at the example in the SDK I think myProject is just a placeholder to indicate how to construct a CodeProject instance.

If you want you can define a class as shown below or keep the root path and files to analyze in a different data structure.

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

    public IEnumerable<string> FilesToAnalyze { get { ... } }
}
要走干脆点 2024-08-10 21:21:54

是的,这只是一个伪代码示例。您最好访问 stylecop.codeplex.com 并查看实际的 StyleCop 代码。代码中有很多示例展示了如何托管 StyleCop。

Yes, this is just meant to be a pseudocode example. Your best bet it 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 StyleCop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文