加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – 从JetBrains ReSharper命令行工具InspectCode.exe中排除

发布时间:2020-12-16 22:45:55 所属栏目:百科 来源:网络整理
导读:我希望向我的团队证明ReSharper的价值.我想尝试 InspectCode JetBrains发布的命令行工具. 当我指向我的解决方案时它运行正常,但分析所有测试项目和一些生成的文件.我想将它们排除在检查之外.文件说 If you want to configure InspectCode on a CI server,you
我希望向我的团队证明ReSharper的价值.我想尝试 InspectCode JetBrains发布的命令行工具.

当我指向我的解决方案时它运行正常,但分析所有测试项目和一些生成的文件.我想将它们排除在检查之外.文件说

If you want to configure InspectCode on a CI server,you can make all configurations locally with ReSharper.

出于各种原因,我现在无法安装ReSharper的演示版本. InspectCode.exe工具可以生成配置文件,但我不清楚如何手动编辑它以从分析中排除某些文件或项目.这是自动生成的XML文件:

<?xml version="1.0" encoding="utf-8"?>
<InspectCodeOptions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NoSolutionWideAnalysis>false</NoSolutionWideAnalysis>
  <IncludedProjects />
  <SuppressBuildInSettings>false</SuppressBuildInSettings>
  <Debug>false</Debug>
  <Extensions />
  <Properties />
  <DumpIssuesTypes>false</DumpIssuesTypes>
</InspectCodeOptions>

如何修改此XML文件以排除以“generated.cs”结尾的文件,或名称中带有“test”的任何文件或项目?

UPDATE

derigel:我明白我做错了什么.我已重置我的ReSharper配置并重新启动.现在我在设置中更改的是转到ReSharper→选项→代码检查→设置→编辑要跳过的项目.

我添加了一个文件掩码“test”.

点击保存到 – >; [SOLUTIONNAME]团队共享将其保存到我预期的文件中.但是配置文件现在看起来像这样:

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002Atest_002A/@EntryIndexedValue">True</s:Boolean>

哪个InspectCode.exe不喜欢.如果我使用/config=FILENAME.DotSettings,它会给我这个错误:

Failed to load options from file
D:SVNDevelopmentbranchesOpenSolutionClinicalID_v1.0_DevelopmentsrcOpenSolutionConnect.sln.DotSettings.
Caused b y: System.InvalidOperationException: There is an error in XML
document (1,2). —> System.InvalidOperationException:
http://schemas.microsoft.com/winfx/2006/xaml/presentation’> was not
expected.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInspectCodeSettingsData.Read3_InspectCodeOptions()
— End of inner exception stack trace —
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader,String encodingStyle,XmlDeserializationEvents events)
at
JetBrains.CommandLine.Common.Options.OptionsUtils.DeserializeFromFile[T](FileSystemPath
pathToConfig)

解决方法

文档描述了解决方案的设置,而不是工具本身.

例如,以下是生成文件的设置:Configuring Code Inspection Settings和此处关于排除文件:http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Configuring_Warnings.html#d2375e201

更改它们并保存到解决方案共享级别后,将有文件< solutionname> .sln.dotsettings,这些将由命令行工具考虑.

虽然这是一个XML文件,但它并不是很容易编辑的.为什么不能安装ReSharper的试用实例并配置所需的全部内容?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读