abrain/einsatzverwaltung

View on GitHub

Showing 265 of 272 total issues

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

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

        private function format($post, $pattern, $tag, $context = 'post')
        {
            if ($post == null && !in_array($tag, $this->tagsNotNeedingPost)) {
                return $pattern;
            }
    Severity: Minor
    Found in src/Util/Formatter.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 Formatter.php has 321 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 3 hrs to fix

      IncidentReport has 30 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 3 hrs to fix

        The class Update has an overall complexity of 71 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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

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

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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

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

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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

        The class Helper has an overall complexity of 65 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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

        The class Renderer has an overall complexity of 70 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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

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

        class Advanced extends SubPage
        {
            private $permalinkOptions = array(
                PermalinkController::DEFAULT_REPORT_PERMALINK => array(
                    'label' => 'Beitragstitel mit angeh&auml;ngtem Z&auml;hler (Standard)'
        Severity: Minor
        Found in src/Settings/Pages/Advanced.php by phpmd

        Since: PHPMD 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'.

        Source: http://phpmd.org/rules/codesize.txt

        The class IncidentReport has an overall complexity of 58 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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

        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

        Since: PHPMD 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'.

        Source: http://phpmd.org/rules/codesize.txt

        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

        Since: PHPMD 0.2.5

        The Weighted Method Count (WMC) of a class is a good indicator of how much time and effort is required to modify and maintain this class. The WMC metric is defined as the sum of complexities of all methods declared in a class. A large number of methods also means that this class has a greater potential impact on derived classes.

        Example:

        class Foo {
              public function bar() {
                  if ($a == $b)  {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              public function baz() {
                  if ($a == $b) {
                      if ($a1 == $b1) {
                          fiddle();
                      } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                      }
                  }
              }
              // Several other complex methods
          }

        Source: http://phpmd.org/rules/codesize.txt

        File Helper.php has 305 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

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

              public function form($instance)
              {
                  $title = Utilities::getArrayValueIfKey($instance, 'title', 'Letzte Eins&auml;tze');
                  $anzahl = Utilities::getArrayValueIfKey($instance, 'anzahl', 3);
                  $selectedUnits = Utilities::getArrayValueIfKey($instance, 'units', array());
          Severity: Major
          Found in src/Widgets/RecentIncidents.php - About 3 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function getAdditionalForces($report, $makeLinks, $showArchiveLinks)
                {
                    if (empty($report)) {
                        return '';
                    }
            Severity: Major
            Found in src/Util/Formatter.php and 1 other location - About 3 hrs to fix
            src/Util/Formatter.php on lines 323..350

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function getVehicles($report, $makeLinks, $showArchiveLinks)
                {
                    if (empty($report)) {
                        return '';
                    }
            Severity: Major
            Found in src/Util/Formatter.php and 1 other location - About 3 hrs to fix
            src/Util/Formatter.php on lines 383..410

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

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

              File Renderer.php has 290 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 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language