fxcop-customrules

Static code analysis not working for custom ruleset

本小妞迷上赌 提交于 2021-01-07 06:37:44
问题 We are trying to have our own custom ruleset which we can apply during build process. For this I've created custom rule and custom ruleset but analysis doesn't work however I've tested the rule using Debug--> Start External program and it produced correct xml Already placed rule dll and ruleset inside fxcop rule and ruleset folder Rule XML <?xml version="1.0" encoding="utf-8" ?> <Rules> <Rule TypeName="CustomRule" Category="Performance" CheckId="R001" > <Name>AvoidUsingVirtualMethods</Name>

Static code analysis not working for custom ruleset

痞子三分冷 提交于 2021-01-07 06:33:22
问题 We are trying to have our own custom ruleset which we can apply during build process. For this I've created custom rule and custom ruleset but analysis doesn't work however I've tested the rule using Debug--> Start External program and it produced correct xml Already placed rule dll and ruleset inside fxcop rule and ruleset folder Rule XML <?xml version="1.0" encoding="utf-8" ?> <Rules> <Rule TypeName="CustomRule" Category="Performance" CheckId="R001" > <Name>AvoidUsingVirtualMethods</Name>

Custom Rule in FxCop to only apply to methods called by particular type's method

南笙酒味 提交于 2019-12-22 06:57:45
问题 I want to create an FxRule that applies a method, only if the method gets called from a specific class. NOTE: I don't want to just apply a rule to a method of a particular class, i want to be able to handle methods calling other methods calling other methods which do the boxing. I'd like to get FxCop to report problems associated with the method that does the boxing. Below is the code i have so far: using System; using System.Linq; using Microsoft.FxCop.Sdk; using System.Collections.Generic;

FxCop: custom rule for checking assembly info values

筅森魡賤 提交于 2019-12-19 18:29:57
问题 Is there a reasonably simple way to get FxCop to check that all my assemblies declare a particular attribute value? I want to make sure everyone has changed the default you get on creating a project: [assembly: AssemblyCompany("Microsoft")] // fail [assembly: AssemblyCompany("FooBar Inc.")] // pass 回答1: This is actually a pretty easy rule once you know that FxCop's "largest" analysis target is a module, not an assembly. In most cases, there is one module per assembly, so this won't pose a

Custom Rule in FxCop to only apply to methods called by particular type's method

元气小坏坏 提交于 2019-12-05 10:18:05
I want to create an FxRule that applies a method, only if the method gets called from a specific class. NOTE: I don't want to just apply a rule to a method of a particular class, i want to be able to handle methods calling other methods calling other methods which do the boxing. I'd like to get FxCop to report problems associated with the method that does the boxing. Below is the code i have so far: using System; using System.Linq; using Microsoft.FxCop.Sdk; using System.Collections.Generic; class CheckUpdatableComponents : BaseIntrospectionRule { private string[] MethodsToCheck = new string[]