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

                constraints: table =>
                {
                    table.PrimaryKey("PK_fields", x => x.id);
                    table.ForeignKey(
                        name: "FK_fields_check_lists_check_list_id",
Severity: Major
Found in eFormCore/Migrations/20180810124416_InitialCreate.cs and 2 other locations - About 2 hrs to fix
eFormCore/Migrations/20201222125152_HugheTableRenaming.cs on lines 884..905
eFormCore/Migrations/20201222125152_HugheTableRenaming.cs on lines 1712..1733

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

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

        [Test]
        public async Task options_Create_DoesCreate()
        {        
            // Arrange
            #region QuestionSet
Severity: Major
Found in eFormSDK.Integration.Tests/SqlControllerTestOptions.cs - About 2 hrs to fix

    Method CreateMultiPictureXMLResult has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public async Task<string> CreateMultiPictureXMLResult(bool create)
            {
                if (create)
                {
                    await testHelpers.GenerateDefaultLanguages();
    Severity: Major
    Found in eFormCore/Helpers/TestHelperReturnXML.cs - About 2 hrs to fix

      Method CaseToJasperXml has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public async Task<string> CaseToJasperXml(CaseDto cDto, ReplyElement reply, int caseId, string timeStamp,
                  string customPathForUploadedData, string customXMLContent, Language language)
              {
                  string methodName = "Core.CaseToJasperXml";
                  try
      Severity: Major
      Found in eFormCore/Core.cs - About 2 hrs to fix

        Method QuestionTranslation_Create_DoesCreate_W_MicrotingUID has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                [Test]
                public async Task QuestionTranslation_Create_DoesCreate_W_MicrotingUID()
                {
                    Random rnd = new Random();
        
        
        Severity: Major
        Found in eFormSDK.InSight.Tests/QuestionTranslationUTest.cs - About 2 hrs to fix

          Method Core_eForm_SimplePictureFormFromXML_ReturnseMainElement has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method Core_eFormSimpleSaveButtonFormFromXML_ReturnseMainElement has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    [Test]
                    public async Task Core_eFormSimpleSaveButtonFormFromXML_ReturnseMainElement()
                    {
                        string xmlstring = @"
                            <?xml version='1.0' encoding='UTF-8'?>
            Severity: Major
            Found in eFormSDK.Integration.CheckLists.CoreTests/CoreTesteFormFromXML.cs - About 2 hrs to fix

              Method QuestionTranslation_Create_DoesCreate_WO_MicrotingUID has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [Test]
                      public async Task QuestionTranslation_Create_DoesCreate_WO_MicrotingUID()
                      {
                          Random rnd = new Random();
              
              
              Severity: Major
              Found in eFormSDK.InSight.Tests/QuestionTranslationUTest.cs - About 2 hrs to fix

                Method Options_Create_DoesCreate has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        [Test]
                        public async Task Options_Create_DoesCreate()
                        {
                            Random rnd = new Random();
                
                
                Severity: Major
                Found in eFormSDK.InSight.Tests/OptionsUTest.cs - About 2 hrs to fix

                  Method LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          [Test]
                          public async Task LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid()
                          {
                              //Assert
                              Random rnd = new Random();
                  Severity: Major
                  Found in eFormSDK.InSight.Tests/LanguageQuestionSetUTest.cs - About 2 hrs to fix

                    Method TemplateItemRead has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                    Open

                            public async Task<Template_Dto> TemplateItemRead(int templateId, Language language)
                            {
                                string methodName = "SqlController.TemplateItemRead";
                    
                                try
                    Severity: Minor
                    Found in eFormCore/Infrastructure/SqlController.cs - About 2 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

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

                                    if (groupElement.Label.Split("|").Length > 1)
                                    {
                                        checkListTranslation = new CheckListTranslation
                                        {
                                            CheckListId = cl.Id,
                    Severity: Major
                    Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 2 hrs to fix
                    eFormCore/Infrastructure/SqlController.cs on lines 5934..5950

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

                    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

                                    if (groupElement.Label.Split("|").Length > 2)
                                    {
                                        checkListTranslation = new CheckListTranslation
                                        {
                                            CheckListId = cl.Id,
                    Severity: Major
                    Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 2 hrs to fix
                    eFormCore/Infrastructure/SqlController.cs on lines 5916..5932

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

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

                            [Test] //Using Communicatorn needs httpMock
                            public async Task Core_Site_SiteDelete_ReturnsTrue()
                            {
                                // Arrange
                                string siteName = Guid.NewGuid().ToString();
                    Severity: Major
                    Found in eFormSDK.Integration.Base.CoreTests/CoreTestSite.cs - About 2 hrs to fix

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

                              protected override void Up(MigrationBuilder migrationBuilder)
                              {
                                  migrationBuilder.DropForeignKey(
                                      name: "FK_LanguageQuestionSetVersions_LanguageQuestionSets_LanguageQues",
                                      table: "LanguageQuestionSetVersions");
                      Severity: Major
                      Found in eFormCore/Migrations/20201116164405_AddingDescriptionToEntityGroup.cs - About 2 hrs to fix

                        Method DbFieldToField has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                private async Task<Models.Field> DbFieldToField(MicrotingDbContext db, Field dbField, Language language)
                                {
                                    //await using var db = GetContext();
                                    Models.Field field = new Models.Field
                                    {
                        Severity: Major
                        Found in eFormCore/Infrastructure/SqlController.cs - About 2 hrs to fix

                          Method LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid_AddsUid has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  [Test]
                                  public async Task LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid_AddsUid()
                                  {
                                      //Assert
                                      Random rnd = new Random();
                          Severity: Major
                          Found in eFormSDK.InSight.Tests/LanguageQuestionSetUTest.cs - About 2 hrs to fix

                            Method SiteSurveyConfiguration_Delete_DoesDelete has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method Core_eFormSimpleInfoboxFormFromXML_ReturnseMainElement has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      [Test]
                                      public async Task Core_eFormSimpleInfoboxFormFromXML_ReturnseMainElement()
                                      {
                                          string xmlstring = @"
                                              <?xml version='1.0' encoding='UTF-8'?>
                              Severity: Major
                              Found in eFormSDK.Integration.CheckLists.CoreTests/CoreTesteFormFromXML.cs - About 2 hrs to fix

                                Method GetChecksAndFields has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        private void GetChecksAndFields(ref string clsLst, ref string fldLst, List<Element> elementLst,
                                            string customPathForUploadedData)
                                        {
                                            var db = DbContextHelper.GetDbContext();
                                            string jasperFieldXml = "";
                                Severity: Major
                                Found in eFormCore/Core.cs - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language