microting/eform-sdk-dotnet

View on GitHub

Showing 3,203 of 3,219 total issues

Method EntityGroupDelete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public async Task<string> EntityGroupDelete(string entityGroupMUId)
        {
            string methodName = "SqlController.EntityGroupDelete";
            try
            {
Severity: Minor
Found in eFormCore/Infrastructure/SqlController.cs - About 1 hr to fix

    Method CreateCase has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public async Task<Case> CreateCase(string caseUId, CheckList checkList, DateTime created_at, string custom,
                DateTime done_at, Worker doneByUserId, int microtingCheckId, int microtingUId, Site site, int? status,
                string caseType, Unit unit, DateTime updated_at, int version, Worker worker, string WorkFlowState)
            {
                Case aCase = new Case
    Severity: Minor
    Found in eFormCore/Helpers/TestHelpers.cs - About 1 hr to fix

      Method SearchAndReplace has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private static string SearchAndReplace(string docText, SortedDictionary<string, string> valuesToReplace)
              {
                  foreach (var fieldValue in valuesToReplace.Reverse())
                  {
                      WriteDebugConsoleLogEntry(new LogEntry(2, "ReportHelper.SearchAndReplace",
      Severity: Minor
      Found in eFormCore/Helpers/ReportHelper.cs - About 1 hr to fix

        Method EntityGroupCreate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public async Task<string> EntityGroupCreate(string entityType, string name, string id)
                {
                    _log.LogEverything("Communicator.EntityGroupCreate", "called");
                    _log.LogVariable("Communicator.EntityGroupCreate", nameof(entityType), entityType);
                    _log.LogVariable("Communicator.EntityGroupCreate", nameof(name), name);
        Severity: Minor
        Found in eFormCore/Communication/Communicator.cs - About 1 hr to fix

          Method Core_Case_CaseRead_ReadsCase has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  [Test]
                  public async Task Core_Case_CaseRead_ReadsCase()
                  {
                      // Arrange
          
          
          Severity: Minor
          Found in eFormSDK.Integration.Case.CoreTests/CoreTestCase.cs - About 1 hr to fix

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

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

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

            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 2 locations. Consider refactoring.
            Open

                        Answer answer = new Answer
                        {
                            AnswerDuration = rnd.Next(1, 255),
                            FinishedAt = DateTime.UtcNow,
                            LanguageId = language.Id,
            Severity: Major
            Found in eFormSDK.InSight.Tests/AnswersUTest.cs and 1 other location - About 1 hr to fix
            eFormSDK.InSight.Tests/AnswerValuesUTest.cs on lines 461..473

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

            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 2 locations. Consider refactoring.
            Open

                        Answer answer = new Answer
                        {
                            AnswerDuration = rnd.Next(1, 255),
                            FinishedAt = DateTime.UtcNow,
                            LanguageId = language.Id,
            Severity: Major
            Found in eFormSDK.InSight.Tests/AnswerValuesUTest.cs and 1 other location - About 1 hr to fix
            eFormSDK.InSight.Tests/AnswersUTest.cs on lines 216..228

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

            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 (mainElement.Label.Split("|").Length > 2)
                            {
                                checkListTranslation = new CheckListTranslation
                                {
                                    CheckListId = cl.Id,
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 1 hr to fix
            eFormCore/Infrastructure/SqlController.cs on lines 5820..5829

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

            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 2 locations. Consider refactoring.
            Open

                                            {
                                                string value = "";
                                                if (item.Value != null)
                                                {
                                                    value = item.Value.Replace(".", decimalSeparator)
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 1 hr to fix
            eFormCore/Infrastructure/SqlController.cs on lines 2674..2683

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

            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 2 locations. Consider refactoring.
            Open

                                            {
                                                string value = "";
                                                if (item.Value != null)
                                                {
                                                    value = item.Value.Replace(".", decimalSeparator)
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 1 hr to fix
            eFormCore/Infrastructure/SqlController.cs on lines 2663..2672

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

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

                    public async Task<ReplyElement> CheckRead(int id, Language language)
                    {
                        string methodName = "SqlController.CheckRead";
                        try
                        {
            Severity: Minor
            Found in eFormCore/Infrastructure/SqlController.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

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

                    private async Task<bool> CheckStatusByMicrotingUid(int microtingUid)
                    {
                        await using MicrotingDbContext dbContext = _core.DbContextHelper.GetDbContext();
                        List<CaseDto> lstCase = new List<CaseDto>();
            
            
            Severity: Minor
            Found in eFormCore/Handlers/EformCompletedHandler.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

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

                            if (checkListTranslation == null)
                            {
                                language = await db.Languages.AsNoTracking().FirstAsync(x => x.LanguageCode == "da");
                                checkListTranslation =
                                    await db.CheckListTranslations.AsNoTracking().FirstOrDefaultAsync(x =>
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 1 hr to fix
            eFormCore/Infrastructure/SqlController.cs on lines 1499..1505

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

            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> EntitySelectItemDelete(string entitySearchItemId)
                    {
                        _log.LogEverything("Communicator.EntitySelectItemDelete", "called");
                        _log.LogVariable("Communicator.EntitySelectItemDelete", nameof(entitySearchItemId), entitySearchItemId);
            
            
            Severity: Major
            Found in eFormCore/Communication/Communicator.cs and 1 other location - About 1 hr to fix
            eFormCore/Communication/Communicator.cs on lines 720..733

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

            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 2 locations. Consider refactoring.
            Open

                            if (checkListTranslation == null)
                            {
                                language = await db.Languages.AsNoTracking().FirstAsync(x => x.LanguageCode == "da");
                                checkListTranslation =
                                    await db.CheckListTranslations.AsNoTracking().FirstOrDefaultAsync(x =>
            Severity: Major
            Found in eFormCore/Infrastructure/SqlController.cs and 1 other location - About 1 hr to fix
            eFormCore/Infrastructure/SqlController.cs on lines 1566..1572

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

            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> EntitySearchItemDelete(string entitySearchItemId)
                    {
                        _log.LogEverything("Communicator.EntitySearchItemDelete", "called");
                        _log.LogVariable("Communicator.EntitySearchItemDelete", nameof(entitySearchItemId), entitySearchItemId);
            
            
            Severity: Major
            Found in eFormCore/Communication/Communicator.cs and 1 other location - About 1 hr to fix
            eFormCore/Communication/Communicator.cs on lines 767..780

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

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

                    public override async Task DoSetup()
                    {
                        #region Setup SettingsTableContent
            
                        DbContextHelper dbContextHelper = new DbContextHelper(ConnectionString);
            Severity: Minor
            Found in eFormSDK.Integration.CheckLists.CoreTests/CoreTestAdvanced.cs - About 1 hr to fix

              Method SQL_Case_CheckListSitesRead_DoesSiteRead has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [Test]
                      public async Task SQL_Case_CheckListSitesRead_DoesSiteRead()
                      {
                          Random rnd = new Random();
                          Site site1 = await testHelpers.CreateSite("mySite2", 331);

                Method DoSetup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public override async Task DoSetup()
                        {
                            #region Setup SettingsTableContent
                
                            DbContextHelper dbContextHelper = new DbContextHelper(ConnectionString);
                Severity: Minor
                Found in eFormSDK.Integration.CheckLists.CoreTests/CoreTesteForm.cs - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language