abrain/einsatzverwaltung

View on GitHub

Showing 198 of 250 total issues

File Update.php has 484 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace abrain\Einsatzverwaltung;

use WP_Error;
use WP_User;
Severity: Minor
Found in src/Update.php - About 7 hrs to fix

    File Formatter.php has 437 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace abrain\Einsatzverwaltung\Util;
    
    use abrain\Einsatzverwaltung\Frontend\AnnotationIconBar;
    use abrain\Einsatzverwaltung\Model\IncidentReport;
    Severity: Minor
    Found in src/Util/Formatter.php - About 6 hrs to fix

      Function format has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          private function format(?WP_Post $post, string $pattern, string $tag, $context = 'post'): string
          {
              if ($post == null && !in_array($tag, $this->tagsNotNeedingPost)) {
                  return $pattern;
              }
      Severity: Minor
      Found in src/Util/Formatter.php - About 4 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 ReportEditScreen.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      namespace abrain\Einsatzverwaltung\Admin;
      
      use abrain\Einsatzverwaltung\Model\IncidentReport;
      use abrain\Einsatzverwaltung\Types\IncidentType;
      Severity: Minor
      Found in src/Admin/ReportEditScreen.php - About 4 hrs to fix

        Method renderToolPage has 106 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function renderToolPage()
            {
                $this->helper = new Helper($this->utilities, $this->data);
                $this->helper->metaFields = IncidentReport::getMetaFields();
                $this->helper->taxonomies = IncidentReport::getTerms();
        Severity: Major
        Found in src/Import/Tool.php - About 4 hrs to fix

          Function renderToolPage has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function renderToolPage()
              {
                  $this->helper = new Helper($this->utilities, $this->data);
                  $this->helper->metaFields = IncidentReport::getMetaFields();
                  $this->helper->taxonomies = IncidentReport::getTerms();
          Severity: Minor
          Found in src/Import/Tool.php - About 4 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 format has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function format(?WP_Post $post, string $pattern, string $tag, $context = 'post'): string
              {
                  if ($post == null && !in_array($tag, $this->tagsNotNeedingPost)) {
                      return $pattern;
                  }
          Severity: Major
          Found in src/Util/Formatter.php - About 4 hrs to fix

            IncidentReport has 32 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class IncidentReport
            {
                /**
                 * Wenn es sich um einen bestehenden Beitrag handelt, ist hier das WordPress-Beitragsobjekt gespeichert.
                 *
            Severity: Minor
            Found in src/Model/IncidentReport.php - About 4 hrs to fix

              File Helper.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              namespace abrain\Einsatzverwaltung\Import;
              
              use abrain\Einsatzverwaltung\Data;
              use abrain\Einsatzverwaltung\Exceptions\ImportException;
              Severity: Minor
              Found in src/Import/Helper.php - About 3 hrs to fix

                The class Renderer has an overall complexity of 71 which is very high. The configured complexity threshold is 50.
                Open

                class Renderer
                {
                    const TABLECLASS = 'einsatzverwaltung-reportlist';
                
                    /**
                Severity: Minor
                Found in src/Frontend/ReportList/Renderer.php by phpmd

                The class Report has 12 public methods. Consider refactoring Report to keep number of public methods under 10.
                Open

                class Report extends SubPage
                {
                    private $useReportTemplateOptions = array(
                        'no' => array(
                            'label' => 'Nicht verwenden (zeigt die klassische Einzelansicht)'
                Severity: Minor
                Found in src/Settings/Pages/Report.php by phpmd

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class Frontend has an overall complexity of 68 which is very high. The configured complexity threshold is 50.
                Open

                class Frontend
                {
                    /**
                     * @var Formatter
                     */
                Severity: Minor
                Found in src/Frontend.php by phpmd

                The class Data has an overall complexity of 63 which is very high. The configured complexity threshold is 50.
                Open

                class Data
                {
                    /**
                     * @var Options
                     */
                Severity: Minor
                Found in src/Data.php by phpmd

                The class Advanced has 11 public methods. Consider refactoring Advanced to keep number of public methods under 10.
                Open

                class Advanced extends SubPage
                {
                    /**
                     * @var array[]
                     */
                Severity: Minor
                Found in src/Settings/Pages/Advanced.php by phpmd

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class IncidentReport has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
                Open

                class IncidentReport
                {
                    /**
                     * Wenn es sich um einen bestehenden Beitrag handelt, ist hier das WordPress-Beitragsobjekt gespeichert.
                     *
                Severity: Minor
                Found in src/Model/IncidentReport.php by phpmd

                The class Formatter has an overall complexity of 102 which is very high. The configured complexity threshold is 50.
                Open

                class Formatter
                {
                    private $tagsNotNeedingPost = array('%feedUrl%', '%yearArchive%');
                
                    /**
                Severity: Minor
                Found in src/Util/Formatter.php by phpmd

                The class Update has an overall complexity of 112 which is very high. The configured complexity threshold is 50.
                Open

                class Update
                {
                    /**
                     * Fürt ein Update der Datenbank duch
                     *
                Severity: Minor
                Found in src/Update.php by phpmd

                The class Helper has an overall complexity of 64 which is very high. The configured complexity threshold is 50.
                Open

                class Helper
                {
                    /**
                     * @var Utilities
                     */
                Severity: Minor
                Found in src/Import/Helper.php by phpmd

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

                <?php
                namespace abrain\Einsatzverwaltung\Frontend\ReportList;
                
                use abrain\Einsatzverwaltung\Frontend\AnnotationIconBar;
                use abrain\Einsatzverwaltung\Model\IncidentReport;
                Severity: Minor
                Found in src/Frontend/ReportList/Renderer.php - About 3 hrs to fix

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

                      public function doUpdate(int $currentDbVersion, int $targetDbVersion)
                      {
                          if (empty($targetDbVersion)) {
                              return new WP_Error('', 'Zieldatenbankversion darf nicht leer sein');
                          }
                  Severity: Minor
                  Found in src/Update.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

                  Severity
                  Category
                  Status
                  Source
                  Language