Fix the issues reported by PHP_CodeSniffer

Created on 14 September 2023, over 1 year ago
Updated 17 October 2023, over 1 year ago

Problem/Motivation

I have found list of drupal coding standard issues with ekan modules, Some of them listed below. I have also attached full list of issue.

FILE: ...docs\ekan\modules\ekan_core\src\Entity\Form\EkanResourceForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but
   |       |     found "\r\n"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...modules\ekan_core\src\Entity\Form\ResourceEntitySettingsForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 9 WARNINGS AFFECTING 10 LINES
----------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n"
     |         |     but found "\r\n"
  61 | WARNING | [ ] \Drupal calls should be avoided in classes, use
     |         |     dependency injection instead
  70 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  73 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  78 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  80 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  86 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  88 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
  98 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
 100 | WARNING | [ ] t() calls should be avoided in classes, use
     |         |     \Drupal\Core\StringTranslation\StringTranslationTrait
     |         |     and $this->t() instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ekan\modules\ekan_core\src\File\MimeType\HttpMimeTypeGuesser.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but
   |       |     found "\r\n"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...docs\ekan\modules\ekan_core\src\Plugin\Block\DatasetWorkflow.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n"
    |         |     but found "\r\n"
 23 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
 24 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...s\ekan\modules\ekan_core\src\Plugin\Block\EkanContextualHelp.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n"
    |         |     but found "\r\n"
 48 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
 56 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...es\ekan_core\src\Plugin\Block\ListOfResourcesWithSameDataset.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 4 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n"
    |         |     but found "\r\n"
  6 | ERROR   | [x] Use statements should be sorted alphabetically.
    |         |     The first wrong one is
    |         |     Drupal\Component\Render\FormattableMarkup.
 23 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
 26 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
 42 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
 47 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    |         |     dependency injection instead
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...in\EntityReferenceSelection\EkanPublisherMembershipSelection.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but
   |       |     found "\r\n"
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Drupal Coding Standard issue with EKAN Modules

Steps to reproduce

Run php sniffer to modules -
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .\modules

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

1.1

Component

Code

Created by

🇮🇳India mauryarahul11 Mumbai, India

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024