从JetBrains ReSharper命令行工具InspectCode.exe中排除文件

Pet*_*ead 5 xml resharper configuration

我希望向我的团队展示ReSharper的价值。我想尝试已发布的命令行工具InspectCode JetBrains。

当我将其指向我的解决方案时,它运行良好,但可以分析所有测试项目以及一些生成的文件。我想把它们排除在检查之外。该文件说

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

For various reasons I can't install even the demo version of ReSharper at the moment to do this. The InspectCode.exe tool can generate a configuration file, but it is not clear how I can manually edit this to exclude certain files or projects from analysis. Here is the auto generated XML file:

<?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>
Run Code Online (Sandbox Code Playgroud)

How can I modify this XML file to exclude files ending in "generated.cs", or any file or project with "test" in the name?

UPDATE

derigel: I see what I did wrong. I have reset my ReSharper configuration and started again. Now all I changed in the settings was to go to ReSharper ? Options ? Code Inspection ? Settings ? Edit Items to Skip.

I added a file mask, "test".

Clicking save-to -> [SOLUTIONNAME] team shared saved it to the file as I expected. However the configuration file now looks like this:

<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>
Run Code Online (Sandbox Code Playgroud)

Which InspectCode.exe does not like. It gives me this error if I use /config=FILENAME.DotSettings:

Failed to load options from file
D:\SVN\Development\branches\OpenSolutionClinicalID_v1.0_Development\src\OpenSolutionConnect.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)
在JetBrains.CommandLine.Common.Options.OptionsUtils.DeserializeFromFile [T](FileSystemPath pathToConfig)中

der*_*gel 2

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

例如,以下是生成文件的设置:配置代码检查设置,以及有关排除文件的设置:http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Configuring_Warnings.html#d2375e201

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

虽然这是一个 XML 文件,但它不太适合手动编辑。为什么不能安装 ReSharper 试用实例并配置所需的所有内容?