jon48/webtrees-lib

View on GitHub

Showing 758 of 758 total issues

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

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if ($this->module === null) {
            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
        }
Severity: Minor
Found in app/Module/Sosa/Http/RequestHandlers/SosaConfig.php - About 1 hr to fix

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

        public function all(bool $sync_available = false, bool $include_disabled = true): Collection
        {
            $tasks_schedules = DB::table('maj_admintasks')
                ->select()
                ->get()
    Severity: Minor
    Found in app/Module/AdminTasks/Services/TaskScheduleService.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 handle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handle(ServerRequestInterface $request): ResponseInterface
        {
            $this->layout = 'layouts/ajax';
    
            if ($this->module === null) {
    Severity: Minor
    Found in app/Module/Sosa/Http/RequestHandlers/AncestorsListIndividual.php - About 1 hr to fix

      Method convert has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function convert(GeoAnalysisResult $result): MapAdapterResult
          {
              $result = $result->copy();
      
              $features = [];
      Severity: Minor
      Found in app/Module/GeoDispersion/Model/GeoAnalysisMapAdapter.php - About 1 hr to fix

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

            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                $tree = Validator::attributes($request)->tree();
        
                if ($this->module === null) {

          Avoid using short method names like TaskSchedule::id(). The configured minimum method name length is 3.
          Open

              public function id(): int
              {
                  return $this->id;
              }
          Severity: Minor
          Found in app/Common/Tasks/TaskSchedule.php by phpmd

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Avoid using short method names like MapDefinitionInterface::id(). The configured minimum method name length is 3.
          Open

              public function id(): string;

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Avoid using short method names like SimpleFilesystemMap::id(). The configured minimum method name length is 3.
          Open

              public function id(): string
              {
                  return $this->id;
              }

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Avoid using short method names like AbstractGeoAnalysisView::id(). The configured minimum method name length is 3.
          Open

              public function id(): int
              {
                  return $this->id;
              }

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Avoid using short method names like GeoAnalysisMapAdapter::id(). The configured minimum method name length is 3.
          Open

              public function id(): int
              {
                  return $this->id;
              }

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Method targetId has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function targetId(string $source, string $source_format, string $target_format): ?string
              {
                  // Extract parts for the WHERE clause
                  $source_format = str_replace(['{', '}'], ['{#', '#}'], $source_format);
                  $source_parts = preg_split('/[{}]/i', $source_format);
          Severity: Minor
          Found in app/Module/GeoDispersion/Services/PlacesReferenceTableService.php - About 1 hr to fix

            Method visits has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function visits(WelcomeBlockModule $module, int $block_id, string $period): ?int
                {
                    $settings = $module->matomoSettings($block_id);
            
                    if (
            Severity: Minor
            Found in app/Module/WelcomeBlock/Services/MatomoStatsService.php - About 1 hr to fix

              Method upgrade has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function upgrade(): void
                  {
                      if (!DB::schema()->hasTable('maj_geodispersion')) {
                          return;
                      }
              Severity: Minor
              Found in app/Module/GeoDispersion/Schema/Migration2.php - About 1 hr to fix

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

                    public function handle(ServerRequestInterface $request): ResponseInterface
                    {
                        if ($this->module === null) {
                            FlashMessages::addMessage(
                                I18N::translate('The attached module could not be found.'),
                Severity: Minor
                Found in app/Module/AdminTasks/Http/RequestHandlers/TaskStatusAction.php - About 1 hr to fix

                  Method all has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function all(bool $include_disabled = false): Collection
                      {
                          return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection {
                              $hooks_info = DB::table('maj_hook_order')
                                  ->get()
                  Severity: Minor
                  Found in app/Module/Hooks/Services/HookService.php - About 1 hr to fix

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

                        public function handle(ServerRequestInterface $request): ResponseInterface
                        {
                            $this->layout = 'layouts/ajax';
                    
                            if ($this->module === null) {
                    Severity: Minor
                    Found in app/Module/Sosa/Http/RequestHandlers/AncestorsListFamily.php - About 1 hr to fix

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

                          public function handle(ServerRequestInterface $request): ResponseInterface
                          {
                              $tree = Validator::attributes($request)->tree();
                      
                              if ($this->module === null) {

                        Function results has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function results(Tree $tree, int $depth): GeoAnalysisResults
                            {
                                $results = new GeoAnalysisResults();
                        
                                $unique_ancestors = $this->records_service
                        Severity: Minor
                        Found in app/Module/Sosa/GeoAnalyses/SosaByGenerationGeoAnalysis.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
                            {
                                $this->layout = 'layouts/ajax';
                        
                                if ($this->module === null) {

                        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 loadRoutes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function loadRoutes($router): void
                            {
                                $router->attach('', '', static function (Map $router): void {
                        
                                    $router->attach('', '/module-maj/certificates', static function (Map $router): void {
                        Severity: Minor
                        Found in app/Module/Certificates/CertificatesModule.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language