fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

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

    public function __construct(array|int|AbstractCalendarDate $date)
    {
        // Construct from an integer (a julian day number)
        if (is_int($date)) {
            $this->minimum_julian_day = $date;
Severity: Minor
Found in app/Date/AbstractCalendarDate.php - About 2 hrs to fix

    Method labelValue has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function labelValue(string $value, Tree $tree): string
        {
            $id       = Registry::idFactory()->id();
            $expanded = $tree->getPreference('EXPAND_NOTES') === '1';
    
    
    Severity: Minor
    Found in app/Elements/NoteStructure.php - About 2 hrs to fix

      Method allMedia has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function allMedia(Tree $tree, string $folder, bool $subfolders, string $sort, string $filter, string $format): Collection
          {
              $query = DB::table('media')
                  ->join('media_file', static function (JoinClause $join): void {
                      $join
      Severity: Minor
      Found in app/Module/MediaListModule.php - About 1 hr to fix

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

            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                $parent_id = Validator::parsedBody($request)->string('parent_id');
                $place_id  = Validator::parsedBody($request)->string('place_id');
                $latitude  = Validator::parsedBody($request)->string('new_place_lati');
        Severity: Minor
        Found in app/Http/RequestHandlers/MapDataSave.php - About 1 hr to fix

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

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

            Method centuryName has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function centuryName(int $century): string
                {
                    if ($century < 0) {
                        return I18N::translate('%s BCE', $this->centuryName(-$century));
                    }
            Severity: Minor
            Found in app/Statistics/Service/CenturyService.php - About 1 hr to fix

              Method setVarStartHandler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method leafletJsTileLayers has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function leafletJsTileLayers(): array
                    {
                        $api_key = $this->getPreference('api_key');
                
                        return [
                Severity: Minor
                Found in app/Module/HereMaps.php - About 1 hr to fix

                  Method handle has 48 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();
                          $xref        = Validator::attributes($request)->isXref()->string('xref');
                  Severity: Minor
                  Found in app/Module/FamilyBookChartModule.php - About 1 hr to fix

                    Method uploadFile has 48 lines of code (exceeds 25 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

                      Method importMissingLocations has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function importMissingLocations(): void
                          {
                              $all_places = DB::table('places AS p0')
                                  ->leftJoin('places AS p1', 'p1.p_id', '=', 'p0.p_parent_id')
                                  ->leftJoin('places AS p2', 'p2.p_id', '=', 'p1.p_parent_id')
                      Severity: Minor
                      Found in app/Services/MapDataService.php - About 1 hr to fix

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

                            public function handle(ServerRequestInterface $request): ResponseInterface
                            {
                                $this->layout = 'layouts/setup';
                        
                                // Some functions need a cache, but we don't have one yet.
                        Severity: Minor
                        Found in app/Http/RequestHandlers/SetupWizard.php - About 1 hr to fix

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

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $data_filesystem = Registry::filesystem()->data();
                                  $all_folders     = $this->media_file_service->allMediaFolders($data_filesystem);
                          
                          
                          Severity: Minor
                          Found in app/Http/RequestHandlers/UploadMediaAction.php - About 1 hr to fix

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

                                public function handle(ServerRequestInterface $request): ResponseInterface
                                {
                                    $token    = $request->getAttribute('token');
                                    $tree     = Validator::attributes($request)->treeOptional();
                                    $username = $request->getAttribute('username');
                            Severity: Minor
                            Found in app/Http/RequestHandlers/VerifyEmail.php - About 1 hr to fix

                              Method addDescendancy has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function addDescendancy(&$list, $pid, $parents = false, $generations = -1): void
                                  {
                                      $person = Registry::individualFactory()->make($pid, $this->tree);
                                      if ($person === null) {
                                          return;
                              Severity: Minor
                              Found in app/Report/ReportParserGenerate.php - About 1 hr to fix

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

                                    public function summary(): string
                                    {
                                        $attributes = [];
                                        $target     = $this->target();
                                        if ($target instanceof GedcomRecord) {
                                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 individuals has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function individuals(Tree $tree, array $surns_to_show, string $galpha, bool $marnm, bool $fams): Collection
                                    {
                                        $query = DB::table('individuals')
                                            ->join('name', static function (JoinClause $join): void {
                                                $join
                                Severity: Minor
                                Found in app/Module/AbstractIndividualListModule.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 getFactsWithSources has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function getFactsWithSources(Individual $individual): Collection
                                    {
                                        if ($this->facts === null) {
                                            $facts = $individual->facts();
                                
                                
                                Severity: Minor
                                Found in app/Module/SourcesTabModule.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 chr has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function chr(int $code): string
                                    {
                                        if ($code < 0 || $code > 0x1FFFFF) {
                                            throw new InvalidArgumentException((string)$code);
                                        }
                                Severity: Minor
                                Found in app/Encodings/UTF8.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();
                                
                                        $delete_default_resn_id = Validator::parsedBody($request)->array('delete');
                                Severity: Minor
                                Found in app/Http/RequestHandlers/TreePrivacyAction.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