abrain/einsatzverwaltung

View on GitHub

Showing 247 of 250 total issues

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

    private $useReportTemplateOptions = array(
        'no' => array(
            'label' => 'Nicht verwenden (zeigt die klassische Einzelansicht)'
        ),
        'singular' => array(
Severity: Minor
Found in src/Settings/Pages/Report.php by phpmd

LongVariable

Since: 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 $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

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

LongVariable

Since: 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 $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

    private $includePrivateReports;
Severity: Minor
Found in src/ReportQuery.php by phpmd

LongVariable

Since: 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 $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

    private $assignSequenceNumbers = true;
Severity: Minor
Found in src/Data.php by phpmd

LongVariable

Since: 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 $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

LongVariable

Since: 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 $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

        private function upgrade120()
        {
            global $wpdb;
    
            // Alle veröffentlichten Einsatzberichte einer Kategorie hinzufügen, wenn diese in den Einstellungen für die
    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 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

    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

    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(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

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

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

              public function addSettingsSections()
              {
                  add_settings_section(
                      'einsatzvw_settings_permalinks',
                      __('Permalinks', 'einsatzverwaltung'),
          Severity: Minor
          Found in src/Settings/Pages/Advanced.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 upgrade130 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function upgrade130()
                  {
                      global $wpdb;
              
                      $taxonomies = array(
              Severity: Minor
              Found in src/Update.php - About 1 hr to fix

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

                    public function getColumnContent($columnId, IncidentReport $report): string
                    {
                        switch ($columnId) {
                            case 'e_nummer':
                                $numberString = $report->getNumber();
                Severity: Minor
                Found in src/Admin/ReportListTable.php - About 1 hr to fix

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

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

                    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
                        Severity
                        Category
                        Status
                        Source
                        Language