fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Method values has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function values(string $sex = 'U'): array
    {
        $values = [
            'M' => [
                ''                 => '',
Severity: Major
Found in app/Elements/RelationIsDescriptor.php - About 3 hrs to fix

    Method customSubTags has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function customSubTags(): array
        {
            $custom_family_tags     = array_filter(explode(',', Site::getPreference('CUSTOM_FAMILY_TAGS')));
            $custom_individual_tags = array_filter(explode(',', Site::getPreference('CUSTOM_INDIVIDUAL_TAGS')));
    
    
    Severity: Major
    Found in app/Gedcom.php - About 3 hrs to fix

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

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              $this->layout = 'layouts/administration';
      
              $filesystem      = new Filesystem(new LocalFilesystemAdapter(Webtrees::ROOT_DIR));
      Severity: Major
      Found in app/Http/RequestHandlers/ControlPanel.php - About 3 hrs to fix

        Function individualBoxFacts has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function individualBoxFacts(Individual $individual): string
            {
                $html = '';
        
                $opt_tags = preg_split('/\W/', $individual->tree()->getPreference('CHART_BOX_TAGS'), 0, PREG_SPLIT_NO_EMPTY);
        Severity: Minor
        Found in app/Module/ModuleThemeTrait.php - About 3 hrs 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 make has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function make(string $date): AbstractCalendarDate
            {
                // Valid calendar escape specified? - use it
                if (preg_match('/^(@#D(?:GREGORIAN|JULIAN|HEBREW|HIJRI|JALALI|FRENCH R|ROMAN)+@) ?(.*)/', $date, $match)) {
                    $cal  = $match[1];
        Severity: Minor
        Found in app/Factories/CalendarDateFactory.php - About 3 hrs 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 process has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
            {
                // Ugly URLs store the path in a query parameter.
                $url_route = Validator::queryParams($request)->string('route', '');
        
        
        Severity: Minor
        Found in app/Http/Middleware/Router.php - About 3 hrs 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 varStartHandler has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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

        File SiteMapModule.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * webtrees: online genealogy
         * Copyright (C) 2023 webtrees development team
        Severity: Minor
        Found in app/Module/SiteMapModule.php - About 3 hrs to fix

          Method daitchMokotoffWord has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function daitchMokotoffWord(string $name): array
              {
                  // Apply special transformation rules to the input string
                  $name = I18N::strtoupper($name);
                  foreach (self::TRANSFORM_NAMES as $transformRule) {
          Severity: Major
          Found in app/Soundex.php - About 3 hrs to fix

            File BranchesListModule.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * webtrees: online genealogy
             * Copyright (C) 2023 webtrees development team
            Severity: Minor
            Found in app/Module/BranchesListModule.php - About 3 hrs to fix

              Auth has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Auth
              {
                  // Privacy constants
                  public const PRIV_PRIVATE = 2; // Allows visitors to view the item
                  public const PRIV_USER    = 1; // Allows members to access the item
              Severity: Minor
              Found in app/Auth.php - About 3 hrs to fix

                PdfRenderer has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class PdfRenderer extends AbstractRenderer
                {
                    /**
                     * PDF compression - Zlib extension is required
                     *
                Severity: Minor
                Found in app/Report/PdfRenderer.php - About 3 hrs to fix

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

                      public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                      {
                          $old_language = I18N::languageTag();
                  
                          $sendmail = (bool) $this->getBlockSetting($block_id, 'sendmail', '1');
                  Severity: Major
                  Found in app/Module/ReviewChangesModule.php - About 3 hrs to fix

                    Method handle has 79 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: Major
                    Found in app/Http/RequestHandlers/TreePreferencesPage.php - About 3 hrs to fix

                      Method cellStartHandler has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function cellStartHandler(array $attrs): void
                          {
                              // string The text alignment of the text in this box.
                              $align = $attrs['align'] ?? '';
                              // RTL supported left/right alignment
                      Severity: Major
                      Found in app/Report/ReportParserGenerate.php - About 3 hrs to fix

                        File SetupWizard.php has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        /**
                         * webtrees: online genealogy
                         * Copyright (C) 2023 webtrees development team
                        Severity: Minor
                        Found in app/Http/RequestHandlers/SetupWizard.php - About 3 hrs to fix

                          Method detect has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function detect(string $header): EncodingInterface|null
                              {
                                  $utf_bom = [
                                      '/^' . UTF8::BYTE_ORDER_MARK . '/'    => UTF8::NAME,
                                      '/^' . UTF16BE::BYTE_ORDER_MARK . '/' => UTF16BE::NAME,
                          Severity: Major
                          Found in app/Factories/EncodingFactory.php - About 3 hrs to fix

                            Method handle has 78 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: Major
                            Found in app/Http/RequestHandlers/MapDataExportCSV.php - About 3 hrs to fix

                              Function updateTree has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                              Open

                              TreeViewHandler.prototype.updateTree = function (center, button) {
                                var tv = this; // Store "this" for usage within jQuery functions where "this" is not this ;-)
                                var to_load = [];
                                var elts = [];
                                this.getSize();
                              Severity: Minor
                              Found in resources/js/treeview.js - About 3 hrs 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 getBlock has 77 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();
                              
                                      $days      = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
                              Severity: Major
                              Found in app/Module/YahrzeitModule.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language