fisharebest/webtrees

View on GitHub

Showing 2,400 of 2,400 total issues

File phpstan-baseline.php has 6439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

$ignoreErrors = [];
Severity: Major
Found in phpstan-baseline.php - About 2 wks to fix

    Function legacyNameAlgorithm has a Cognitive Complexity of 486 (exceeds 5 allowed). Consider refactoring.
    Open

        public function legacyNameAlgorithm(string $path, Individual|null $person1 = null, Individual|null $person2 = null): string
        {
            // The path does not include the starting person. In some languages, the
            // translation for a man’s (relative) is different from a woman’s (relative),
            // due to inflection.
    Severity: Minor
    Found in app/Services/RelationshipService.php - About 1 wk 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 legacyNameAlgorithm has 1554 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function legacyNameAlgorithm(string $path, Individual|null $person1 = null, Individual|null $person2 = null): string
        {
            // The path does not include the starting person. In some languages, the
            // translation for a man’s (relative) is different from a woman’s (relative),
            // due to inflection.
    Severity: Major
    Found in app/Services/RelationshipService.php - About 1 wk to fix

      Function finishCurrentSpan has a Cognitive Complexity of 342 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function finishCurrentSpan(string &$result, bool $theEnd = false): void
          {
              $textSpan = substr($result, self::$posSpanStart);
              $result   = substr($result, 0, self::$posSpanStart);
      
      
      Severity: Minor
      Found in app/Report/RightToLeftSupport.php - About 1 wk 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 7 locations. Consider refactoring.
      Open

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/Windows1252.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/ISO88591.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/Windows1251.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/CP437.php and 6 other locations - About 5 days to fix
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/Windows1250.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/CP850.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/ISO88592.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

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

      <?php
      
      /**
       * webtrees: online genealogy
       * Copyright (C) 2023 webtrees development team
      Severity: Major
      Found in app/Encodings/ISO88592.php and 6 other locations - About 5 days to fix
      app/Encodings/CP437.php on lines 1..161
      app/Encodings/CP850.php on lines 1..161
      app/Encodings/ISO88591.php on lines 1..161
      app/Encodings/Windows1250.php on lines 1..161
      app/Encodings/Windows1251.php on lines 1..161
      app/Encodings/Windows1252.php on lines 1..161

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

      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

      Statistics has 289 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Statistics implements
          GedcomRepositoryInterface,
          IndividualRepositoryInterface,
          EventRepositoryInterface,
          MediaRepositoryInterface,
      Severity: Major
      Found in app/Statistics.php - About 5 days to fix

        File ReportParserGenerate.php has 2059 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * webtrees: online genealogy
         * Copyright (C) 2023 webtrees development team
        Severity: Major
        Found in app/Report/ReportParserGenerate.php - About 5 days to fix

          File RelationshipService.php has 1907 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * webtrees: online genealogy
           * Copyright (C) 2023 webtrees development team
          Severity: Major
          Found in app/Services/RelationshipService.php - About 5 days to fix

            Function spanLtrRtl has a Cognitive Complexity of 223 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function spanLtrRtl(string $inputText): string
                {
                    if ($inputText === '') {
                        // Nothing to do
                        return '';
            Severity: Minor
            Found in app/Report/RightToLeftSupport.php - About 4 days 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

            Function listStartHandler has a Cognitive Complexity of 221 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function listStartHandler(array $attrs): void
                {
                    $this->process_repeats++;
                    if ($this->process_repeats > 1) {
                        return;
            Severity: Minor
            Found in app/Report/ReportParserGenerate.php - About 4 days 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

            File Statistics.php has 1346 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * webtrees: online genealogy
             * Copyright (C) 2023 webtrees development team
            Severity: Major
            Found in app/Statistics.php - About 3 days to fix

              Function postCustomChartAction has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function postCustomChartAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $statistics = Registry::container()->get(Statistics::class);
                      assert($statistics instanceof Statistics);
              
              
              Severity: Minor
              Found in app/Module/StatisticsChartModule.php - About 2 days 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

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Major
              Found in app/Census/CensusOfCanada1921.php and 1 other location - About 2 days to fix
              app/Census/CensusOfUnitedStates1820.php on lines 1..80

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

              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

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Major
              Found in app/Census/CensusOfUnitedStates1820.php and 1 other location - About 2 days to fix
              app/Census/CensusOfCanada1921.php on lines 1..80

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

              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