Пример #1
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            #region METHODS

            if (reportData?.CurrentSnapshot == null)
            {
                return(null);
            }
            double?codeLineNumber    = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);
            double?fileNumber        = MeasureUtility.GetFileNumber(reportData.CurrentSnapshot);
            double?classNumber       = MeasureUtility.GetClassNumber(reportData.CurrentSnapshot);
            double?sqlArtifactNumber = MeasureUtility.GetSqlArtifactNumber(reportData.CurrentSnapshot);
            double?tableNumber       = MeasureUtility.GetTableNumber(reportData.CurrentSnapshot);

            const string noData       = Constants.No_Value;
            const string metricFormat = "N0";
            var          rowData      = new List <string> {
                Labels.Name, Labels.Value
                , Labels.kLoC, (codeLineNumber / 1000)?.ToString(metricFormat) ?? noData
                , "  " + Labels.Files, fileNumber?.ToString(metricFormat) ?? noData
                , "  " + Labels.Classes, classNumber?.ToString(metricFormat) ?? noData
                , Labels.ArtifactsSQL, sqlArtifactNumber?.ToString(metricFormat) ?? noData
                , "  " + Labels.Tables, tableNumber?.ToString(metricFormat) ?? noData
            };
            var resultTable = new TableDefinition {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = 6,
                NbColumns        = 2,
                Data             = rowData
            };
            return(resultTable);
        }
Пример #2
0
        protected override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            #region METHODS
            TableDefinition resultTable = null;
            if (null != reportData &&
                null != reportData.CurrentSnapshot)
            {
                double?codeLineNumber    = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);
                double?fileNumber        = MeasureUtility.GetFileNumber(reportData.CurrentSnapshot);
                double?classNumber       = MeasureUtility.GetClassNumber(reportData.CurrentSnapshot);
                double?sqlArtifactNumber = MeasureUtility.GetSqlArtifactNumber(reportData.CurrentSnapshot);
                double?tableNumber       = MeasureUtility.GetTableNumber(reportData.CurrentSnapshot);

                const string noData       = Constants.No_Data;
                const string metricFormat = "N0";
                var          rowData      = new List <string>()
                {
                    Labels.Name, Labels.Value
                    , Labels.kLoC, (codeLineNumber.HasValue ? (codeLineNumber.Value / 1000).ToString(metricFormat) : noData)
                    , "  " + Labels.Files, (fileNumber.HasValue ? (fileNumber.Value).ToString(metricFormat) : noData)
                    , "  " + Labels.Classes, (classNumber.HasValue ? (classNumber.Value).ToString(metricFormat) : noData)
                    , Labels.ArtifactsSQL, (sqlArtifactNumber.HasValue ? (sqlArtifactNumber.Value).ToString(metricFormat) : noData)
                    , "  " + Labels.Tables, (tableNumber.HasValue ? (tableNumber.Value).ToString(metricFormat) : noData)
                };
                resultTable = new TableDefinition {
                    HasRowHeaders    = false,
                    HasColumnHeaders = true,
                    NbRows           = 6,
                    NbColumns        = 2,
                    Data             = rowData
                };
            }
            return(resultTable);
        }
