fisharebest/webtrees

View on GitHub

Showing 1,726 of 2,403 total issues

Method queryRecords has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function queryRecords(): Collection
    {
        return DB::table('individuals')
            ->select([
                new Expression('AVG(' . DB::prefix('death.d_julianday2') . ' - ' . DB::prefix('birth.d_julianday1') . ') / 365.25 AS age'),
Severity: Minor
Found in app/Statistics/Google/ChartAge.php - About 1 hr to fix

    Method significantIndividual has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function significantIndividual(UserInterface $user, string $xref = ''): Individual
        {
            if ($xref === '') {
                $individual = null;
            } else {
    Severity: Minor
    Found in app/Tree.php - About 1 hr to fix

      Function allMedia has a Cognitive Complexity of 11 (exceeds 5 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

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

          private function findAxisEntry($value, array $axis)
          {
              if (is_numeric($value)) {
                  $value = (int) $value;
      
      
      Severity: Minor
      Found in app/Module/StatisticsChartModule.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 getPatriarchsHtml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getPatriarchsHtml(Tree $tree, array $individuals, array $ancestors, string $surname, bool $soundex_dm, bool $soundex_std): string
          {
              $html = '';
              foreach ($individuals as $individual) {
                  foreach ($individual->childFamilies() as $family) {
      Severity: Minor
      Found in app/Module/BranchesListModule.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 updateTreeBlocks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateTreeBlocks(int $tree_id, Collection $main_block_ids, Collection $side_block_ids): void
          {
              $existing_block_ids = DB::table('block')
                  ->where('gedcom_id', '=', $tree_id)
                  ->whereIn('location', [ModuleBlockInterface::MAIN_BLOCKS, ModuleBlockInterface::SIDE_BLOCKS])
      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 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              $tree = Validator::attributes($request)->tree();
              $user = Validator::attributes($request)->user();
      
      
      Severity: Minor
      Found in app/Http/RequestHandlers/MediaFileThumbnail.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
          {
              if ($request->getMethod() === RequestMethodInterface::METHOD_POST) {
                  $route = Validator::attributes($request)->route();
      
      
      Severity: Minor
      Found in app/Http/Middleware/CheckCsrf.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 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function handle(ServerRequestInterface $request): ResponseInterface
          {
              $user           = Validator::attributes($request)->user();
              $user_id        = Validator::parsedBody($request)->integer('user_id');
              $username       = Validator::parsedBody($request)->string('username');
      Severity: Minor
      Found in app/Http/RequestHandlers/UserEditAction.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 updateUserBlocks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateUserBlocks(int $user_id, Collection $main_block_ids, Collection $side_block_ids): void
          {
              $existing_block_ids = DB::table('block')
                  ->where('user_id', '=', $user_id)
                  ->whereIn('location', [ModuleBlockInterface::MAIN_BLOCKS, ModuleBlockInterface::SIDE_BLOCKS])
      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 mediaObjectInfo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function mediaObjectInfo(Media $media): string
          {
              $element = Registry::elementFactory()->make('NOTE:CONC');
              $html    = '<a href="' . e($media->url()) . '" title="' . e($media->tree()->title()) . '">' . $media->fullName() . '</a>';
      
      
      Severity: Minor
      Found in app/Http/RequestHandlers/ManageMediaData.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 __construct has a Cognitive Complexity of 11 (exceeds 5 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

      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 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render($renderer): void
          {
              static $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
      
              // Check for a pagebreak first
      Severity: Minor
      Found in app/Report/ReportPdfImage.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 parseFacts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseFacts(): array
          {
              // Split the record into facts
              if ($this->gedcom !== '') {
                  $gedcom_facts = preg_split('/\n(?=1)/', $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 getChartAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getChartAction(ServerRequestInterface $request): ResponseInterface
          {
              $tree = Validator::attributes($request)->tree();
              $user = Validator::attributes($request)->user();
      
      
      Severity: Minor
      Found in app/Module/StatisticsChartModule.php - About 1 hr to fix

        Method previousLink has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function previousLink(Individual $individual, string $style, int $generations): string
            {
                $icon = view('icons/arrow-' . self::MIRROR_STYLE[$style]);
        
                $siblings = [];
        Severity: Minor
        Found in app/Module/PedigreeChartModule.php - About 1 hr to fix

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

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

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

                public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
                {
                    $num = (int) $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER_TO_SHOW);
            
                    extract($config, EXTR_OVERWRITE);
            Severity: Minor
            Found in app/Module/TopPageViewsModule.php - About 1 hr to fix

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

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

                Method getAdminEditAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getAdminEditAction(ServerRequestInterface $request): ResponseInterface
                    {
                        $this->layout = 'layouts/administration';
                
                        $block_id = Validator::queryParams($request)->integer('block_id', 0);
                Severity: Minor
                Found in app/Module/FrequentlyAskedQuestionsModule.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language