当前位置: 首页>>代码示例>>C#>>正文


C# IReportViolations类代码示例

本文整理汇总了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);
		}
开发者ID:dbremner,项目名称:smokey,代码行数:11,代码来源:UseFlagsAttributeRule.cs

示例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;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:11,代码来源:Rule.cs

示例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
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:13,代码来源:NonLocalizedGuiRule.cs

示例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");
		}
开发者ID:dbremner,项目名称:smokey,代码行数:15,代码来源:OperatorAlternativeRule.cs

示例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));
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:18,代码来源:SpecialFolderRule.cs

示例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"});
			
		}
开发者ID:dbremner,项目名称:smokey,代码行数:36,代码来源:NoStaticRemoveRule.cs

示例7: OnCreate

 protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
 {
     return new EventHandlerRule(cache, reporter);
 }
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:EventHandlerTest.cs

示例8: OnCreate

 protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
 {
     return new OptionalSerializationRule(cache, reporter);
 }
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:OptionalSerializationTest.cs

示例9: OnCreate

 protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
 {
     return new SealedInheritanceDemandRule(cache, reporter);
 }
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:SealedInheritanceDemandTest.cs

示例10: DllImportExtensionRule

		public DllImportExtensionRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "PO1002")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:DllImportExtensionRule.cs

示例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")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:6,代码来源:PrivateNeedsDoRule.cs

示例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")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:6,代码来源:CompareFloatsRule.cs

示例13: NullFieldRule

		public NullFieldRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "C1017")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:NullFieldRule.cs

示例14: StringSpellingRule

		public StringSpellingRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "C1000")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:StringSpellingRule.cs

示例15: ThrowDerivedRule

		public ThrowDerivedRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "MS1012")
		{
		}
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:ThrowDerivedRule.cs


注:本文中的IReportViolations类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。