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

        public async Task<bool> WorkerDelete(int workerId)
        {
            _log.LogEverything("Communicator.WorkerDelete", "called");
            _log.LogVariable("Communicator.WorkerDelete", nameof(workerId), workerId);

Severity: Major
Found in eFormCore/Communication/Communicator.cs and 1 other location - About 1 hr to fix
eFormCore/Communication/Communicator.cs on lines 409..420

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

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

        public async Task<bool> SiteWorkerDelete(int workerId)
        {
            _log.LogEverything("Communicator.SiteWorkerDelete", "called");
            _log.LogVariable("Communicator.SiteWorkerDelete", nameof(workerId), workerId);

Severity: Major
Found in eFormCore/Communication/Communicator.cs and 1 other location - About 1 hr to fix
eFormCore/Communication/Communicator.cs on lines 373..384

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

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

        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_answer_values_options_OptionsId",
                table: "answer_values");

    Method Workers_Delete_DoesSetWorkflowstateToRemoved has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            [Test]
            public async Task Workers_Delete_DoesSetWorkflowstateToRemoved()
            {
                //Arrange
    
    
    Severity: Minor
    Found in eFormSDK.Base.Tests/WorkersUTest.cs - About 1 hr to fix

      Method CasesToCsv has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public async Task<string> CasesToCsv(int templateId, DateTime? start, DateTime? end, string pathAndName,
                  string customPathForUploadedData, string decimalSeparator, string thousandSeparator, bool utcTime,
                  CultureInfo cultureInfo, TimeZoneInfo timeZoneInfo, Language language, bool gpsCoordinates,
                  bool includeCheckListText)
      Severity: Major
      Found in eFormCore/Core.cs - About 1 hr to fix

        Method SQL_Template_TemplateDisplayIndexChange_ChangesDisplayIndex has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

                  protected override void Up(MigrationBuilder migrationBuilder)
                  {
                      migrationBuilder.AddColumn<int>(
                          name: "FolderId",
                          table: "check_list_sites",

            Method TemplateFieldReadAll has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public async Task<List<FieldDto>> TemplateFieldReadAll(int templateId, Language language)
                    {
                        string methodName = "SqlController.TemplateFieldReadAll";
                        _log.LogEverything(methodName, "Start");
                        try
            Severity: Minor
            Found in eFormCore/Infrastructure/SqlController.cs - About 1 hr to fix

              Method MapVersion has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private object MapVersion(object obj)
                      {
                          Type type = obj.GetType().UnderlyingSystemType;
                          String className = type.Name;
                          var name = obj.GetType().FullName + "Version";
              Severity: Minor
              Found in eFormCore/Infrastructure/Data/Entities/PnBase.cs - About 1 hr to fix

                Method DbSettingsReloadRemote has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method Folders_Create_DoesCreate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          [Test]
                          public async Task Folders_Create_DoesCreate()
                          {
                              //Arrange
                  
                  
                  Severity: Minor
                  Found in eFormSDK.Base.Tests/FoldersUTest.cs - About 1 hr to fix

                    Function check_new_nuget_version has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def check_new_nuget_version(package_name):
                        # Construct the NuGet package URL
                        package_url = f"https://api.nuget.org/v3-flatcontainer/{package_name.lower()}/index.json"
                        #print(package_url)
                        
                    Severity: Minor
                    Found in cronjob.py - About 1 hr 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 CasesToCsv has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                    Open

                            public async Task<string> CasesToCsv(int templateId, DateTime? start, DateTime? end, string pathAndName,
                                string customPathForUploadedData, string decimalSeparator, string thousandSeparator, bool utcTime,
                                CultureInfo cultureInfo, TimeZoneInfo timeZoneInfo, Language language, bool gpsCoordinates,
                                bool includeCheckListText)
                            {
                    Severity: Minor
                    Found in eFormCore/Core.cs - About 1 hr 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

                                        wordDoc.MainDocumentPart.Document.Body.InsertBefore(new Paragraph(
                                                new Hyperlink(
                                                        new Run(
                                                            new RunProperties(
                                                                new RunStyle { Val = "InternetLink" },
                    Severity: Major
                    Found in eFormCore/Helpers/ReportHelper.cs and 1 other location - About 1 hr to fix
                    eFormCore/Helpers/ReportHelper.cs on lines 384..399

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

                    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

                                        paragraph.Append(new Hyperlink(
                                                new Run(
                                                    new RunProperties(
                                                        new RunStyle { Val = "InternetLink" },
                                                        new RunFonts { Ascii = "Arial", HighAnsi = "Arial" },
                    Severity: Major
                    Found in eFormCore/Helpers/ReportHelper.cs and 1 other location - About 1 hr to fix
                    eFormCore/Helpers/ReportHelper.cs on lines 361..377

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

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

                            [Test]
                            public async Task SQL_File_FileCaseFindMUId_doesFindMUId()
                            {
                                Random rnd = new Random();
                                Site site1 = await testHelpers.CreateSite("MySite", 22);

                      Method CaseDelete has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public async Task<bool> CaseDelete(int templateId, int siteUId, string workflowState)
                              {
                                  string methodName = "Core.CaseDelete";
                                  try
                                  {
                      Severity: Minor
                      Found in eFormCore/Core.cs - About 1 hr to fix

                        Method LanguageQuestionSet_Create_DoesCreate_W_MicrotingUid has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                [Test]
                                public async Task LanguageQuestionSet_Create_DoesCreate_W_MicrotingUid()
                                {
                                    //Assert
                                    Random rnd = new Random();
                        Severity: Minor
                        Found in eFormSDK.InSight.Tests/LanguageQuestionSetUTest.cs - About 1 hr to fix

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

                                      Microting.eForm.Infrastructure.Data.Entities.Case aCase = await testHelpers.CreateCase("caseUId", cl1,
                                          DateTime.UtcNow, "custom", DateTime.UtcNow,
                                          worker, rnd.Next(1, 255), rnd.Next(1, 255),
                                          site, 66, "caseType", unit, DateTime.UtcNow, 1, worker, Constants.WorkflowStates.Created);
                          eFormSDK.Integration.Case.SqlControllerTests/SqlControllerTestCase.cs on lines 477..480
                          eFormSDK.Integration.Case.SqlControllerTests/SqlControllerTestCase.cs on lines 1209..1212
                          eFormSDK.Integration.Case.SqlControllerTests/SqlControllerTestCase.cs on lines 1536..1539
                          eFormSDK.Integration.Case.SqlControllerTests/SqlControllerTestCase.cs on lines 1656..1659

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

                          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 SQL_Tags_CreateTag_DoesCreateNewTag()
                                  {
                                      // Arrance
                                      string tagName = "Tag1";
                          eFormSDK.Integration.Base.CoreTests/CoreTestTag.cs on lines 87..101

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

                          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