示例#1
0
        private static double CalculateSeverity(int cint, double cdisp)
        {
            var severityCdisp = LinearNormalization.WithMeasurementRange(3, 9).ValueFor(cdisp);
            var severityCint  = LinearNormalization.WithMeasurementRange(7, 21).ValueFor(cint);

            return((3 * severityCdisp + severityCint) / 4);
        }
示例#2
0
        private static double CalculateSeverity(double bur, double bovr)
        {
            var severityBur  = LinearNormalization.WithMeasurementRange(0.75, 1).ValueFor(1 - bur);
            var severityBovr = LinearNormalization.WithMeasurementRange(0.75, 1).ValueFor(1 - bovr);

            return((severityBur + severityBovr) / 2);
        }
示例#3
0
        private static double CalculateSeverity(uint loc, ushort cyclo, ushort maxNesting)
        {
            var severityCyclo   = LinearNormalization.WithMeasurementRange(3, 15).ValueFor(cyclo);
            var severityNesting = LinearNormalization.WithMeasurementRange(3, 7).ValueFor(maxNesting);
            var severityLoc     = LinearNormalization.WithMeasurementRange(100, 500).ValueFor(loc);

            return((2 * severityCyclo + 2 * severityNesting + severityLoc) / 5);
        }
示例#4
0
        private static double CalculateSeverity(int icio, int icdo, IMethod method)
        {
            var severityIcio = LinearNormalization.WithMeasurementRange(7, 21).ValueFor(icio);
            var severityIcdo = LinearNormalization.WithMeasurementRange(3, 9).ValueFor(icdo);

            var ocio         = CouplingIntensity.Value(method);
            var severityOcio = LinearNormalization.WithMeasurementRange(7, 21).ValueFor(ocio);

            var ocdo         = CouplingDispersion.Value(method);
            var severityOcdo = LinearNormalization.WithMeasurementRange(3, 9).ValueFor(ocdo);

            return((2 * severityIcio + 2 * severityIcdo + severityOcio + severityOcdo) / 6);
        }
示例#5
0
        private static double CalculateSeverity(IMethod method)
        {
            List <Tuple <IType, IList <IMethod> > > relevantCouplingIntensityPerProvider =
                method.CouplingIntensityPerProvider().Where(t => t.Item2.Count >= 7).ToList();

            var relevantOcio         = relevantCouplingIntensityPerProvider.Sum(g => g.Item2.Count);
            var severityRelevantOcio = LinearNormalization.WithMeasurementRange(7, 21).ValueFor(relevantOcio);

            var relevantOcdo         = relevantCouplingIntensityPerProvider.Count;
            var severityRelevantOcdo = LinearNormalization.WithMeasurementRange(1, 4).ValueFor(relevantOcdo);

            return((2 * severityRelevantOcio + severityRelevantOcdo) / 3);
        }
示例#6
0
        private static double SeverityExploit(IList <IMember> publicAttributes, IList <IMember> accessors, IType type)
        {
            HashSet <IMethod> methodsUsingPublicAttributes =
                publicAttributes.Select(pa => pa.AsField).SelectMany(f => f.MethodsUsingMe).ToHashSetEx();
            HashSet <IMethod> methodsUsingAccessors =
                accessors.Select(a => a.AsMethod).SelectMany(m => m.MethodsCallingMe).ToHashSetEx();

            var methodsUsingData = methodsUsingAccessors.Concat(methodsUsingPublicAttributes);

            HashSet <IType> classesUsingPublicData = methodsUsingData.Select(m => m.ParentType).ToHashSetEx();

            classesUsingPublicData.Remove(type);

            return(LinearNormalization.WithMeasurementRange(2, 10).ValueFor(classesUsingPublicData.Count));
        }
示例#7
0
 private static double SeverityExposure(IList <IMember> publicAttributes, IList <IMember> accessors)
 {
     return(LinearNormalization.WithMeasurementRange(Few, 20).ValueFor(publicAttributes.Count + accessors.Count));
 }
示例#8
0
 private static double CalculateSeverity(int nopOverridingMethods)
 {
     return(LinearNormalization.WithMeasurementRange(1, 10).ValueFor(2 * nopOverridingMethods));
 }
示例#9
0
 private static double CalculateSeverity(int atfd)
 {
     return(LinearNormalization.WithMeasurementRange(Few, 20).ValueFor(atfd));
 }