abrain/einsatzverwaltung

View on GitHub

Showing 151 of 250 total issues

Method updateRoles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function updateRoles()
    {
        // Make sure, the administrator role has all the necessary capabilities
        $adminRole = get_role('administrator');
        if (!empty($adminRole)) {
Severity: Minor
Found in src/UserRightsManager.php - About 1 hr to fix

    Method analysisPage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function analysisPage()
        {
            if (!$this->currentSource->checkPreconditions()) {
                return;
            }
    Severity: Minor
    Found in src/Import/Tool.php - About 1 hr to fix

      Function dropdownPosts has a Cognitive Complexity of 12 (exceeds 5 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

      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 maybeCategorySpecialChanged has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function maybeCategorySpecialChanged($newValue, $oldValue): string
          {
              // Nur Änderungen sind interessant
              if ($newValue == $oldValue) {
                  return $newValue;
      Severity: Minor
      Found in src/Settings/Pages/General.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 setUpMobileView has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      function setUpMobileView()
      {
          const tables = document.getElementsByClassName('einsatzverwaltung-reportlist');
          for (let tablecounter = 0; tablecounter < tables.length; tablecounter++) {
              const table = tables.item(tablecounter);
      Severity: Minor
      Found in src/js/reportlist.js - 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 echoSingleReport has a Cognitive Complexity of 12 (exceeds 5 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

      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 maybeCategoryChanged has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function maybeCategoryChanged($newValue, $oldValue): string
          {
              // Nur Änderungen sind interessant
              if ($newValue == $oldValue) {
                  return $newValue;
      Severity: Minor
      Found in src/Settings/Pages/General.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 echoStaticContent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function echoStaticContent()
          {
              ?>
              <div class="aboutpage-icons">
                  <div class="aboutpage-icon"><a href="https://einsatzverwaltung.org" target="_blank"><i class="fa-solid fa-globe fa-4x"></i><br>Webseite</a></div>
      Severity: Minor
      Found in src/Settings/Pages/About.php - About 1 hr to fix

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

            public function addSettingsFields()
            {
                add_settings_field(
                    'einsatzvw_permalinks_base',
                    __('Base', 'einsatzverwaltung'),
        Severity: Minor
        Found in src/Settings/Pages/Advanced.php - About 1 hr to fix

          Method registerSettings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function registerSettings()
              {
                  register_setting(
                      'einsatzvw_settings_list',
                      'einsatzvw_list_columns',
          Severity: Minor
          Found in src/Settings/Pages/ReportList.php - About 1 hr to fix

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

                public function getRegistrationArgs(): array
                {
                    return array(
                        'labels' => array(
                            'name' => _x('Incident Categories', 'taxonomy general name', 'einsatzverwaltung'),
            Severity: Minor
            Found in src/Types/IncidentType.php - About 1 hr to fix

              Method __construct has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct()
                  {
                      $this->customColumns = array(
                          'title' => array(
                              'label' => __('Title', 'einsatzverwaltung'),
              Severity: Minor
              Found in src/Admin/ReportListTable.php - About 1 hr to fix

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

                    public function getRegistrationArgs(): array
                    {
                        return array(
                            'label' => 'Fahrzeuge',
                            'labels' => array(
                Severity: Minor
                Found in src/Types/Vehicle.php - About 1 hr to fix

                  Method echoVehiclesByUnit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function echoVehiclesByUnit(WP_Post $post, WP_Taxonomy $vehicleTaxonomy, array $vehicles, array $assignedVehicleIds)
                      {
                          $unitTaxObj = get_taxonomy(Unit::getSlug());
                          if (empty($unitTaxObj)) {
                              return;
                  Severity: Minor
                  Found in src/Admin/ReportEditScreen.php - About 1 hr to fix

                    Method importPage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function importPage()
                        {
                            if (!$this->currentSource->checkPreconditions()) {
                                return;
                            }
                    Severity: Minor
                    Found in src/Import/Tool.php - About 1 hr to fix

                      Method registerCustomFields has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function registerCustomFields(CustomFieldsRepository $customFields)
                          {
                              $customFields->add($this, new UnitSelector(
                                  'vehicle_unit',
                                  _x('Unit', 'taxonomy singular name', 'einsatzverwaltung'),
                      Severity: Minor
                      Found in src/Types/Vehicle.php - About 1 hr to fix

                        Method dropdownEigeneFelder has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function dropdownEigeneFelder($args)
                            {
                                $defaults = array(
                                    'name' => null,
                                    'selected' => '-',
                        Severity: Minor
                        Found in src/Import/Helper.php - About 1 hr to fix

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

                              public function getRegistrationArgs(): array
                              {
                                  return array(
                                      'labels' => array(
                                          'name' => _x('Alerting Methods', 'taxonomy general name', 'einsatzverwaltung'),
                          Severity: Minor
                          Found in src/Types/AlertingMethod.php - About 1 hr to fix

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

                                public function render($attributes): string
                                {
                                    $attributes = $this->getAttributes($attributes);
                                    $year = $this->getYear($attributes['year']);
                            
                            
                            Severity: Minor
                            Found in src/Shortcodes/ReportCount.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 updateSequenceNumbers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function updateSequenceNumbers($yearToUpdate = null)
                                {
                                    if (empty($yearToUpdate)) {
                                        $years = self::getYearsWithReports();
                                    }
                            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

                            Severity
                            Category
                            Status
                            Source
                            Language