abrain/einsatzverwaltung

View on GitHub

Showing 247 of 250 total issues

Function getFields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFields()
    {
        if (!empty($this->cachedFields)) {
            return $this->cachedFields;
        }
Severity: Minor
Found in src/Import/Sources/WpEinsatz.php - About 55 mins 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 getDateQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getDateQuery(): array
    {
        $dateQuery = array();

        if (is_numeric($this->year)) {
Severity: Minor
Found in src/ReportQuery.php - About 55 mins 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 renderContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function renderContent(string $content): string
    {
        $post = get_post();

        // Bail, if the post object is empty, not a report, or the content is password protected
Severity: Minor
Found in src/Frontend.php - About 55 mins 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 validateMapping has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateMapping($mapping, $source)
    {
        $valid = true;

        // Pflichtfelder prüfen
Severity: Minor
Found in src/Import/Helper.php - About 55 mins 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 getAdditionalForces has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAdditionalForces(IncidentReport $report, bool $makeLinks, bool $showArchiveLinks): string
    {
        if (empty($report)) {
            return '';
        }
Severity: Minor
Found in src/Util/Formatter.php - About 45 mins 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 getVehiclesByUnitString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getVehiclesByUnitString(array $vehiclesByUnitId): string
    {
        if (empty($vehiclesByUnitId)) {
            return '';
        }
Severity: Minor
Found in src/Util/Formatter.php - About 45 mins 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 echoSettingsPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function echoSettingsPage()
    {
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to manage options for this site.', 'einsatzverwaltung'));
        }
Severity: Minor
Found in src/Settings/MainPage.php - About 45 mins 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($identifier, $name, $metaKey, $icon, $labelWhenActive, $labelWhenInactive)
Severity: Minor
Found in src/Model/ReportAnnotation.php - About 45 mins to fix

    Function analysisPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function analysisPage()
        {
            if (!$this->currentSource->checkPreconditions()) {
                return;
            }
    Severity: Minor
    Found in src/Import/Tool.php - About 45 mins 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 create_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function create_item($request) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps -- overridden method
        {
            $params = $request->get_params();
    
            $start_date_time = DateTimeImmutable::createFromFormat(DATE_RFC3339, $params['date_start']);
    Severity: Minor
    Found in src/Api/Reports.php - About 45 mins 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

    Consider simplifying this complex logical expression.
    Open

            if ((isset($_REQUEST['action']) && -1 != $_REQUEST['action'] && 'edit' === $_REQUEST['action']) ||
                (isset($_REQUEST['action2']) && -1 != $_REQUEST['action2'] && 'edit' === $_REQUEST['action2'])
            ) {
                return isset($_REQUEST['bulk_edit']);
            }
    Severity: Major
    Found in src/Data.php - About 40 mins to fix

      The class Core has a coupling between objects value of 23. Consider to reduce the number of dependencies under 13.
      Open

      class Core
      {
          const VERSION = '1.11.1';
          const DB_VERSION = 80;
      
      
      Severity: Minor
      Found in src/Core.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

      Method echoChecklistBox has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function echoChecklistBox(WP_Taxonomy $taxonomyObject, string $fieldName, string $label, array $selectedIds, string $smallText)
      Severity: Minor
      Found in src/Widgets/AbstractWidget.php - About 35 mins to fix

        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function __construct(string $key, string $label, string $description, $defaultValue = false, bool $multiValue = false)
        Severity: Minor
        Found in src/CustomFields/CustomField.php - About 35 mins to fix

          Method echoInputText has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected function echoInputText(string $label, string $name, string $value, $placeholder = '', $size = 20)
          Severity: Minor
          Found in src/Admin/EditScreen.php - About 35 mins to fix

            Function einsatzverwaltung_register_and_execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function einsatzverwaltung_register_and_execute(event, id, regex, msg, allowEmpty)
            Severity: Minor
            Found in src/js/einsatzverwaltung-edit.js - About 35 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct($key, $label, $checkboxLabel, $description, $defaultValue = false)
              Severity: Minor
              Found in src/CustomFields/Checkbox.php - About 35 mins to fix

                Function echoRadioButtons has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function echoRadioButtons($name, $options, $defaultValue)
                    {
                        $currentValue = get_option($name, $defaultValue);
                        foreach ($options as $value => $option) {
                            if ($value === $defaultValue) {
                Severity: Minor
                Found in src/Settings/Pages/SubPage.php - About 35 mins 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 addMissingUnits has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function addMissingUnits(int $postId)
                    {
                        $assignedVehicles = wp_get_post_terms($postId, Vehicle::getSlug());
                        if (empty($assignedVehicles) || is_wp_error($assignedVehicles)) {
                            return;
                Severity: Minor
                Found in src/DataAccess/ReportActions.php - About 35 mins 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 getVehicleString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getVehicleString(array $vehicles, bool $makeLinks, bool $showArchiveLinks): string
                    {
                        if (empty($vehicles)) {
                            return '';
                        }
                Severity: Minor
                Found in src/Util/Formatter.php - About 35 mins 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