fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

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

    public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
    {
        $individual = $tree->significantIndividual(Auth::user());

        $links = [];
Severity: Minor
Found in app/Module/WelcomeBlockModule.php - About 1 hr to fix

    Method getTabContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getTabContent(Individual $individual): string
        {
            // Which facts and events are handled by other modules?
            $sidebar_facts = $this->module_service
                ->findByComponent(ModuleSidebarInterface::class, $individual->tree(), Auth::user())
    Severity: Minor
    Found in app/Module/IndividualFactsTabModule.php - About 1 hr to fix

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

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

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

          Method getRecentChangesFromGenealogy has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getRecentChangesFromGenealogy(Tree $tree, int $days): Collection
              {
                  $julian_day = Registry::timestampFactory()->now()->subtractDays($days)->julianDay();
          
                  $individuals = DB::table('dates')
          Severity: Minor
          Found in app/Module/RecentChangesModule.php - About 1 hr to fix

            Method layoutIndividuals has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function layoutIndividuals(array $individuals): array
                {
                    $color_generators = [
                        'M' => new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1),
                        'F' => new ColorGenerator(000, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE),
            Severity: Minor
            Found in app/Module/LifespansChartModule.php - About 1 hr to fix

              Method deliverMessage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function deliverMessage(UserInterface $sender, UserInterface $recipient, string $subject, string $body, string $url, string $ip): bool
                  {
                      $success = true;
              
                      // Temporarily switch to the recipient's language
              Severity: Minor
              Found in app/Services/MessageService.php - About 1 hr to fix

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

                    public function handle(ServerRequestInterface $request): ResponseInterface
                    {
                        $tree      = Validator::attributes($request)->tree();
                        $firstname = Validator::queryParams($request)->string('firstname', '');
                        $lastname  = Validator::queryParams($request)->string('lastname', '');
                Severity: Minor
                Found in app/Http/RequestHandlers/SearchPhoneticPage.php - About 1 hr to fix

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

                      public function handle(ServerRequestInterface $request): ResponseInterface
                      {
                          $parent_id = $request->getAttribute('parent_id');
                  
                          if ($parent_id === null) {
                  Severity: Minor
                  Found in app/Http/RequestHandlers/MapDataList.php - About 1 hr to fix

                    Method edit has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function edit(string $id, string $name, string $value, Tree $tree): string
                        {
                            $submitter_text = new SubmitterText('');
                            $xref_note      = new XrefNote('');
                    
                    
                    Severity: Minor
                    Found in app/Elements/NoteStructure.php - About 1 hr to fix

                      Method __construct has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function __construct(UploadedFileInterface|null $uploaded_file)
                          {
                              if ($uploaded_file === null) {
                                  parent::__construct(I18N::translate('No file was received. Please try again.'));
                      
                      
                      Severity: Minor
                      Found in app/Exceptions/FileUploadException.php - About 1 hr to fix

                        Method varStartHandler has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function varStartHandler(array $attrs): void
                            {
                                if (empty($attrs['var'])) {
                                    throw new DomainException('REPORT ERROR var: The attribute "var=" is missing or not set in the XML file on line: ' . xml_get_current_line_number($this->parser));
                                }
                        Severity: Minor
                        Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

                          Function typeComparator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function typeComparator(): Closure
                              {
                                  static $factsort = [];
                          
                                  if ($factsort === []) {
                          Severity: Minor
                          Found in app/Fact.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 uploadFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function uploadFile(ServerRequestInterface $request): string
                              {
                                  $tree          = Validator::attributes($request)->tree();
                                  $file_location = Validator::parsedBody($request)->string('file_location');
                          
                          
                          Severity: Minor
                          Found in app/Services/MediaFileService.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 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $parent_id = $request->getAttribute('parent_id');
                          
                                  if ($parent_id === null) {
                          Severity: Minor
                          Found in app/Http/RequestHandlers/MapDataExportGeoJson.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 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $tree     = Validator::attributes($request)->tree();
                                  $view     = Validator::attributes($request)->isInArray(['day', 'month', 'year'])->string('view');
                                  $cal      = Validator::queryParams($request)->string('cal', '');
                          Severity: Minor
                          Found in app/Http/RequestHandlers/CalendarPage.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 sosaStradonitzAncestors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function sosaStradonitzAncestors(Individual $individual, int $generations): Collection
                              {
                                  $ancestors = [1 => $individual];
                          
                                  $queue = [1];
                          Severity: Minor
                          Found in app/Services/ChartService.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 write has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function write(string $id, string $data): bool
                              {
                                  $ip_address = Validator::attributes($this->request)->string('client-ip');
                                  $user_id    = (int) Auth::id();
                                  $now        = Registry::timestampFactory()->now();
                          Severity: Minor
                          Found in app/SessionDatabaseHandler.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 utf8WordWrap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function utf8WordWrap(string $string, int $width): string
                              {
                                  $out = '';
                                  while ($string) {
                                      if (mb_strlen($string) <= $width) {
                          Severity: Minor
                          Found in app/Report/HtmlRenderer.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 getSecondaryName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getSecondaryName(): int
                              {
                                  if ($this->getSecondaryName === null) {
                                      // Generally, the primary and secondary names are the same
                                      $this->getSecondaryName = $this->getPrimaryName();
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language