microting/eform-sdk-dotnet

View on GitHub

Showing 3,203 of 3,219 total issues

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

            migrationBuilder.CreateTable(
                name: "LanguageQuestionSets",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
eFormCore/Migrations/20190806093044_AddingSiteGroups.cs on lines 85..113
eFormCore/Migrations/20200116074236_AddingSiteTaggins.cs on lines 109..137

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 336.

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 StartSqlOnly has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
Open

        public async Task<bool> StartSqlOnly(string connectionString)
        {
            string methodName = "Core.StartSqlOnly";
            try
            {
Severity: Minor
Found in eFormCore/Core.cs - About 5 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 CheckListValues_Update_DoesUpdate has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        [Test]
        public async Task CheckListValues_Update_DoesUpdate()
        {
            //Arrange

Severity: Major
Found in eFormSDK.CheckLists.Tests/CheckListValuesUTest.cs - About 5 hrs to fix

    Method Questions_Update_DoesUpdate has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            [Test]
            public async Task Questions_Update_DoesUpdate()
            {
                //Arrange
    
    
    Severity: Major
    Found in eFormSDK.InSight.Tests/QuestionsUTest.cs - About 5 hrs to fix

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

                  modelBuilder.Entity("Microting.eForm.Infrastructure.Data.Entities.option_versions", b =>
                      {
                          b.Property<int>("Id")
                              .ValueGeneratedOnAdd()
                              .HasAnnotation(autoIDGenStrategy, autoIDGenStrategyValue);
      eFormCore/Migrations/20200222140656_AddinDisplayIndexToOptions.Designer.cs on lines 1420..1458
      eFormCore/Migrations/20200224084023_AddingAttributesToUnits.Designer.cs on lines 1420..1458

      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 334.

      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

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

                  modelBuilder.Entity("Microting.eForm.Infrastructure.Data.Entities.option_versions", b =>
                      {
                          b.Property<int>("Id")
                              .ValueGeneratedOnAdd()
                              .HasAnnotation(autoIDGenStrategy, autoIDGenStrategyValue);
      eFormCore/Migrations/20200224084023_AddingAttributesToUnits.Designer.cs on lines 1420..1458
      eFormCore/Migrations/20200224092512_AddingMoreAttributesToUnits.Designer.cs on lines 1420..1458

      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 334.

      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

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

                  modelBuilder.Entity("Microting.eForm.Infrastructure.Data.Entities.option_versions", b =>
                      {
                          b.Property<int>("Id")
                              .ValueGeneratedOnAdd()
                              .HasAnnotation(autoIDGenStrategy, autoIDGenStrategyValue);
      eFormCore/Migrations/20200222140656_AddinDisplayIndexToOptions.Designer.cs on lines 1420..1458
      eFormCore/Migrations/20200224092512_AddingMoreAttributesToUnits.Designer.cs on lines 1420..1458

      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 334.

      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

                  migrationBuilder.CreateTable(
                      name: "folders",
                      columns: table => new
                      {
                          id = table.Column<int>(nullable: false)
      Severity: Major
      Found in eFormCore/Migrations/20190408081151_AddingFolders.cs and 1 other location - About 5 hrs to fix
      eFormCore/Migrations/20200120164857_AddingTranslationsToInSight.cs on lines 184..208

      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 333.

      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

                  migrationBuilder.CreateTable(
                      name: "QuestionTranslationVersions",
                      columns: table => new
                      {
                          Id = table.Column<int>(nullable: false)
      eFormCore/Migrations/20190408081151_AddingFolders.cs on lines 67..91

      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 333.

      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 SaveAnswer has 126 lines of code (exceeds 25 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: Major
      Found in eFormCore/Core.cs - About 5 hrs to fix

        Method SQL_Template_TemplateUpdateFieldIdsForColumns_UpdatesIds has 125 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method CheckListValues_Delete_DoesSetWorkflowStateToRemoved has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                        migrationBuilder.CreateTable(
                            name: "question_set_versions",
                            columns: table => new
                            {
                                id = table.Column<int>(nullable: false)
            eFormCore/Migrations/20190315092242_AddingModelseForInsight.cs on lines 199..219

            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 330.

            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

                        migrationBuilder.CreateTable(
                            name: "options",
                            columns: table => new
                            {
                                id = table.Column<int>(nullable: false)
            eFormCore/Migrations/20190315092242_AddingModelseForInsight.cs on lines 221..241

            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 330.

            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 questionSet_Delete_DoesDelete_AllTrue()
                    {
                        // Arrange
                        string name = Guid.NewGuid().ToString();
            Severity: Major
            Found in eFormSDK.Integration.Tests/SqlControllerTestQuestionSet.cs and 1 other location - About 5 hrs to fix
            eFormSDK.Integration.Tests/SqlControllerTestQuestionSet.cs on lines 517..549

            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 329.

            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

                                case Constants.Constants.FieldTypes.SingleSelect:
                                    var singleSelectFieldOptions =
                                        await db.FieldOptions.Where(x => x.FieldId == field.Id)
                                            .Where(x => x.WorkflowState != Constants.Constants.WorkflowStates.Removed)
                                            .Join(db.FieldOptionTranslations,
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 5 hrs to fix
            eFormCore/Infrastructure/SqlController.cs on lines 7183..7209

            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 329.

            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 questionSet_Delete_DoesDelete_AllFalse()
                    {
                        // Arrange
                        string name = Guid.NewGuid().ToString();
            Severity: Major
            Found in eFormSDK.Integration.Tests/SqlControllerTestQuestionSet.cs and 1 other location - About 5 hrs to fix
            eFormSDK.Integration.Tests/SqlControllerTestQuestionSet.cs on lines 550..581

            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 329.

            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

                                case Constants.Constants.FieldTypes.MultiSelect:
                                    var multiSelectFieldOptions =
                                        await db.FieldOptions.Where(x => x.FieldId == field.Id)
                                            .Where(x => x.WorkflowState != Constants.Constants.WorkflowStates.Removed)
                                            .Join(db.FieldOptionTranslations,
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 5 hrs to fix
            eFormCore/Infrastructure/SqlController.cs on lines 7238..7264

            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 329.

            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 SQL_Site_SiteGetAll_DoesReturnAllSites has 124 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    [Test]
            
                    public async Task SQL_Site_SiteGetAll_DoesReturnAllSites()
                    {
                        // Arrance
            Severity: Major
            Found in eFormSDK.Integration.Tests/SqlControllerTestSite.cs - About 4 hrs to fix

              File AdminTools.cs has 373 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              using System;
              using System.Collections.Generic;
              using System.Linq;
              using System.Threading.Tasks;
              using Microsoft.EntityFrameworkCore;
              Severity: Minor
              Found in eFormCore/AdminTools.cs - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language