fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Function checkDefaultUserBlocksExist has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkDefaultUserBlocksExist(): void
    {
        $has_blocks = DB::table('block')
            ->where('user_id', '=', -1)
            ->exists();
Severity: Minor
Found in app/Services/HomePageService.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $tree = Validator::attributes($request)->treeOptional();
        $user = Validator::attributes($request)->user();

Severity: Minor
Found in app/Http/RequestHandlers/AccountUpdate.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $default = Site::getPreference('DEFAULT_GEDCOM');
        $tree    = $this->tree_service->all()->get($default) ?? $this->tree_service->all()->first();
        $user    = Validator::attributes($request)->user();
Severity: Minor
Found in app/Http/RequestHandlers/HomePage.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $tree = Validator::attributes($request)->treeOptional();
        $user = Validator::attributes($request)->user();

Severity: Minor
Found in app/Http/RequestHandlers/LoginPage.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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $tree       = Validator::attributes($request)->tree();
        $xref       = Validator::attributes($request)->isXref()->string('xref');
        $slug       = Validator::attributes($request)->string('slug', '');
Severity: Minor
Found in app/Http/RequestHandlers/IndividualPage.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 updateRecord has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateRecord(string $gedrec, Tree $tree, bool $delete): void
    {
        if (preg_match('/^0 @(' . Gedcom::REGEX_XREF . ')@ (' . Gedcom::REGEX_TAG . ')/', $gedrec, $match)) {
            [, $gid, $type] = $match;
        } elseif (preg_match('/^0 (HEAD)(?:\n|$)/', $gedrec, $match)) {
Severity: Minor
Found in app/Services/GedcomImportService.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 generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate(Individual $individual, Individual $head): string
    {
        if ($individual->getBirthDate()->isOK()) {
            foreach ($individual->spouseFamilies() as $family) {
                foreach ($family->facts(['MARR'], true) as $fact) {
Severity: Minor
Found in app/Census/CensusColumnAgeMarried.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 childStepFamilies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function childStepFamilies(): Collection
    {
        $step_families = new Collection();
        $families      = $this->childFamilies();
        foreach ($families as $family) {
Severity: Minor
Found in app/Individual.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 spouseStepFamilies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function spouseStepFamilies(): Collection
    {
        $step_families = [];
        $families      = $this->spouseFamilies();

Severity: Minor
Found in app/Individual.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($renderer): void
    {
        static $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;

        // Get the current positions
Severity: Minor
Found in app/Report/ReportHtmlImage.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 endElement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function endElement($parser, string $name): void
    {
        if (($this->process_footnote || $name === 'Footnote') && ($this->process_ifs === 0 || $name === 'if') && ($this->process_gedcoms === 0 || $name === 'Gedcom') && ($this->process_repeats === 0 || $name === 'Facts' || $name === 'RepeatTag' || $name === 'List' || $name === 'Relatives')) {
            $method = $name . 'EndHandler';

Severity: Minor
Found in app/Report/ReportParserGenerate.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 privatizeGedcom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function privatizeGedcom(int $access_level): string
    {
        if ($access_level === Auth::PRIV_HIDE) {
            return $this->gedcom;
        }
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 sitemapRecords has 27 lines of code (exceeds 25 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 1 hr to fix

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

        public function handle(ServerRequestInterface $request): ResponseInterface
        {
            $tree        = Validator::attributes($request)->tree();
            $user        = Validator::attributes($request)->user();
            $generations = Validator::attributes($request)->isBetween(self::MINIMUM_GENERATIONS, self::MAXIMUM_GENERATIONS)->integer('generations');
    Severity: Minor
    Found in app/Module/PedigreeMapModule.php - About 1 hr to fix

      Method getFooter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getFooter(ServerRequestInterface $request): string
          {
              $tree = Validator::attributes($request)->treeOptional();
      
              if ($tree === null) {
      Severity: Minor
      Found in app/Module/ContactsFooterModule.php - About 1 hr to fix

        Method postEditNewsAction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function postEditNewsAction(ServerRequestInterface $request): ResponseInterface
            {
                $tree = Validator::attributes($request)->tree();
        
                if (!Auth::isManager($tree)) {
        Severity: Minor
        Found in app/Module/FamilyTreeNewsModule.php - About 1 hr to fix

          Method postEditJournalAction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function postEditJournalAction(ServerRequestInterface $request): ResponseInterface
              {
                  $tree = Validator::attributes($request)->tree();
          
                  if (!Auth::check()) {
          Severity: Minor
          Found in app/Module/UserJournalModule.php - About 1 hr to fix

            Method share has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function share(GedcomRecord $record): string
                {
                    if ($record instanceof Individual) {
                        $facts = $record->facts(static::INDIVIDUAL_EVENTS, true)
                            ->merge($record->spouseFamilies()->map(fn (Family $family): Collection => $family->facts(static::FAMILY_EVENTS, true)));
            Severity: Minor
            Found in app/Module/ShareAnniversaryModule.php - About 1 hr to fix

              Method getEditNewsAction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getEditNewsAction(ServerRequestInterface $request): ResponseInterface
                  {
                      $tree = Validator::attributes($request)->tree();
              
                      if (!Auth::isManager($tree)) {
              Severity: Minor
              Found in app/Module/FamilyTreeNewsModule.php - About 1 hr to fix

                Method mediaFileInfo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function mediaFileInfo(FilesystemOperator $data_filesystem, string $file): string
                    {
                        $html = '<dl>';
                        $html .= '<dt>' . I18N::translate('Filename') . '</dt>';
                        $html .= '<dd>' . e($file) . '</dd>';
                Severity: Minor
                Found in app/Http/RequestHandlers/ManageMediaData.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language