Пример #3
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            bool hasPrevious = reportData.PreviousSnapshot != null;

            if (reportData?.CurrentSnapshot == null)
            {
                return(null);
            }

            #region CastComputing

            double?codeLineNumber    = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);
            double?fileNumber        = MeasureUtility.GetFileNumber(reportData.CurrentSnapshot);
            double?classNumber       = MeasureUtility.GetClassNumber(reportData.CurrentSnapshot);
            double?sqlArtifactNumber = MeasureUtility.GetSqlArtifactNumber(reportData.CurrentSnapshot);
            double?tableNumber       = MeasureUtility.GetTableNumber(reportData.CurrentSnapshot);

            double?codeLineNumberPrev    = MeasureUtility.GetCodeLineNumber(reportData.PreviousSnapshot);
            double?fileNumberPrev        = MeasureUtility.GetFileNumber(reportData.PreviousSnapshot);
            double?classNumberPrev       = MeasureUtility.GetClassNumber(reportData.PreviousSnapshot);
            double?sqlArtifactNumberPrev = MeasureUtility.GetSqlArtifactNumber(reportData.PreviousSnapshot);
            double?tableNumberPrev       = MeasureUtility.GetTableNumber(reportData.PreviousSnapshot);



            double?codeLineNumberEvol    = MathUtility.GetEvolution(codeLineNumber, codeLineNumberPrev);
            double?fileNumberEvol        = MathUtility.GetEvolution(fileNumber, fileNumberPrev);
            double?classNumberEvol       = MathUtility.GetEvolution(classNumber, classNumberPrev);
            double?sqlArtifactNumberEvol = MathUtility.GetEvolution(sqlArtifactNumber, sqlArtifactNumberPrev);
            double?tableNumberEvol       = MathUtility.GetEvolution(tableNumber, tableNumberPrev);


            double?codeLineNumberPercent    = MathUtility.GetPercent(codeLineNumberEvol, codeLineNumberPrev);
            double?fileNumberPercent        = MathUtility.GetPercent(fileNumberEvol, fileNumberPrev);
            double?classNumberPercent       = MathUtility.GetPercent(classNumberEvol, classNumberPrev);
            double?sqlArtifactNumberPercent = MathUtility.GetPercent(sqlArtifactNumberEvol, sqlArtifactNumberPrev);
            double?tableNumberPercent       = MathUtility.GetPercent(tableNumberEvol, tableNumberPrev);

            #endregion CastComputing

            const string noData       = Constants.No_Value;
            const string metricFormat = "N0";

            var rowData = new List <string>()
            {
                Labels.Name, Labels.Current, Labels.Previous, Labels.Evolution, Labels.EvolutionPercent

                , Labels.LoC
                , codeLineNumber?.ToString(metricFormat) ?? noData
                , codeLineNumberPrev?.ToString(metricFormat) ?? noData
                , hasPrevious? FormatEvolution((int)codeLineNumberEvol.Value) : noData
                , (codeLineNumberPercent.HasValue)? FormatPercent(codeLineNumberPercent.Value): noData

                , "   " + Labels.Files
                , fileNumber?.ToString(metricFormat) ?? noData
                , fileNumberPrev?.ToString(metricFormat) ?? noData
                , hasPrevious? FormatEvolution((int)fileNumberEvol.Value) : noData
                , (fileNumberPercent.HasValue)? FormatPercent(fileNumberPercent.Value): noData

                , "   " + Labels.Classes
                , classNumber?.ToString(metricFormat) ?? noData
                , classNumberPrev?.ToString(metricFormat) ?? noData
                , hasPrevious? FormatEvolution((int)classNumberEvol.Value) : noData
                , (classNumberPercent.HasValue)? FormatPercent(classNumberPercent.Value): noData

                , Labels.ArtifactsSQL
                , sqlArtifactNumber?.ToString(metricFormat) ?? noData
                , sqlArtifactNumberPrev?.ToString(metricFormat) ?? noData
                , hasPrevious? FormatEvolution((int)sqlArtifactNumberEvol.Value) : noData
                , (sqlArtifactNumberPercent.HasValue)? FormatPercent(sqlArtifactNumberPercent.Value): noData

                , "   " + Labels.Tables
                , tableNumber?.ToString(metricFormat) ?? noData
                , tableNumberPrev?.ToString(metricFormat) ?? noData
                , hasPrevious? FormatEvolution((int)tableNumberEvol.Value) : noData
                , (tableNumberPercent.HasValue)? FormatPercent(tableNumberPercent.Value): noData
            };

            var resultTable = new TableDefinition
            {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = 6,
                NbColumns        = 5,
                Data             = rowData
            };
            return(resultTable);
        }