fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Function calLocalize has 20 arguments (exceeds 4 allowed). Consider refactoring.
Open

  webtrees.calLocalize = function (jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec, sun, mon, tue, wed, thu, fri, sat, day) {
Severity: Major
Found in resources/js/webtrees.js - About 2 hrs to fix

    Method siteMapIndex has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function siteMapIndex(ServerRequestInterface $request): ResponseInterface
        {
            $content = Registry::cache()->file()->remember('sitemap.xml', function (): string {
                // Which trees have sitemaps enabled?
                $tree_ids = $this->tree_service->all()
    Severity: Major
    Found in app/Module/SiteMapModule.php - About 2 hrs to fix

      Method marriageQuery has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function marriageQuery(string $type, string $age_dir, string $sex, bool $show_years): string
          {
              if ($sex === 'F') {
                  $sex_field = 'f_wife';
              } else {
      Severity: Major
      Found in app/Statistics/Repository/FamilyRepository.php - About 2 hrs to fix

        Method parentsQuery has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function parentsQuery(string $type, string $age_dir, string $sex, bool $show_years): string
            {
                if ($sex === 'F') {
                    $sex_field = 'WIFE';
                } else {
        Severity: Major
        Found in app/Statistics/Repository/FamilyRepository.php - About 2 hrs to fix

          Function buildLeafletJsMap has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            webtrees.buildLeafletJsMap = function (id, config, resetCallback) {
              const zoomControl = new L.control.zoom({
                zoomInTitle: config.i18n.zoomIn,
                zoomoutTitle: config.i18n.zoomOut,
              });
          Severity: Major
          Found in resources/js/webtrees.js - About 2 hrs to fix

            Method mapData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function mapData(Place $place): array
                {
                    $children  = $place->getChildPlaces();
                    $features  = [];
                    $sidebar   = '';
            Severity: Major
            Found in app/Module/PlaceHierarchyListModule.php - About 2 hrs to fix

              Function oldStyleRelationshipPath has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function oldStyleRelationshipPath(Tree $tree, array $path): array
                  {
                      $spouse_codes = [
                          'M' => 'hus',
                          'F' => 'wif',
              Severity: Minor
              Found in app/Module/RelationshipsChartModule.php - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                  {
                      $default_events = implode(',', self::DEFAULT_EVENTS);
              
                      $days      = (int)$this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
              Severity: Minor
              Found in app/Module/UpcomingAnniversariesModule.php - About 2 hrs 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 createMediaObject has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function createMediaObject(string $gedcom, Tree $tree): string
                  {
                      preg_match('/\n\d FILE (.+)/', $gedcom, $match);
                      $file = $match[1] ?? '';
              
              
              Severity: Minor
              Found in app/Services/GedcomImportService.php - About 2 hrs 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 18 (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/DeleteRecord.php - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
                      $user = Validator::attributes($request)->user();
              
              
              Severity: Minor
              Found in app/Http/RequestHandlers/ReportSetupPage.php - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree     = Validator::attributes($request)->tree();
                      $xref     = Validator::attributes($request)->isXref()->string('xref');
                      $fact_id  = Validator::attributes($request)->string('fact_id');
              Severity: Minor
              Found in app/Http/RequestHandlers/EditMediaFileAction.php - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree  = Validator::attributes($request)->tree();
                      $xrefs = $this->admin_service->duplicateXrefs($tree);
              
              
              Severity: Minor
              Found in app/Http/RequestHandlers/RenumberTreeAction.php - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle(ServerRequestInterface $request): ResponseInterface
                  {
                      $topic = $request->getAttribute('topic');
              
                      $dmy = I18N::language()->dateOrder();
              Severity: Minor
              Found in app/Http/RequestHandlers/HelpText.php - About 2 hrs 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 addName has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function addName(string $type, string $value, string $gedcom): void
                  {
                      ////////////////////////////////////////////////////////////////////////////
                      // Extract the structured name parts - use for "sortable" names and indexes
                      ////////////////////////////////////////////////////////////////////////////
              Severity: Minor
              Found in app/Individual.php - About 2 hrs 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 updateFact has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function updateFact(string $fact_id, string $gedcom, bool $update_chan): void
                  {
                      // Not all record types allow a CHAN event.
                      $update_chan = $update_chan && in_array(static::RECORD_TYPE, Gedcom::RECORDS_WITH_CHAN, true);
              
              
              Severity: Minor
              Found in app/GedcomRecord.php - About 2 hrs 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 commonGivenQuery has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function commonGivenQuery(string $sex, string $type, bool $show_tot, int $threshold, int $maxtoshow)
                  {
                      $query = DB::table('name')
                          ->join('individuals', static function (JoinClause $join): void {
                              $join
              Severity: Minor
              Found in app/Statistics/Repository/IndividualRepository.php - About 2 hrs 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 ifStartHandler has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function ifStartHandler(array $attrs): void
                  {
                      if ($this->process_ifs > 0) {
                          $this->process_ifs++;
              
              
              Severity: Minor
              Found in app/Report/ReportParserGenerate.php - About 2 hrs 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 BadBotBlocker.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * webtrees: online genealogy
               * Copyright (C) 2023 webtrees development team
              Severity: Minor
              Found in app/Http/Middleware/BadBotBlocker.php - About 2 hrs to fix

                Function updateTree has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                TreeViewHandler.prototype.updateTree = function (center, button) {
                  var tv = this; // Store "this" for usage within jQuery functions where "this" is not this ;-)
                  var to_load = [];
                  var elts = [];
                  this.getSize();
                Severity: Major
                Found in resources/js/treeview.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language