microting/eform-sdk-dotnet

View on GitHub

Showing 886 of 3,221 total issues

Method SettingCreate has 219 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public async Task<bool> SettingCreate(Settings name)
        {
            await using var db = GetContext();
            //key point
            // Id = settings.name
Severity: Major
Found in eFormCore/Infrastructure/SqlController.cs - About 1 day to fix

    Method DbSetup has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring.
    Open

            public async Task<string> DbSetup(string token)
            {
                // try
                // {
                DbContextHelper dbContextHelper = new DbContextHelper(connectionString);
    Severity: Minor
    Found in eFormCore/AdminTools.cs - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Consider simplifying this complex logical expression.
    Open

                        if (searchKey.Contains("!"))
                        {
                            searchKey = searchKey.ToLower().Replace("!", "");
                            IQueryable<Case> excludeQuery = db.Cases.AsNoTracking().Where(x =>
                                x.DoneAtUserModifiable > start && x.DoneAtUserModifiable < end);
    Severity: Critical
    Found in eFormCore/Infrastructure/SqlController.cs - About 1 day to fix

      Method Down has 216 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected override void Down(MigrationBuilder migrationBuilder)
              {
                  migrationBuilder.DropForeignKey(
                      name: "FK_folders_folders_parentId",
                      table: "folders");
      Severity: Major
      Found in eFormCore/Migrations/20190509074123_RefactoringidtoId.cs - About 1 day to fix

        Method Fields_Create_DoesCreate has 215 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                [Test]
                public async Task Fields_Create_DoesCreate()
                {
                    short shortMinValue = Int16.MinValue;
                    short shortmaxValue = Int16.MaxValue;
        Severity: Major
        Found in eFormSDK.CheckLists.Tests/FieldsUTest.cs - About 1 day to fix

          Method GetDataItem has 212 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private async Task GetDataItem(List<DataItem> lstDataItem, List<DataItemGroup> lstDataItemGroup, Field field,
                      Language language, bool includeDummyFields)
                  {
                      string methodName = "SqlController.GetDataItem";
                      try
          Severity: Major
          Found in eFormCore/Infrastructure/SqlController.cs - About 1 day to fix

            Method SQL_Template_TemplateItemReadAll_DoesSortAccordingly has 211 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    [Test]
                    public async Task SQL_Template_TemplateItemReadAll_DoesSortAccordingly()
                    {
                        // Arrance
            
            

              Method Up has 211 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      protected override void Up(MigrationBuilder migrationBuilder)
                      {
                          migrationBuilder.CreateIndex(
                              name: "IX_survey_configuration_versions_surveyConfigurationId",
                              table: "survey_configuration_versions",
              Severity: Major
              Found in eFormCore/Migrations/20190319130214_AddingMissingForeignKeys.cs - About 1 day to fix

                File ReportHelper.cs has 518 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using System;
                using System.Collections.Generic;
                using System.Diagnostics;
                using System.IO;
                using System.Linq;
                Severity: Major
                Found in eFormCore/Helpers/ReportHelper.cs - About 1 day to fix

                  Method TemplateItemRead has 208 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public async Task<Template_Dto> TemplateItemRead(int templateId, Language language)
                          {
                              string methodName = "SqlController.TemplateItemRead";
                  
                              try
                  Severity: Major
                  Found in eFormCore/Infrastructure/SqlController.cs - About 1 day to fix

                    Method Cases_Update_DoesUpdate has 205 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            [Test]
                            public async Task Cases_Update_DoesUpdate()
                            {
                                //Arrange
                    
                    
                    Severity: Major
                    Found in eFormSDK.CheckLists.Tests/CasesUTest.cs - About 1 day to fix

                      Method FieldValues_Create_DoesCreate has 204 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              [Test]
                              public async Task FieldValues_Create_DoesCreate()
                              {
                                  short shortMinValue = Int16.MinValue;
                                  short shortmaxValue = Int16.MaxValue;
                      Severity: Major
                      Found in eFormSDK.CheckLists.Tests/FieldValuesUTest.cs - About 1 day to fix

                        Method SaveAnswer has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
                        Open

                                private async Task SaveAnswer(JToken subItem, int questionSetId)
                                {
                                    Log.LogStandard("Core.SaveAnswer", $"called {DateTime.UtcNow}");
                                    var settings = new JsonSerializerSettings { Error = (se, ev) => { ev.ErrorContext.Handled = true; } };
                                    await using (var db = DbContextHelper.GetDbContext())
                        Severity: Minor
                        Found in eFormCore/Core.cs - About 1 day to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Class HttpFake has 56 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            public class HttpFake : IHttp
                            {
                                // var
                        //        private string protocolXml = "6";
                        
                        
                        Severity: Major
                        Found in eFormCore/Communication/HttpFake.cs - About 1 day to fix

                          Method Up has 199 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  protected override void Up(MigrationBuilder migrationBuilder)
                                  {
                                      //Setup for SQL Server Provider
                                     
                                      string autoIDGenStrategy = "SqlServer:ValueGenerationStrategy";
                          Severity: Major
                          Found in eFormCore/Migrations/20200120164857_AddingTranslationsToInSight.cs - About 7 hrs to fix

                            Method TemplateItemReadAll has 197 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    public async Task<List<Template_Dto>> TemplateItemReadAll(bool includeRemoved, string siteWorkflowState,
                                        string searchKey, bool descendingSort, string sortParameter, List<int> tagIds, TimeZoneInfo timeZoneInfo,
                                        Language language)
                                    {
                                        string methodName = "SqlController.TemplateItemReadAll";
                            Severity: Major
                            Found in eFormCore/Infrastructure/SqlController.cs - About 7 hrs to fix

                              Class Http has 55 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                  public class Http : IHttp
                                  {
                                      private const string ProtocolXml = "6";
                                      private const string ProtocolEntitySearch = "1";
                                      private const string ProtocolEntitySelect = "4";
                              Severity: Major
                              Found in eFormCore/Communication/Http.cs - About 7 hrs to fix

                                Method CheckLists_Delete_DoesSetWorkflowStateToRemoved has 186 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        [Test]
                                        public async Task CheckLists_Delete_DoesSetWorkflowStateToRemoved()
                                        {
                                            //Arrange
                                
                                
                                Severity: Major
                                Found in eFormSDK.CheckLists.Tests/CheckListsUTest.cs - About 7 hrs to fix

                                  Method DbSetup has 185 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          public async Task<string> DbSetup(string token)
                                          {
                                              // try
                                              // {
                                              DbContextHelper dbContextHelper = new DbContextHelper(connectionString);
                                  Severity: Major
                                  Found in eFormCore/AdminTools.cs - About 7 hrs to fix

                                    Method Down has 184 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            protected override void Down(MigrationBuilder migrationBuilder)
                                            {
                                                migrationBuilder.DropTable(
                                                    name: "CheckLisTranslations");
                                    
                                    
                                    Severity: Major
                                    Found in eFormCore/Migrations/20201223104631_AddingTranslations.cs - About 7 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language