fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

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

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $this->layout = 'layouts/administration';

        $tree  = Validator::attributes($request)->tree();
Severity: Minor
Found in app/Http/RequestHandlers/MergeFactsPage.php - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $tree       = Validator::attributes($request)->tree();
        $xref       = Validator::attributes($request)->isXref()->string('xref');
        $individual = Registry::individualFactory()->make($xref, $tree);
Severity: Minor
Found in app/Http/RequestHandlers/LinkChildToFamilyAction.php - About 1 hr 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 facts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function facts(
        array $filter = [],
        bool $sort = false,
        int|null $access_level = null,
        bool $ignore_deleted = false
Severity: Minor
Found in app/GedcomRecord.php - About 1 hr 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 historicEventsAll has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function historicEventsAll(): Collection
    {
        switch (I18N::languageTag()) {
            case 'de':
                return new Collection([
Severity: Minor
Found in app/Module/AustrianHistoricEvents.php - About 1 hr to fix

    Method getBlock has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
        {
            $calendar_service = new CalendarService();
    
            $default_events = implode(',', self::DEFAULT_EVENTS);
    Severity: Minor
    Found in app/Module/OnThisDayModule.php - About 1 hr to fix

      Method boundingRectangle has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function boundingRectangle(): array
          {
              if ($this->id() === null) {
                  return [[-180.0, -90.0], [180.0, 90.0]];
              }
      Severity: Minor
      Found in app/PlaceLocation.php - About 1 hr to fix

        Method chartAge has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function chartAge(): string
            {
                $out = [];
                foreach ($this->queryRecords() as $record) {
                    $out[$record->century][$record->sex] = $record->age;
        Severity: Minor
        Found in app/Statistics/Google/ChartAge.php - About 1 hr to fix

          Method chartMarriageAge has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function chartMarriageAge(): string
              {
                  $out = [];
          
                  foreach ($this->queryRecords() as $record) {
          Severity: Minor
          Found in app/Statistics/Google/ChartMarriageAge.php - About 1 hr to fix

            Method oldStyleRelationshipPath has 46 lines of code (exceeds 25 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 1 hr to fix

              Method alphabet has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function alphabet(): array
                  {
                      return [
                          'A',
                          UTF8::LATIN_CAPITAL_LETTER_A_WITH_ACUTE,
              Severity: Minor
              Found in app/Module/LanguageHungarian.php - About 1 hr to fix

                Method legacyCousinName2 has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function legacyCousinName2(int $n, string $sex, string $relation): string
                    {
                        if ($sex === 'M') {
                            switch ($n) {
                                case 1:
                Severity: Minor
                Found in app/Services/RelationshipService.php - About 1 hr to fix

                  Method handleCollection has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handleCollection(ServerRequestInterface $request, Collection $collection, array $search_columns, array $sort_columns, Closure $callback): ResponseInterface
                      {
                          $search = Validator::queryParams($request)->array('search')['value'] ?? '';
                          $start  = Validator::queryParams($request)->integer('start', 0);
                          $length = Validator::queryParams($request)->integer('length', 0);
                  Severity: Minor
                  Found in app/Services/DatatablesService.php - About 1 hr to fix

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

                        public function handle(ServerRequestInterface $request): ResponseInterface
                        {
                            $mail_ssl_options       = $this->email_service->mailSslOptions();
                            $mail_transport_options = $this->email_service->mailTransportOptions();
                    
                    
                    Severity: Minor
                    Found in app/Http/RequestHandlers/EmailPreferencesPage.php - About 1 hr to fix

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

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree    = Validator::attributes($request)->tree();
                              $search  = Validator::parsedBody($request)->string('search');
                              $replace = Validator::parsedBody($request)->string('replace');
                      Severity: Minor
                      Found in app/Http/RequestHandlers/SearchReplaceAction.php - About 1 hr to fix

                        Method ageBetweenSpousesQuery has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function ageBetweenSpousesQuery(string $age_dir, int $total): array
                            {
                                $query = DB::table('families')
                                    ->where('f_file', '=', $this->tree->id())
                                    ->join('dates AS wife', static function (JoinClause $join): void {
                        Severity: Minor
                        Found in app/Statistics/Repository/FamilyRepository.php - About 1 hr to fix

                          Method imageStartHandler has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function imageStartHandler(array $attrs): void
                              {
                                  // Position the top corner of this box on the page. the default is the current position
                                  $top = (float) ($attrs['top'] ?? ReportBaseElement::CURRENT_POSITION);
                          
                          
                          Severity: Minor
                          Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                            Method make has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function make(string $xref, Tree $tree, string|null $gedcom = null): GedcomRecord|null
                                {
                                    // We know the type of the record.  Return it directly.
                                    if ($gedcom !== null && preg_match('/^0(?: @[^@]+@)? ([A-Z_]+)/', $gedcom, $match)) {
                                        switch ($match[1]) {
                            Severity: Minor
                            Found in app/Factories/GedcomRecordFactory.php - About 1 hr to fix

                              Method search has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function search(ServerRequestInterface $request): Collection
                                  {
                                      $tree   = Validator::attributes($request)->tree();
                                      $query  = Validator::queryParams($request)->string('query');
                                      $xref   = Validator::queryParams($request)->string('extra', '');
                              Severity: Minor
                              Found in app/Http/RequestHandlers/AutoCompleteCitation.php - About 1 hr to fix

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

                                    public function handle(ServerRequestInterface $request): ResponseInterface
                                    {
                                        $tree           = Validator::attributes($request)->tree();
                                        $params         = $request->getQueryParams();
                                        $params['tree'] = $tree->name();
                                Severity: Minor
                                Found in app/Http/RequestHandlers/PendingChangesLogData.php - About 1 hr to fix

                                  Method editLinesToGedcom has 45 lines of code (exceeds 25 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 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language