\Drupal calls should be avoided in classes, use dependency injection instead

Created on 28 June 2023, over 1 year ago
Updated 14 July 2023, over 1 year ago

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\SitemapIndexController.php
------------------------------------------------------------------------------------------------------------------
12 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
14 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
19 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
20 | 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
42 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
66 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
69 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
70 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
80 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\TaxonomySitemapController.php
---------------------------------------------------------------------------------------------------------------------
43 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
51 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
69 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\TaxonomySitemapIndexController.php
--------------------------------------------------------------------------------------------------------------------------
12 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
14 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
19 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
20 | 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
42 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
66 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
69 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
70 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
80 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\taxonomy_sitemap_xml\src\Form\TaxonomySitemapVocabularyConfigForm.php
-------------------------------------------------------------------------------------------------------------------------
33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------------------------------------------------------------------------------

📌 Task
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇳India arti_parmar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Assigned to sidharth_soman
  • 🇮🇳India sidharth_soman Bangalore
  • 🇮🇳India sidharth_soman Bangalore

    Patch #2 applies cleanly and resolves the Di issues. The codesniffer report now reads:

    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\Readme.md
    ------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
    ------------------------------------------------------------------------------------------
      4 | WARNING | Line exceeds 80 characters; contains 205 characters
      7 | WARNING | Line exceeds 80 characters; contains 93 characters
      9 | WARNING | Line exceeds 80 characters; contains 121 characters
     15 | WARNING | Line exceeds 80 characters; contains 108 characters
     16 | WARNING | Line exceeds 80 characters; contains 141 characters
     17 | WARNING | Line exceeds 80 characters; contains 125 characters
     25 | WARNING | Line exceeds 80 characters; contains 163 characters
     28 | WARNING | Line exceeds 80 characters; contains 142 characters
    ------------------------------------------------------------------------------------------
    
    
    FILE: ...\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\SitemapIndexController.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 37 ERRORS AND 1 WARNING AFFECTING 29 LINES
    ------------------------------------------------------------------------------------------------------------------------
       1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
      13 | ERROR   | [ ] Class name doesn't match filename; expected "class SitemapIndexController"
      13 | ERROR   | [x] Missing class doc comment
      36 | ERROR   | [ ] Parameter $entity_type_manager is not described in comment
      36 | ERROR   | [ ] Parameter $language_manager is not described in comment
      36 | ERROR   | [ ] Parameter $configFactory is not described in comment
      39 | ERROR   | [ ] Doc comment for parameter $config_factory does not match actual variable name $configFactory
      59 | ERROR   | [x] Missing function doc comment
      60 | WARNING | [ ] Unused variable $current_language.
      64 | ERROR   | [x] Whitespace found at end of line
      69 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
      69 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
      70 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
      72 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
      73 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
      73 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
      74 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 12
      75 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
      76 | ERROR   | [x] Whitespace found at end of line
      81 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
      91 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      92 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      93 | ERROR   | [x] Whitespace found at end of line
      94 | ERROR   | [x] Whitespace found at end of line
      95 | ERROR   | [x] Inline comments must start with a capital letter
      95 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
         |         |     parentheses
      95 | ERROR   | [x] Whitespace found at end of line
      97 | ERROR   | [x] Whitespace found at end of line
     100 | ERROR   | [x] Whitespace found at end of line
     114 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     114 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
     115 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     117 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
     117 | ERROR   | [x] Whitespace found at end of line
     118 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     119 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
     131 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 32 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...mpp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\TaxonomySitemapController.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 18 ERRORS AND 4 WARNINGS AFFECTING 17 LINES
    ------------------------------------------------------------------------------------------------------------------------
       1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
       8 | WARNING | [x] Unused use statement
       9 | WARNING | [x] Unused use statement
      12 | WARNING | [x] Unused use statement
      17 | ERROR   | [x] Missing class doc comment
      40 | ERROR   | [ ] Parameter $entity_type_manager is not described in comment
      40 | ERROR   | [ ] Parameter $language_manager is not described in comment
      40 | ERROR   | [ ] Parameter $configFactory is not described in comment
      43 | ERROR   | [ ] Doc comment for parameter $config_factory does not match actual variable name $configFactory
      63 | ERROR   | [x] Missing function doc comment
      63 | ERROR   | [ ] Public method name "TaxonomySitemapController::TaxonomySitemapXml" is not in lowerCamel format
      70 | ERROR   | [x] Expected newline after closing brace
      89 | ERROR   | [x] Whitespace found at end of line
      90 | ERROR   | [x] Expected 1 space after "="; 0 found
      95 | WARNING | [ ] Unused variable $url.
     100 | ERROR   | [x] Concat operator must be surrounded by a single space
     100 | ERROR   | [x] Whitespace found at end of line
     112 | ERROR   | [x] Whitespace found at end of line
     113 | ERROR   | [x] Whitespace found at end of line
     114 | ERROR   | [x] Expected 1 newline at end of file; 0 found
     114 | ERROR   | [x] The closing brace for the class must have an empty line before it
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...tdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\src\Controller\TaxonomySitemapIndexController.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 34 ERRORS AND 1 WARNING AFFECTING 28 LINES
    ------------------------------------------------------------------------------------------------------------------------
       1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
       7 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url.
      13 | ERROR   | [x] Missing class doc comment
      40 | ERROR   | [x] Expected 1 blank line before function; 2 found
      57 | ERROR   | [x] Missing function doc comment
      57 | ERROR   | [ ] Public method name "TaxonomySitemapIndexController::TaxonomySitemapIndexXml" is not in lowerCamel
         |         |     format
      58 | WARNING | [ ] Unused variable $current_language.
      62 | ERROR   | [x] Whitespace found at end of line
      67 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
      67 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
      68 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
      70 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
      71 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
      71 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
      72 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 12
      73 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 8
      74 | ERROR   | [x] Whitespace found at end of line
      79 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
      89 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      90 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      91 | ERROR   | [x] Whitespace found at end of line
      92 | ERROR   | [x] Whitespace found at end of line
      93 | ERROR   | [x] Inline comments must start with a capital letter
      93 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
         |         |     parentheses
      93 | ERROR   | [x] Whitespace found at end of line
      95 | ERROR   | [x] Whitespace found at end of line
      98 | ERROR   | [x] Whitespace found at end of line
     112 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     112 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
     113 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
     115 | ERROR   | [x] Expected 1 space after FOREACH keyword; 0 found
     115 | ERROR   | [x] Whitespace found at end of line
     116 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
     117 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 10
     129 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 33 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\src\Form\TaxonomySitemapVocabularyConfigForm.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 1 WARNING AFFECTING 7 LINES
    ------------------------------------------------------------------------------------------------------------------------
       1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
       7 | WARNING | [x] Unused use statement
       8 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
         |         |     Drupal\Core\Entity\EntityTypeManagerInterface.
      11 | ERROR   | [x] Missing class doc comment
      85 | ERROR   | [x] Concat operator must be surrounded by a single space
      91 | ERROR   | [x] Concat operator must be surrounded by a single space
      91 | ERROR   | [x] Concat operator must be surrounded by a single space
     112 | ERROR   | [x] Expected 1 newline at end of file; 0 found
     112 | ERROR   | [x] The closing brace for the class must have an empty line before it
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\taxonomy_sitemap_xml.info.yml
    --------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------
     8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
    --------------------------------------------------------------------------------------------------------------
    
    
    FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\taxonomy_sitemap_xml.module
    ------------------------------------------------------------------------------------------------------------
    FOUND 8 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
    ------------------------------------------------------------------------------------------------------------
      1 | ERROR   | [x] Missing file doc comment
      1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
      3 | ERROR   | [x] Missing function doc comment
     13 | ERROR   | [x] Whitespace found at end of line
     30 | ERROR   | [x] Whitespace found at end of line
     39 | ERROR   | [x] Whitespace found at end of line
     48 | ERROR   | [x] Whitespace found at end of line
     49 | WARNING | [x] There must be no blank line following an inline comment
     49 | WARNING | [ ] There must be no blank line following an inline comment
     50 | ERROR   | [x] Whitespace found at end of line
    ------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\templates\taxonomy-sitemap-index.html.twig
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------
     1 | WARNING | [ ] Possible use of short open tags detected; found: <?xml version="1.0" encoding="UTF-8"?>
       |         |
     8 | ERROR   | [x] Expected 1 newline at end of file; 2 found
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_sitemap_xml\templates\taxonomy-sitemap-xml.html.twig
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------
      1 | WARNING | [ ] Possible use of short open tags detected; found: <?xml version="1.0" encoding="UTF-8"?>
        |         |
     13 | ERROR   | [x] Expected 1 newline at end of file; 3 found
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    Time: 1.53 secs; Memory: 6MB
    

    Since this issue is only for DI, I'm moving this to RTBC.

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore
Production build 0.71.5 2024