fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Method createImageFromObject has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        MediaFile $media_file,
        float $x,
        float $y,
        float $w,
        float $h,
Severity: Major
Found in app/Report/HtmlRenderer.php - About 50 mins to fix

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

        public function __construct(string $file, float $x, float $y, float $w, float $h, string $align, string $ln)
    Severity: Major
    Found in app/Report/ReportBaseImage.php - About 50 mins to fix

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

          private function allMedia(Tree $tree, string $folder, bool $subfolders, string $sort, string $filter, string $format): Collection
      Severity: Minor
      Found in app/Module/MediaListModule.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
            {
                $tree      = Validator::attributes($request)->tree();
                $xref      = Validator::attributes($request)->isXref()->string('xref');
                $xref2     = Validator::attributes($request)->isXref()->string('xref2', '');
        Severity: Minor
        Found in app/Module/RelationshipsChartModule.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 compact has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        TreeViewHandler.prototype.compact = function () {
          var tv = this;
          var b = $('#tvbCompact', tv.toolbox);
          tv.setLoading();
          if (tv.auto_box_width) {
        Severity: Minor
        Found in resources/js/treeview.js - 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 fillYData has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private function fillYData($x, $z, $value, array $x_axis, array $z_axis, array &$ydata): void
        Severity: Minor
        Found in app/Module/StatisticsChartModule.php - About 45 mins to fix

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

              public function loadChildren(Family $family, int $generations): string
              {
                  $out = '';
                  if ($family->canShow()) {
                      $children = $family->children();
          Severity: Minor
          Found in app/Module/DescendancyModule.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 buildNameFromParts has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            webtrees.buildNameFromParts = function (npfx, givn, spfx, surn, nsfx, sex) {
          Severity: Minor
          Found in resources/js/webtrees.js - About 45 mins to fix

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

                private function sitemapRecords(Tree $tree, string $type, int $limit, int $offset): Collection
                {
                    switch ($type) {
                        case Family::RECORD_TYPE:
                            $records = $this->sitemapFamilies($tree, $limit, $offset);
            Severity: Minor
            Found in app/Module/SiteMapModule.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 recordsToFix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function recordsToFix(Tree $tree, array $params): Collection
                {
                    $families     = $this->familiesToFix($tree, $params);
                    $individuals  = $this->individualsToFix($tree, $params);
                    $locations    = $this->locationsToFix($tree, $params);
            Severity: Minor
            Found in app/Module/ModuleDataFixTrait.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 getBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                {
                    $num = (int) $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER_TO_SHOW);
            
                    extract($config, EXTR_OVERWRITE);
            Severity: Minor
            Found in app/Module/TopPageViewsModule.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 getPatriarchsHtml has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function getPatriarchsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std): string
            Severity: Minor
            Found in app/Module/BranchesListModule.php - About 45 mins to fix

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

                  private function drawPerson(Individual $person, int $gen, int $state, Family|null $pfamily, string $line, bool $isRoot): string
              Severity: Minor
              Found in app/Module/InteractiveTree/TreeView.php - About 45 mins to fix

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

                    private function createNoteText(CensusInterface $census, string $ca_title, string $ca_place, string $ca_citation, array $ca_individuals, string $ca_notes): string
                Severity: Minor
                Found in app/Module/CensusAssistantModule.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
                      {
                          $tree        = Validator::attributes($request)->tree();
                          $user        = Validator::attributes($request)->user();
                          $style       = Validator::attributes($request)->isInArrayKeys($this->styles())->string('style');
                  Severity: Minor
                  Found in app/Module/AncestorsChartModule.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 toUtf8 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function toUtf8(string $text): string
                      {
                          $utf8 = '';
                  
                          foreach (str_split($text, 2) as $character) {
                  Severity: Minor
                  Found in app/Encodings/AbstractUTF16Encoding.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 ($first === 'bro' && $sex1 === 'M') {
                                                      return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 3));
                                                  }
                  Severity: Major
                  Found in app/Services/RelationshipService.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    switch ($event->tag()) {
                                                        case 'FAM:ANUL':
                                                        case 'FAM:DIV':
                                                            return I18N::translate('ex-husband');
                                                        case 'FAM:MARR':
                    Severity: Major
                    Found in app/Services/RelationshipService.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if ($bef_last === 'mot') {
                                                          return I18N::translateContext('great ×(%s-1) grandmother’s brother', 'great ×%s uncle', I18N::number($up - 2));
                                                      }
                      Severity: Major
                      Found in app/Services/RelationshipService.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        if ($first === 'bro' && $sex1 === 'M') {
                                                            return I18N::translateContext('(a man’s) brother’s great ×(%s-1) granddaughter', 'great ×%s niece', I18N::number($down - 1));
                                                        }
                        Severity: Major
                        Found in app/Services/RelationshipService.php - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language