abrain/einsatzverwaltung

View on GitHub

Showing 246 of 249 total issues

Method onInit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onInit()
    {
        $this->maybeUpdate();

        $this->utilities = new Utilities();
Severity: Minor
Found in src/Core.php - About 1 hr to fix

    Method create_item has 29 lines of code (exceeds 25 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 1 hr to fix

      Method validateMapping has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validateMapping($mapping, $source)
          {
              $valid = true;
      
              // Pflichtfelder prüfen
      Severity: Minor
      Found in src/Import/Helper.php - About 1 hr to fix

        Method filterIncidentCategoryDropdown has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function filterIncidentCategoryDropdown(string $output, array $parsedArgs): string
            {
                if (!array_key_exists('taxonomy', $parsedArgs) || $parsedArgs['taxonomy'] !== IncidentType::getSlug()) {
                    return $output;
                }
        Severity: Minor
        Found in src/Admin/ReportEditScreen.php - About 1 hr to fix

          Method checkPreconditions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function checkPreconditions()
              {
                  $this->fileHasHeadlines = (bool) Utilities::getArrayValueIfKey($this->args, 'has_headlines', false);
          
                  $delimiter = Utilities::getArrayValueIfKey($this->args, 'delimiter', false);
          Severity: Minor
          Found in src/Import/Sources/Csv.php - About 1 hr to fix

            Method render has 29 lines of code (exceeds 25 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

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

                  public function __construct(Data $data, Options $options, Utilities $utilities, PermalinkController $permalinkController)
                  {
                      $pluginBasename = Core::$pluginBasename;
                      add_action('admin_menu', array($this, 'hideTaxonomies'));
                      add_action('admin_notices', array($this, 'displayAdminNotices'));
              Severity: Minor
              Found in src/Admin/Initializer.php - About 1 hr to fix

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

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

                  Method addSettingsFields has 28 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 getVehiclesByUnitString has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getVehiclesByUnitString(array $vehiclesByUnitId): string
                        {
                            if (empty($vehiclesByUnitId)) {
                                return '';
                            }
                    Severity: Minor
                    Found in src/Util/Formatter.php - About 1 hr to fix

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

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

                          private function getMetaQuery(): array
                          {
                              $metaQuery = [];
                      
                              if ($this->onlySpecialReports) {
                      Severity: Minor
                      Found in src/ReportQuery.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 getTypesOfAlerting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getTypesOfAlerting(IncidentReport $report, bool $makeLinks): string
                          {
                              if (empty($report)) {
                                  return '';
                              }
                      Severity: Minor
                      Found in src/Util/Formatter.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 constructList has a Cognitive Complexity of 10 (exceeds 5 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

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

                          public function echoFieldColumns()
                          {
                              $columnRepository = ColumnRepository::getInstance();
                              $columnIdentifiers = explode(',', get_option('einsatzvw_list_columns', ''));
                              $enabledColumns = $columnRepository->getColumnsByIdentifier($columnIdentifiers);
                      Severity: Minor
                      Found in src/Settings/Pages/ReportList.php - About 1 hr to fix

                        Method getTypesOfAlerting has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getTypesOfAlerting(IncidentReport $report, bool $makeLinks): string
                            {
                                if (empty($report)) {
                                    return '';
                                }
                        Severity: Minor
                        Found in src/Util/Formatter.php - About 1 hr to fix

                          Method getResourceTerms has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getResourceTerms(array $names)
                              {
                                  $resourcesByName = get_terms([
                                      'name' => $names,
                                      'taxonomy' => [Vehicle::getSlug(), ExtEinsatzmittel::getSlug()],
                          Severity: Minor
                          Found in src/DataAccess/ReportInserter.php - About 1 hr to fix

                            Method upgrade113 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function upgrade113()
                                {
                                    if (!function_exists('get_editable_roles')) {
                                        require_once(ABSPATH . 'wp-admin/includes/user.php');
                                    }
                            Severity: Minor
                            Found in src/Update.php - About 1 hr to fix

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

                              Severity
                              Category
                              Status
                              Source
                              Language