public void Parse(string file) { using (XmlTextReader rdr = new XmlTextReader(file)) { foreach (XmlData data in XmlData.Read(rdr)) { _version = data.File.profilerVersion; _driverVersion = data.File.driverVersion; if (_when > data.File.startTime) _when = data.File.startTime; CodeMetric metric = new CodeMetric(data); if (ByFile.AddMetric(metric))//if this is a new statement { ByModule.AddMetric(metric); ByNamespace.AddMetric(metric); ByClass.AddMetric(metric); bool newMethod = ByMethod.AddMetric(metric); if (newMethod && Exclude(metric)) metric.Excluded = true; } } } }
public void Parse(string file) { using (XmlTextReader rdr = new XmlTextReader(file)) { foreach (XmlData data in XmlData.Read(rdr)) { _version = data.File.profilerVersion; _driverVersion = data.File.driverVersion; if (_when > data.File.startTime) { _when = data.File.startTime; } CodeMetric metric = new CodeMetric(data); if (ByFile.AddMetric(metric)) //if this is a new statement { ByModule.AddMetric(metric); ByNamespace.AddMetric(metric); ByClass.AddMetric(metric); bool newMethod = ByMethod.AddMetric(metric); if (newMethod && Exclude(metric)) { metric.Excluded = true; } } } } }
public void QuandoEsseFiltroRelaciona(string tipo) { var type = Type.GetType(tipo); type.Should().Not.Be.Null(); resultingMetric = ((Ce)resultingMetric).Ignoring(type); }
public void StartItem(MetricGroup group, MetricCounter item) { Check.IsEqual("module", group.Name); CodeMetric info = item.Group; WriteLine("<module moduleId='{0}' name='{1}' assembly='{2}' assemblyIdentity='{3}'>", _moduleId++, XmlEncode(info.FileName), XmlEncode(info.AssemblyName), XmlEncode(info.AssemblyFullName) ); }
private bool Exclude(CodeMetric metric) { foreach (Regex regex in _excluded) { foreach (string fmtName in new string[] { "{0}.{1}", "{0}.{1}.{2}" }) { string fullname = String.Format(fmtName, metric.Namespace, metric.Class, metric.MethodName); if (regex.IsMatch(fullname)) { //Log.Info("Ignoring '{0}' from rule '{1}'", fullname, regex.ToString()); return(true); } } } return(false); }
void WriteItem(MetricGroup group, MetricCounter item, bool close) { CodeMetric info = item.Group; List <CodeMetric> seqpnts = item.Seqpnts; bool anyInstruments = false; bool allExcluded = true; foreach (CodeMetric metric in seqpnts) { anyInstruments |= metric.Instrumented; allExcluded &= metric.Excluded; } WriteLine("<method name='{0}' excluded='{5}' instrumented='{4}' class='{1}{2}{3}'>", XmlEncode(info.MethodName), XmlEncode(info.Namespace), String.IsNullOrEmpty(info.Namespace) ? String.Empty : ".", XmlEncode(info.Class), anyInstruments ? TRUE : FALSE, allExcluded ? TRUE : FALSE ); foreach (CodeMetric metric in seqpnts) { if (metric.Excluded) { continue; } WriteLine("<seqpnt visitcount='{0}' line='{1}' column='{2}' endline='{3}' endcolumn='{4}' excluded='{5}' document='{6}' />", metric.VisitCount, metric.Line, metric.Column, metric.EndLine, metric.EndColumn, metric.Excluded ? TRUE : FALSE, XmlEncode(metric.SrcFile) ); } WriteLine("</method>"); }
public CyclomaticComplexityMetricResult(Declaration declaration, CodeMetric metricReference, int value) : base(declaration, metricReference) { this.value = value; }
public void QuandoDesejoObterSuaComplexidadeCiclomaticaCc() { resultingMetric = Cc.For(workingMethod); }
public void DadoQueDesejoObterOAcoplamentoEferenteDeTodosOsTiposDesseAssembly() { resultingMetric = Ce.For(GetType().Assembly); }
public override string NameOfGroupItem(CodeMetric obj) { return String.Format("{0}.{1}", base.NameOfGroupItem(obj), obj.Class); }
public string NameOfGroupItem(CodeMetric obj) { return obj.SrcFile; }
public virtual int Compare(CodeMetric x, CodeMetric y) { return StringComparer.Ordinal.Compare(x.Namespace, y.Namespace); }
public override int Compare(CodeMetric x, CodeMetric y) { int result = base.Compare(x, y); return result != 0 ? result : StringComparer.Ordinal.Compare(x.MethodName, y.MethodName); }
public override int GetHashCode(CodeMetric obj) { return (base.GetHashCode(obj) & 0x4FFFFFFF) + StringComparer.Ordinal.GetHashCode(obj.MethodName); }
public override bool Equals(CodeMetric x, CodeMetric y) { return base.Equals(x, y) && StringComparer.Ordinal.Equals(x.MethodName, y.MethodName); }
public void QuandoConsideroAsReferenciasVindasDoAssembly(string nomeDoAssemblyExterno) { Assembly assemblyExterno = Assembly.Load(nomeDoAssemblyExterno); resultingMetric = ((Ca)resultingMetric).Including(assemblyExterno); }
public void DesejoIgnorarReferenciasParaTiposDeOutrosAssemblies() { resultingMetric = ((Ce)resultingMetric).Ignoring(GetType().Assembly.Not()); }
public void QuandoDesejoObterSeuAcoplamentoEferente() { resultingMetric = Ce.For(workingType); }
public bool Equals(CodeMetric x, CodeMetric y) { return StringComparer.OrdinalIgnoreCase.Equals(x.SrcFile, y.SrcFile); }
public virtual bool Equals(CodeMetric x, CodeMetric y) { return StringComparer.Ordinal.Equals(x.Namespace, y.Namespace); }
public virtual int GetHashCode(CodeMetric obj) { return StringComparer.Ordinal.GetHashCode(obj.Namespace); }
public void QuandoDesejoObterAComplexidadeCiclomaticaDeSeuConstrutor() { ConstructorInfo constructor = workingType.GetConstructor(new Type[0]); resultingMetric = Cc.For(constructor); }
public override bool Equals(CodeMetric x, CodeMetric y) { return base.Equals(x, y) && StringComparer.Ordinal.Equals(x.Class, y.Class); }
public int Compare(CodeMetric x, CodeMetric y) { return StringComparer.OrdinalIgnoreCase.Compare(x.SrcFile, y.SrcFile); }
public void DadoDesejoIgnorarReferenciasParaTiposDesteAssembly() { resultingMetric = ((Ce)resultingMetric).Ignoring(GetType().Assembly); }
public void QuandoDesejoObterSeuAcoplamentoAferente() { resultingMetric = Ca.For(workingType); }
public int GetHashCode(CodeMetric obj) { return StringComparer.OrdinalIgnoreCase.GetHashCode(obj.SrcFile); }
public string NameOfGroupItem(CodeMetric obj) { return obj.AssemblyName; }
public bool Equals(CodeMetric x, CodeMetric y) { return StringComparer.Ordinal.Equals(x.AssemblyName, y.AssemblyName); }
private bool Exclude(CodeMetric metric) { foreach (Regex regex in _excluded) { foreach( string fmtName in new string[] { "{0}.{1}", "{0}.{1}.{2}" } ) { string fullname = String.Format(fmtName, metric.Namespace, metric.Class, metric.MethodName); if (regex.IsMatch(fullname)) { //Log.Info("Ignoring '{0}' from rule '{1}'", fullname, regex.ToString()); return true; } } } return false; }
public int Compare(CodeMetric x, CodeMetric y) { return StringComparer.Ordinal.Compare(x.AssemblyName, y.AssemblyName); }
public int GetHashCode(CodeMetric obj) { return StringComparer.Ordinal.GetHashCode(obj.AssemblyName); }
public virtual string NameOfGroupItem(CodeMetric obj) { return obj.Namespace; }
public CyclomaticComplexityListener(CodeMetric owner) : base(owner) { }