本文整理汇总了C#中IReportViolations类的典型用法代码示例。如果您正苦于以下问题:C# IReportViolations类的具体用法?C# IReportViolations怎么用?C# IReportViolations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReportViolations类属于命名空间,在下文中一共展示了IReportViolations类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseFlagsAttributeRule
public UseFlagsAttributeRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "D1019")
{
long mask = 1;
for (int i = 0; i < 63; ++i)
{
m_powers.Add(mask);
mask = mask << 1;
}
m_powers.Add(mask);
}
示例2: Rule
protected Rule(AssemblyCache cache, IReportViolations reporter, string checkID)
{
DBC.Pre(cache != null, "cache is null");
DBC.Pre(reporter != null, "reporter is null");
DBC.Pre(!string.IsNullOrEmpty(checkID), "checkID is null or empty");
Cache = cache;
Reporter = reporter;
CheckID = checkID;
Runtime = TargetRuntime.NET_1_0;
}
示例3: NonLocalizedGuiRule
public NonLocalizedGuiRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "G1002")
{
m_enabled = Settings.Get("*localized*", "true") == "true";
Log.TraceLine(this, "enabled: {0}", m_enabled);
string custom = Settings.Get("localize", string.Empty);
foreach (string name in custom.Split(';'))
{
Log.TraceLine(this, "using custom: {0}", name);
m_custom.Add(" " + name + "("); // add some goo so we match only what we should
}
}
示例4: OperatorAlternativeRule
public OperatorAlternativeRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "D1033")
{
m_table.Add("op_Addition", "Add");
m_table.Add("op_Subtraction", "Subtract");
m_table.Add("op_Multiply", "Multiply");
m_table.Add("op_Division", "Divide");
m_table.Add("op_Modulus", "Mod");
m_table.Add("op_GreaterThan", "Compare");
m_table.Add("op_GreaterThanOrEqual", "Compare");
m_table.Add("op_LessThan", "Compare");
m_table.Add("op_LessThanOrEqual", "Compare");
m_table.Add("op_Inequality", "Equals");
m_table.Add("op_Equality", "Equals");
}
示例5: SpecialFolderRule
public SpecialFolderRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "PO1003")
{
string user = Environment.UserName;
Array values = Enum.GetValues(typeof(Environment.SpecialFolder));
foreach (object o in values)
{
Environment.SpecialFolder name = (Environment.SpecialFolder) o;
string path = Environment.GetFolderPath(name);
if (path.Length > 0)
{
path = path.Replace(user, "*");
if (!m_globs.ContainsKey(name))
m_globs.Add(name, path.Split(Path.DirectorySeparatorChar));
}
}
}
示例6: NoStaticRemoveRule
public NoStaticRemoveRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "C1026")
{
// Collections.Generic
m_adders.Add ("System.Collections.Generic.Dictionary`", new List<string>{"Add", "set_Item"});
m_removers.Add("System.Collections.Generic.Dictionary`", new List<string>{"Clear", "Remove"});
m_adders.Add ("System.Collections.Generic.HashSet`", new List<string>{"Add", "UnionWith"});
m_removers.Add("System.Collections.Generic.HashSet`", new List<string>{"Clear", "ExceptWith", "IntersectWith", "Remove", "RemoveWhere", "SymmetricExceptWith"});
m_adders.Add ("System.Collections.Generic.List`", new List<string>{"Add", "AddRange", "Insert", "InsertRange"});
m_removers.Add("System.Collections.Generic.List`", new List<string>{"Clear", "Remove", "RemoveAll", "RemoveAt", "RemoveRange"});
m_adders.Add ("System.Collections.Generic.Queue`", new List<string>{"Enqueue"});
m_removers.Add("System.Collections.Generic.Queue`", new List<string>{"Clear", "Dequeue"});
m_adders.Add ("System.Collections.Generic.SortedDictionary`", new List<string>{"Add", "set_Item"});
m_removers.Add("System.Collections.Generic.SortedDictionary`", new List<string>{"Clear", "Remove"});
m_adders.Add ("System.Collections.Generic.Stack`", new List<string>{"Push"});
m_removers.Add("System.Collections.Generic.Stack`", new List<string>{"Clear", "Pop"});
// Collections
m_adders.Add ("System.Collections.ArrayList", new List<string>{"Add", "AddRange", "Insert", "InsertRange"});
m_removers.Add("System.Collections.ArrayList", new List<string>{"Clear", "Remove", "RemoveAt", "RemoveRange"});
m_adders.Add ("System.Collections.Hashtable", new List<string>{"Add", "set_Item"});
m_removers.Add("System.Collections.Hashtable", new List<string>{"Clear", "Remove"});
m_adders.Add ("System.Collections.Queue", new List<string>{"Enqueue"});
m_removers.Add("System.Collections.Queue", new List<string>{"Clear", "Dequeue"});
m_adders.Add ("System.Collections.SortedList", new List<string>{"Add", "set_Item"});
m_removers.Add("System.Collections.SortedList", new List<string>{"Clear", "Remove", "RemoveAt"});
}
示例7: OnCreate
protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
{
return new EventHandlerRule(cache, reporter);
}
示例8: OnCreate
protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
{
return new OptionalSerializationRule(cache, reporter);
}
示例9: OnCreate
protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
{
return new SealedInheritanceDemandRule(cache, reporter);
}
示例10: DllImportExtensionRule
public DllImportExtensionRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "PO1002")
{
}
示例11: PrivateNeedsDoRule
// The checkID must match the id in the xml. Note that multiple classes can
// share the same checkID.
public PrivateNeedsDoRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "CU1000 - example custom rules")
{
}
示例12: CompareFloatsRule
// This is inspired by the Gendarme rule authored by Lukasz Knop
// although the code is completely different.
public CompareFloatsRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "R1009")
{
}
示例13: NullFieldRule
public NullFieldRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "C1017")
{
}
示例14: StringSpellingRule
public StringSpellingRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "C1000")
{
}
示例15: ThrowDerivedRule
public ThrowDerivedRule(AssemblyCache cache, IReportViolations reporter)
: base(cache, reporter, "MS1012")
{
}