abrain/einsatzverwaltung

View on GitHub

Showing 282 of 289 total issues

Function savePostdata has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function savePostdata($postId, $post)
    {
        // Schreibrechte prüfen
        if (!current_user_can('edit_einsatzbericht', $postId)) {
            return;
Severity: Minor
Found in src/Data.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 mapEntryToInsertArgs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function mapEntryToInsertArgs($mapping, $sourceEntry, &$insertArgs)
    {
        foreach ($mapping as $sourceField => $ownField) {
            if (empty($ownField) || !is_string($ownField)) {
                $this->utilities->printError("Feld '$ownField' ungültig");
Severity: Minor
Found in src/Import/Helper.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 upgrade130 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function upgrade130()
    {
        /** @var wpdb $wpdb */
        global $wpdb;

Severity: Minor
Found in src/Update.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 dropdownPosts has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function dropdownPosts($args)
    {
        $defaults = array(
            'echo' => true,
            'post_type' => array('post'),
Severity: Minor
Found in src/CustomFields/PostSelector.php - About 1 hr to fix

    Method renderPage has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function renderPage()
        {
            echo '<div class="wrap">';
            echo '<h1>Einsatzverwaltung</h1>';
    
    
    Severity: Minor
    Found in src/Admin/TasksPage.php - About 1 hr to fix

      Method doUpdate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function doUpdate($currentDbVersion, $targetDbVersion)
          {
              if (empty($targetDbVersion)) {
                  return new WP_Error('', 'Zieldatenbankversion darf nicht leer sein');
              }
      Severity: Minor
      Found in src/Update.php - About 1 hr to fix

        Method addSettingsFields has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addSettingsFields()
            {
                add_settings_field(
                    'einsatzvw_einsatz_hideemptydetails',
                    'Einsatzdetails',
        Severity: Minor
        Found in src/Settings/Pages/Report.php - About 1 hr to fix

          Avoid excessively long variable names like $showEinsatzartArchiveLink. Keep variable name length under 20.
          Open

                      $showEinsatzartArchiveLink = $showArchiveLinks && $this->options->isShowEinsatzartArchive();
          Severity: Minor
          Found in src/Frontend.php by phpmd

          Since: PHPMD 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example:

          class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $argumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

          Avoid excessively long variable names like $onlySpecialInCategory. Keep variable name length under 20.
          Open

                      $onlySpecialInCategory = self::$options->isOnlySpecialInLoop();
          Severity: Minor
          Found in src/Settings/Pages/General.php by phpmd

          Since: PHPMD 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example:

          class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $argumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

          Avoid excessively long variable names like $includePrivateReports. Keep variable name length under 20.
          Open

              public function setIncludePrivateReports($includePrivateReports)
          Severity: Minor
          Found in src/ReportQuery.php by phpmd

          Since: PHPMD 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example:

          class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $argumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

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

          Method echoSettingsPage has 41 lines of code (exceeds 25 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.'));
                  }
          Severity: Minor
          Found in src/Settings/MainPage.php - About 1 hr to fix

            Method prepareArgsForInsertPost has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function prepareArgsForInsertPost(&$insertArgs, $dateTimeFormat, $postStatus, $alarmzeit)
                {
                    // Datum des Einsatzes prüfen
                    if (false === $alarmzeit) {
                        throw new ImportPreparationException(sprintf(
            Severity: Minor
            Found in src/Import/Helper.php - About 1 hr to fix

              Method enqueueEditScripts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function enqueueEditScripts($hook)
                  {
                      if ('post.php' == $hook || 'post-new.php' == $hook) {
                          // Nur auf der Bearbeitungsseite anzeigen
                          wp_enqueue_script(
              Severity: Minor
              Found in src/Admin/Initializer.php - About 1 hr to fix

                Method echoSingleReport has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function echoSingleReport(IncidentReport $report, $instance)
                    {
                        if (true === ($instance['showAnnotations'])) {
                            $annotationIconBar = AnnotationIconBar::getInstance();
                            printf('<div class="annotation-icon-bar">%s</div>', $annotationIconBar->render($report));
                Severity: Minor
                Found in src/Widgets/RecentIncidents.php - About 1 hr to fix

                  Function render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function render($report, $annotationIds = array())
                      {
                          $annotationRepository = ReportAnnotationRepository::getInstance();
                          $string = '';
                          $annotations = array();
                  Severity: Minor
                  Found in src/Frontend/AnnotationIconBar.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 getMapping has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getMapping($sourceFields, $ownFields)
                      {
                          $mapping = array();
                          foreach ($sourceFields as $sourceField) {
                              $index = $this->getInputName($sourceField);
                  Severity: Minor
                  Found in src/Import/Sources/AbstractSource.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 constructList has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function constructList($reports, Parameters $parameters)
                      {
                          if (empty($reports)) {
                              $this->string = sprintf(
                                  '<span>%s</span>',
                  Severity: Minor
                  Found in src/Frontend/ReportList/Renderer.php - About 1 hr to fix

                    Method addReportsToQuery has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function addReportsToQuery($query)
                        {
                            // Nur, wenn Filter erlaubt sind, soll weitergemacht werden
                            if (!empty($query->query_vars['suppress_filters'])) {
                                return;
                    Severity: Minor
                    Found in src/Frontend.php - About 1 hr to fix

                      Method readFile has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function readFile($numLines = null, $requestedFields = array())
                          {
                              $fieldMap = array();
                              if (!empty($requestedFields)) {
                                  $fields = $this->getFields();
                      Severity: Minor
                      Found in src/Import/Sources/Csv.php - About 1 hr to fix

                        Method getRegistrationArgs has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getRegistrationArgs()
                            {
                                return array(
                                    'label' => 'Einsatzarten',
                                    'labels' => array(
                        Severity: Minor
                        Found in src/Types/IncidentType.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language