fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $tree         = Validator::attributes($request)->tree();
        $title        = Validator::parsedBody($request)->isNotEmpty()->string('source-title');
        $abbreviation = Validator::parsedBody($request)->string('source-abbreviation');
Severity: Minor
Found in app/Http/RequestHandlers/CreateSourceAction.php - About 45 mins 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 childFacts has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private function childFacts(Individual $person, Family $family, string $option, string $relation, Date $min_date, Date $max_date): Collection
Severity: Minor
Found in app/Services/IndividualFactsService.php - About 45 mins to fix

    Function importLegacyPlacDefn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function importLegacyPlacDefn(string $gedcom): void
        {
            $gedcom_service = new GedcomService();
    
            if (preg_match('/\n1 PLAC (.+)/', $gedcom, $match)) {
    Severity: Minor
    Found in app/Services/GedcomImportService.php - About 45 mins 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 message has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function message(UserInterface $from, UserInterface $to, UserInterface $reply_to, string $subject, string $message_text, string $message_html): Message
    Severity: Minor
    Found in app/Services/EmailService.php - About 45 mins to fix

      Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              $token    = $request->getAttribute('token');
              $tree     = Validator::attributes($request)->treeOptional();
              $username = $request->getAttribute('username');
      Severity: Minor
      Found in app/Http/RequestHandlers/VerifyEmail.php - About 45 mins 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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              $tree     = Validator::attributes($request)->tree();
              $xref     = Validator::attributes($request)->isXref()->string('xref');
              $record   = Registry::gedcomRecordFactory()->make($xref, $tree);
      Severity: Minor
      Found in app/Http/RequestHandlers/EditRawRecordAction.php - About 45 mins 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 searchIndividualsPhonetic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function searchIndividualsPhonetic(string $soundex, string $lastname, string $firstname, string $place, array $search_trees): Collection
          {
              switch ($soundex) {
                  default:
                  case 'Russell':
      Severity: Minor
      Found in app/Services/SearchService.php - About 45 mins 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 send has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function send(UserInterface $from, UserInterface $to, UserInterface $reply_to, string $subject, string $message_text, string $message_html): bool
      Severity: Minor
      Found in app/Services/EmailService.php - About 45 mins to fix

        Method getCalendarEvents has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function getCalendarEvents(int $jd1, int $jd2, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
        Severity: Minor
        Found in app/Services/CalendarService.php - About 45 mins to fix

          Function symmetricCousin has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function symmetricCousin(): Relationship
              {
                  $this->matchers[] = static function (array &$nodes, array &$patterns, array &$captures): bool {
                      $count = count($patterns);
          
          
          Severity: Minor
          Found in app/Relationship.php - About 45 mins 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 subtag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function subtag(string $subtag, string $repeat, string $before = ''): void
              {
                  if ($before === '' || ($this->subtags[$before] ?? null) === null) {
                      $this->subtags[$subtag] = $repeat;
                  } else {
          Severity: Minor
          Found in app/Elements/AbstractElement.php - About 45 mins 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 chartSex has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  int $tot_m,
                  int $tot_f,
                  int $tot_u,
                  string|null $color_female = null,
                  string|null $color_male = null,
          Severity: Minor
          Found in app/Statistics/Google/ChartSex.php - About 45 mins to fix

            Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    CenturyService $century_service,
                    ColorService $color_service,
                    CountryService $country_service,
                    ModuleService $module_service,
                    Tree $tree,
            Severity: Minor
            Found in app/Statistics.php - About 45 mins to fix

              Function generate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function generate(Individual $individual, Individual $head): string
                  {
                      $marriage_date = null;
              
                      foreach ($individual->spouseFamilies() as $family) {
              Severity: Minor
              Found in app/Census/CensusColumnYearsMarried.php - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                          if (!str_contains(self::NUMBERS, $charArray['letter'])) {
                                              // This is not a digit. End the run of digits and punctuation.
                                              $numberState = false;
                                              if (self::$currentState === 'RTL') {
                                                  if (!str_contains(self::NUMBER_PREFIX, $currentLetter)) {
              Severity: Major
              Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(int $id, string $name, string $title)
                    {
                        $this->id                      = $id;
                        $this->name                    = $name;
                        $this->title                   = $title;
                Severity: Minor
                Found in app/Tree.php - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        if (str_ends_with($textSpan, ' ')) {
                                            $trailingSeparator = ' ' . $trailingSeparator;
                                            $textSpan          = substr($textSpan, 0, -6);
                                            continue;
                                        }
                Severity: Major
                Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (str_ends_with($textSpan, ' ')) {
                                              $trailingBlanks = ' ' . $trailingBlanks;
                                              $textSpan       = substr($textSpan, 0, -1);
                                              continue;
                                          }
                  Severity: Major
                  Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (self::$currentState === '') {
                                                    $newState = 'RTL';
                                                    break;
                                                }
                    Severity: Major
                    Found in app/Report/RightToLeftSupport.php - About 45 mins to fix

                      Function attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function attributes(): array
                          {
                              $attributes = [];
                      
                              if (!$this->isExternal() || $this->fileExists()) {
                      Severity: Minor
                      Found in app/MediaFile.php - About 45 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language