fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Method columns has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function columns(): array
    {
        return [
            new CensusColumnFullName($this, 'Name', 'Name of each person in family, household or institution'),
            new CensusColumnNull($this, 'Place of Abode', 'In rural localities give parish or township. In cities, towns and villages, give street and number of dwelling'),
Severity: Minor
Found in app/Census/CensusOfCanada1931.php - About 1 hr to fix

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

        public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
        {
            $show_other      = $this->getBlockSetting($block_id, 'show_other', self::DEFAULT_SHOW_OTHER);
            $show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', self::DEFAULT_SHOW_UNASSIGNED);
            $show_future     = $this->getBlockSetting($block_id, 'show_future', self::DEFAULT_SHOW_FUTURE);
    Severity: Minor
    Found in app/Module/ResearchTaskModule.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 wrapLongLines has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function wrapLongLines(string $gedcom, int $max_line_length): string
        {
            $lines = [];
    
            foreach (explode("\n", $gedcom) as $line) {
    Severity: Minor
    Found in app/Services/GedcomExportService.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 13 (exceeds 5 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

    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 compare has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function compare(Date $a, Date $b): int
        {
            // Get min/max JD for each date.
            switch ($a->qual1) {
                case 'BEF':
    Severity: Minor
    Found in app/Date.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 getEstimatedDeathDate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getEstimatedDeathDate(): Date
        {
            if ($this->estimated_death_date === null) {
                foreach ($this->getAllDeathDates() as $date) {
                    if ($date->isOK()) {
    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 marriageQuery has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function marriageQuery(string $type, string $age_dir, string $sex, bool $show_years): string
        {
            if ($sex === 'F') {
                $sex_field = 'f_wife';
            } else {
    Severity: Minor
    Found in app/Statistics/Repository/FamilyRepository.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 parentsQuery has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function parentsQuery(string $type, string $age_dir, string $sex, bool $show_years): string
        {
            if ($sex === 'F') {
                $sex_field = 'WIFE';
            } else {
    Severity: Minor
    Found in app/Statistics/Repository/FamilyRepository.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 searchPlaces has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function searchPlaces(Tree $tree, string $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
        {
            $query = DB::table('places AS p0')
                ->where('p0.p_file', '=', $tree->id())
                ->leftJoin('places AS p1', 'p1.p_id', '=', 'p0.p_parent_id')
    Severity: Minor
    Found in app/Services/SearchService.php - About 1 hr to fix

      Method handle has 39 lines of code (exceeds 25 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/PendingChangesLogPage.php - About 1 hr to fix

        Method countCommonXrefs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function countCommonXrefs(Tree $tree1, Tree $tree2): int
            {
                $subquery1 = DB::table('individuals')
                    ->where('i_file', '=', $tree1->id())
                    ->select(['i_id AS xref'])
        Severity: Minor
        Found in app/Services/AdminService.php - About 1 hr to fix

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

              public function handle(ServerRequestInterface $request): ResponseInterface
              {
                  $this->layout = 'layouts/administration';
          
                  // First and last change in the database
          Severity: Minor
          Found in app/Http/RequestHandlers/SiteLogsPage.php - About 1 hr to fix

            Method bootstrap has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function bootstrap(): self
                {
                    // Show all errors and warnings in development, fewer in production.
                    error_reporting(self::ERROR_REPORTING);
            
            
            Severity: Minor
            Found in app/Webtrees.php - About 1 hr to fix

              Method render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function render($renderer, bool $attrib = true): void
                  {
                      // Set up the style
                      if ($renderer->getCurrentStyle() !== $this->styleName) {
                          $renderer->setCurrentStyle($this->styleName);
              Severity: Minor
              Found in app/Report/ReportHtmlText.php - About 1 hr to fix

                Function initializeTomSelect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  webtrees.initializeTomSelect = function (element) {
                    if (element.tomselect) {
                      return element.tomselect;
                    }
                
                
                Severity: Minor
                Found in resources/js/webtrees.js - About 1 hr to fix

                  Method getAdminAction has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getAdminAction(ServerRequestInterface $request): ResponseInterface
                      {
                          $this->layout = 'layouts/administration';
                  
                          // This module can't run without a tree
                  Severity: Minor
                  Found in app/Module/FrequentlyAskedQuestionsModule.php - About 1 hr to fix

                    Method getMenu has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getMenu(Tree $tree): Menu|null
                        {
                            $request = Registry::container()->get(ServerRequestInterface::class);
                            $route   = Validator::attributes($request)->route();
                            $cart    = Session::get('cart');
                    Severity: Minor
                    Found in app/Module/ClippingsCartModule.php - About 1 hr to fix

                      Method tags has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function tags(): array
                          {
                              return [
                                  'FAM:MARR_CIVIL'           => new Marriage(I18N::translate('Civil marriage')),
                                  'FAM:MARR_PARTNERS'        => new Marriage(I18N::translate('Registered partnership')),
                      Severity: Minor
                      Found in app/CustomTags/Aldfaer.php - About 1 hr to fix

                        Method mediaFileThumbnailResponse has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function mediaFileThumbnailResponse(
                                MediaFile $media_file,
                                int $width,
                                int $height,
                                string $fit,
                        Severity: Minor
                        Found in app/Factories/ImageFactory.php - About 1 hr to fix

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

                              public function handle(ServerRequestInterface $request): ResponseInterface
                              {
                                  $tree        = Validator::attributes($request)->tree();
                                  $note        = Validator::parsedBody($request)->string('media-note');
                                  $title       = Validator::parsedBody($request)->string('title');
                          Severity: Minor
                          Found in app/Http/RequestHandlers/CreateMediaObjectAction.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language