fisharebest/webtrees

View on GitHub

Showing 1,727 of 2,400 total issues

Method ageOfMarriageQuery has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function ageOfMarriageQuery(string $type, string $age_dir, int $total): string
    {
        $hrows = DB::table('families')
            ->where('f_file', '=', $this->tree->id())
            ->join('dates AS married', static function (JoinClause $join): void {
Severity: Major
Found in app/Statistics/Repository/FamilyRepository.php - About 5 hrs to fix

    Function getBlock has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
        {
            $old_language = I18N::languageTag();
    
            $sendmail = (bool) $this->getBlockSetting($block_id, 'sendmail', '1');
    Severity: Minor
    Found in app/Module/ReviewChangesModule.php - About 5 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 editLinesToGedcom has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function editLinesToGedcom(string $record_type, array $levels, array $tags, array $values, bool $append = true): string
        {
            // Assert all arrays are the same size.
            $count = count($levels);
            assert($count > 0);
    Severity: Minor
    Found in app/Services/GedcomEditService.php - About 5 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 docStartHandler has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function docStartHandler(array $attrs): void
        {
            $this->parser = $this->xml_parser;
    
            // Custom page width
    Severity: Minor
    Found in app/Report/ReportParserGenerate.php - About 5 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 usersLoggedInQuery has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        private function usersLoggedInQuery(string $type): string
        {
            $content   = '';
            $anonymous = 0;
            $logged_in = [];
    Severity: Minor
    Found in app/Statistics/Repository/UserRepository.php - About 5 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

    Method censusPlaces has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function censusPlaces(string $locale): array
        {
            switch ($locale) {
                case 'cs':
                    return [
    Severity: Major
    Found in app/Census/Census.php - About 5 hrs to fix

      Function getStepFamilyLabel has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getStepFamilyLabel(Family $step_family): string
          {
              foreach ($this->childFamilies() as $family) {
                  if ($family !== $step_family) {
                      // Must be a step-family
      Severity: Minor
      Found in app/Individual.php - About 5 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

      FamilyDatesRepository has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class FamilyDatesRepository implements FamilyDatesRepositoryInterface
      {
          /**
           * Sorting directions.
           */
      Severity: Minor
      Found in app/Statistics/Repository/FamilyDatesRepository.php - About 5 hrs to fix

        Function postDownloadAction has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function postDownloadAction(ServerRequestInterface $request): ResponseInterface
            {
                $tree = Validator::attributes($request)->tree();
        
                if (Auth::isAdmin()) {
        Severity: Minor
        Found in app/Module/ClippingsCartModule.php - About 4 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 getCalendarEvents has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getCalendarEvents(int $jd1, int $jd2, string $facts, Tree $tree, string $filterof = '', string $filtersx = ''): array
            {
                // Events that start or end during the period
                $query = DB::table('dates')
                    ->where('d_file', '=', $tree->id())
        Severity: Minor
        Found in app/Services/CalendarService.php - About 4 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

        Method handle has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                $this->layout = 'layouts/ajax';
        
                $tree = Validator::attributes($request)->tree();
        Severity: Major
        Found in app/Http/RequestHandlers/GedcomLoad.php - About 4 hrs to fix

          SearchService has 37 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class SearchService
          {
              // Do not attempt to show search results larger than this/
              protected const MAX_SEARCH_RESULTS = 5000;
          
          
          Severity: Minor
          Found in app/Services/SearchService.php - About 4 hrs to fix

            Relationship has 37 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Relationship
            {
                // The basic components of a relationship.
                // These strings are needed for compatibility with the legacy algorithm.
                // Once that has been replaced, it may be more efficient to use integers here.
            Severity: Minor
            Found in app/Relationship.php - About 4 hrs to fix

              Function export has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function export(
                      Tree $tree,
                      bool $sort_by_xref = false,
                      string $encoding = UTF8::NAME,
                      int $access_level = Auth::PRIV_HIDE,
              Severity: Minor
              Found in app/Services/GedcomExportService.php - About 4 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 getPersonNameStartHandler has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getPersonNameStartHandler(array $attrs): void
                  {
                      $id    = '';
                      $match = [];
                      if (empty($attrs['id'])) {
              Severity: Minor
              Found in app/Report/ReportParserGenerate.php - About 4 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

              Method upgrade has 118 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function upgrade(): void
                  {
                      // It is simpler to create a new table than to update the existing one.
              
                      if (!DB::schema()->hasTable('place_location')) {
              Severity: Major
              Found in app/Schema/Migration44.php - About 4 hrs to fix

                File I18N.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

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

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $this->layout = 'layouts/ajax';
                  
                          $tree = Validator::attributes($request)->tree();
                  Severity: Minor
                  Found in app/Http/RequestHandlers/GedcomLoad.php - About 4 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 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $source  = Validator::parsedBody($request)->isInArray(['client', 'server'])->string('source');
                          $options = Validator::parsedBody($request)->isInArray(['add', 'addupdate', 'update'])->string('options');
                  
                  
                  Severity: Minor
                  Found in app/Http/RequestHandlers/MapDataImportAction.php - About 4 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 addAncestors has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function addAncestors(array &$list, string $pid, bool $children = false, int $generations = -1): void
                      {
                          $genlist                = [$pid];
                          $list[$pid]->generation = 1;
                          while (count($genlist) > 0) {
                  Severity: Minor
                  Found in app/Report/ReportParserGenerate.php - About 4 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

                  Severity
                  Category
                  Status
                  Source
                  Language