microting/eform-sdk-dotnet

View on GitHub

Showing 3,203 of 3,219 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                        if (dataItem.Label.Split("|").Length > 2)
                        {
                            fieldTranslation = new FieldTranslation
                            {
                                LanguageId = deLanguage.Id,
Severity: Major
Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 3 hrs to fix
eFormCore/Infrastructure/SqlController.cs on lines 6185..6202

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 233.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method Core_Folders_CreateSubFolder_DoesCreateSubFolderWithTranslations has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        [Test]
        public async Task Core_Folders_CreateSubFolder_DoesCreateSubFolderWithTranslations()
        {
            // Arrange
Severity: Major
Found in eFormSDK.Integration.Base.CoreTests/CoreTestFolders.cs - About 3 hrs to fix

    Method GetAnswersForQuestionSet has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public async Task GetAnswersForQuestionSet(int? apiQuestionSetId)
            {
                if (apiQuestionSetId == null)
                    return;
    
    
    Severity: Major
    Found in eFormCore/Core.cs - About 3 hrs to fix

      Method UploadedData_Update_DoesUpdate has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method SQL_answers_Update_DoesUpdate_UTCAdjustedFalse has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                [Test]
                public async Task SQL_answers_Update_DoesUpdate_UTCAdjustedFalse()
                {
                    // Arrange
                    Random rnd = new Random();
        Severity: Major
        Found in eFormSDK.Integration.Tests/SqlControllerTestAnswer.cs - About 3 hrs to fix

          Method SiteCreate has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public async Task<SiteDto> SiteCreate(string name, string userFirstName, string userLastName, string userEmail,
                      string languageCode)
                  {
                      string methodName = "Core.SiteCreate";
                      await using var db = DbContextHelper.GetDbContext();
          Severity: Major
          Found in eFormCore/Core.cs - About 3 hrs to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                            constraints: table =>
                            {
                                table.PrimaryKey("PK_field_values", x => x.Id);
                                table.ForeignKey(
                                    name: "FK_field_values_check_lists_CheckListId",
            Severity: Major
            Found in eFormCore/Migrations/20201222125152_HugheTableRenaming.cs and 2 other locations - About 3 hrs to fix
            eFormCore/Migrations/20180810124416_InitialCreate.cs on lines 817..844
            eFormCore/Migrations/20180810124416_InitialCreate.cs on lines 1000..1027

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 228.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                            constraints: table =>
                            {
                                table.PrimaryKey("PK_field_values", x => x.id);
                                table.ForeignKey(
                                    name: "FK_field_values_check_lists_check_list_id",
            Severity: Major
            Found in eFormCore/Migrations/20180810124416_InitialCreate.cs and 2 other locations - About 3 hrs to fix
            eFormCore/Migrations/20180810124416_InitialCreate.cs on lines 817..844
            eFormCore/Migrations/20201222125152_HugheTableRenaming.cs on lines 1818..1845

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 228.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                            constraints: table =>
                            {
                                table.PrimaryKey("PK_cases", x => x.id);
                                table.ForeignKey(
                                    name: "FK_cases_check_lists_check_list_id",
            Severity: Major
            Found in eFormCore/Migrations/20180810124416_InitialCreate.cs and 2 other locations - About 3 hrs to fix
            eFormCore/Migrations/20180810124416_InitialCreate.cs on lines 1000..1027
            eFormCore/Migrations/20201222125152_HugheTableRenaming.cs on lines 1818..1845

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 228.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method Core_eForm_SimplePictureAndSignatureFormCreateInDB_ReturnseFormId has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    [Test]
                    public async Task Core_eForm_SimplePictureAndSignatureFormCreateInDB_ReturnseFormId()
                    {
                        // Arrange
                        string xmlstring = @"
            Severity: Major
            Found in eFormSDK.Integration.CheckLists.CoreTests/CoreTesteFormCreateInDB.cs - About 3 hrs to fix

              Method GetAllSurveyConfigurations has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
              Open

                      public async Task<bool> GetAllSurveyConfigurations()
                      {
                          var parsedData = JObject.Parse(await _communicator.GetAllSurveyConfigurations().ConfigureAwait(false));
              
                          var jsonSerializerSettings = new JsonSerializerSettings
              Severity: Minor
              Found in eFormCore/Core.cs - About 3 hrs 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

              Method CheckStatusByMicrotingUid has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
              Open

                      public async Task<bool> CheckStatusByMicrotingUid(int microtingUid)
                      {
                          string methodName = "Core.CheckStatusByMicrotingUid";
                          List<CaseDto> lstCase = new List<CaseDto>();
                          MainElement mainElement = new MainElement();
              Severity: Minor
              Found in eFormCore/Core.cs - About 3 hrs 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

              Method SQL_answers_Update_DoesUpdate_UTCAdjustedTrue has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [Test]
                      public async Task SQL_answers_Update_DoesUpdate_UTCAdjustedTrue()
                      {
                          // Arrange
                          Random rnd = new Random();
              Severity: Major
              Found in eFormSDK.Integration.Tests/SqlControllerTestAnswer.cs - About 3 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        [Test]
                        public async Task Core_EntitySearchItemDelete_DeletesEntitySearchItem()
                        {
                            // Arrance
                            EntityGroup eG1 = await testHelpers.CreateEntityGroup("microtingUIdC1", "EntityGroup1",
                Severity: Major
                Found in eFormSDK.Integration.Base.CoreTests/CoreTestEntity.cs and 1 other location - About 3 hrs to fix
                eFormSDK.Integration.Base.CoreTests/CoreTestEntity.cs on lines 2600..2616

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 224.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        [Test]
                        public async Task Core_EntitySelectItemDelete_DeletesEntitySelectItem()
                        {
                            // Arrance
                            EntityGroup eG1 = await testHelpers.CreateEntityGroup("microtingUIdC1", "EntityGroup1",
                Severity: Major
                Found in eFormSDK.Integration.Base.CoreTests/CoreTestEntity.cs and 1 other location - About 3 hrs to fix
                eFormSDK.Integration.Base.CoreTests/CoreTestEntity.cs on lines 2546..2562

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 224.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                File MainElement.cs has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using System;
                using System.Collections.Generic;
                using System.IO;
                using System.Text;
                using System.Xml.Serialization;
                Severity: Minor
                Found in eFormCore/Infrastructure/Models/MainElement.cs - About 3 hrs to fix

                  Method Core_Folders_UpdateFolder_DoesUpdateSingleFolderTranslation has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          [Test]
                          public async Task Core_Folders_UpdateFolder_DoesUpdateSingleFolderTranslation()
                          {
                              // Arrange
                  
                  Severity: Major
                  Found in eFormSDK.Integration.Base.CoreTests/CoreTestFolders.cs - About 3 hrs to fix

                    Method Units_Update_DoesUpdate has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            [Test]
                            public async Task Units_Update_DoesUpdate()
                            {
                                //Arrange
                    
                    
                    Severity: Major
                    Found in eFormSDK.Base.Tests/UnitsUTest.cs - About 3 hrs to fix

                      Method GenerateDataSetFromCasesSubSet has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private async Task<List<string>> GenerateDataSetFromCasesSubSet(List<string> lstReturn, int? checkListId,
                                  string preLabel, Language language, bool includeCheckListText)
                              {
                                  string sep = " / ";
                                  await using MicrotingDbContext dbContext = DbContextHelper.GetDbContext();
                      Severity: Major
                      Found in eFormCore/Core.cs - About 3 hrs to fix

                        Similar blocks of code found in 20 locations. Consider refactoring.
                        Open

                                    Question questionForAnswerValue = new Question
                                    {
                                        Image = randomBool,
                                        Maximum = rnd.Next(1, 255),
                                        Minimum = rnd.Next(1, 255),
                        Severity: Major
                        Found in eFormSDK.InSight.Tests/AnswerValuesUTest.cs and 19 other locations - About 3 hrs to fix
                        eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 114..132
                        eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 146..164
                        eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 285..303
                        eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 317..335
                        eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 476..494
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 33..51
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 112..130
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 200..218
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 221..239
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 330..348
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 351..369
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 457..475
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 478..496
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 589..607
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 610..628
                        eFormSDK.InSight.Tests/QuestionTranslationUTest.cs on lines 709..727
                        eFormSDK.InSight.Tests/QuestionsUTest.cs on lines 59..77
                        eFormSDK.InSight.Tests/QuestionsUTest.cs on lines 155..173
                        eFormSDK.InSight.Tests/QuestionsUTest.cs on lines 306..324

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 220.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language