abrain/einsatzverwaltung

View on GitHub

Showing 198 of 250 total issues

Method upgrade180 has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function upgrade180()
    {
        // Rewrite post_type to evw_legacy_unit
        global $wpdb;
        $query = $wpdb->prepare("UPDATE $wpdb->posts SET post_type = %s WHERE post_type = %s", 'evw_legacy_unit', 'evw_unit');
Severity: Minor
Found in src/Update.php - About 2 hrs to fix

    Method getInsertArgs has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getInsertArgs(ReportInsertObject $reportImportObject)
        {
            $args = array(
                'post_type' => Report::getSlug(),
                'post_title' => $reportImportObject->getTitle(),
    Severity: Minor
    Found in src/DataAccess/ReportInserter.php - About 1 hr to fix

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

          public function renderToolPage()
          {
              echo '<div class="wrap">';
              echo '<h1>' . 'Einsatzberichte exportieren' . '</h1>';
              echo '<p>Dieses Werkzeug exportiert Einsatzberichte in verschiedenen Formaten.</p>'; ?>
      Severity: Minor
      Found in src/Export/Tool.php - About 1 hr to fix

        Method echoSingleReport has 49 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->getPostId()));
        Severity: Minor
        Found in src/Widgets/RecentIncidents.php - About 1 hr to fix

          Method renderMatchForm has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function renderMatchForm($source, $args)
              {
                  $defaults = array(
                      'mapping' => array(),
                      'next_action' => null,
          Severity: Minor
          Found in src/Import/Helper.php - About 1 hr to fix

            Method addMetaBoxes has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function addMetaBoxes()
                {
                    add_meta_box(
                        'einsatzverwaltung_meta_box',
                        __('Incident details', 'einsatzverwaltung'),
            Severity: Minor
            Found in src/Admin/ReportEditScreen.php - About 1 hr to fix

              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&uuml;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()
                  {
                      global $wpdb;
              
                      $taxonomies = array(
              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

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

                  public function upgrade1100()
                  {
                      add_option('einsatzvw_category', '-1');
              
                      // Get roles and check if they were allowed to edit reports before
              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

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

                  public function addReportsToQuery(WP_Query $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

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

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

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

                      public function form($instance): string
                      {
                          $instance = array_merge($this->defaults, $instance);
                  
                          printf(
                  Severity: Minor
                  Found in src/Widgets/RecentIncidents.php - About 1 hr to fix

                    Function saveTerm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function saveTerm($termId, $ttId, $taxonomy)
                        {
                            if (!$this->hasTaxonomy($taxonomy)) {
                                return;
                            }
                    Severity: Minor
                    Found in src/CustomFieldsRepository.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 getEinsatzberichtHeader has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getEinsatzberichtHeader(WP_Post $post, bool $mayContainLinks = true, bool $showArchiveLinks = true): string
                        {
                            if (get_post_type($post) !== Report::getSlug()) {
                                return '';
                            }
                    Severity: Minor
                    Found in src/Frontend.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

                        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

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

                              public function getInsertArgs(ReportInsertObject $reportImportObject)
                              {
                                  $args = array(
                                      'post_type' => Report::getSlug(),
                                      'post_title' => $reportImportObject->getTitle(),
                          Severity: Minor
                          Found in src/DataAccess/ReportInserter.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 render has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function render(int $postId, $annotationIds = array()): string
                              {
                                  $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

                          Severity
                          Category
                          Status
                          Source
                          Language