private bool DoIsVisible(TypeDefinition type) { bool visible = type.ExternallyVisible(Cache); Log.DebugLine(this, "{0}.visible = {1}", type.Name, visible); return visible; }
public void VisitType(TypeDefinition type) { if (type.ExternallyVisible(Cache)) { Log.DebugLine(this, "-----------------------------------"); Log.DebugLine(this, "checking {0}", type.Name); if (DoObsoleteTerm(type.Name)) { Reporter.TypeFailed(type, CheckID, string.Empty); } } }
public void VisitType(TypeDefinition type) { DBC.Assert(m_state == State.Types, "state is {0}", m_state); Log.DebugLine(this, "{0}", type.FullName); if (!type.ExternallyVisible(Cache) && DoInstantiable(type) && DoValidType(type)) { if (!type.IsCompilerGenerated()) { var key = new AssemblyCache.TypeKey(type); DBC.Assert(m_keys.IndexOf(key) < 0, "{0} is already in types", type.FullName); Log.DebugLine(this, "adding {0}", type.FullName); m_keys.Add(key); } } }
public void VisitType(TypeDefinition type) { if (type.BaseType != null && type.IsSubclassOf("System.Attribute", Cache)) { Log.DebugLine(this, "-----------------------------------"); Log.DebugLine(this, "checking {0}", type); if (!type.IsSealed && !type.IsAbstract) { if (type.ExternallyVisible(Cache)) { Log.DebugLine(this, "{0} has no usage attribute", type.Name); Reporter.TypeFailed(type, CheckID, string.Empty); } } } }
public void VisitType(TypeDefinition type) { if (!type.IsSealed && type.ExternallyVisible(Cache)) { Log.DebugLine(this, "-----------------------------------"); Log.DebugLine(this, "{0}", type); foreach (MethodDefinition method in type.Methods) { if (method.IsPrivate && !method.IsReuseSlot) { Log.DebugLine(this, "{0} is an explicit implementation", method); string name = method.Name.Substring(method.Name.LastIndexOf('.') + 1); bool found = false; MethodDefinition[] methods = type.Methods.GetMethod(name); foreach (MethodDefinition candidate in methods) { Log.DebugLine(this, " checking {0}", candidate); if (!candidate.IsPrivate) { Log.DebugLine(this, " it's an alternative"); found = true; break; } } if (!found) { string details = "Method: " + name; Reporter.TypeFailed(type, CheckID, details); break; } } } } }
public void VisitType(TypeDefinition candidate) { if (!candidate.IsAbstract && !candidate.ExternallyVisible(Cache) && candidate.IsClass && !candidate.IsSealed) { if (candidate.FullName != "<Module>" && !candidate.IsCompilerGenerated()) { Log.DebugLine(this, "checking {0}", candidate); foreach (TypeDefinition type in Cache.Types) { if (type.IsSubclassOf(candidate, Cache)) { // Log.DebugLine(this, " is base class for {0} [{1}]", type, type.BaseType); return; } // else // Log.DebugLine(this, " not a base class for {0} [{1}]", type, type.BaseType); } // Log.DebugLine(this, " failed"); Reporter.TypeFailed(candidate, CheckID, string.Empty); } } }
protected override bool OnNeedsCheck(TypeDefinition type, MethodDefinition method) { if (type.ExternallyVisible(Cache)) return method.IsAssembly; else return method.IsPublic || method.IsAssembly; }
protected override bool OnNeedsCheck(TypeDefinition type) { return type.ExternallyVisible(Cache); }
public void VisitType(TypeDefinition type) { if (type.ExternallyVisible(Cache)) { m_types.Add(type.FullName); if (m_namespaces.IndexOf(type.Namespace) < 0) // namespaces only matter if they have a public type m_namespaces.Add(type.Namespace); } }