Fix coding standards and improve code.

Created on 11 July 2024, about 1 year ago

Problem/Motivation

I am interested in helping improve the module's code. PHPCS shows lots of things to be fixed. I understand it's early in development, but integrating the fixes/changes early will help avoid mistakes. I recommend type safety and using a PHPCS integration for your IDE.

Steps to reproduce

Run PHPCS.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @solideogloria
  • Status changed to Needs review about 1 year ago
  • I will note that I have never used this module, so I'm new to how it worked in Drupal 7 or should be expected to work in Drupal 10. However, I have experience with programming in Drupal, so I'm willing to help improve the code base.

  • Pipeline finished with Success
    about 1 year ago
    Total: 136s
    #222187
  • Pipeline finished with Success
    about 1 year ago
    Total: 234s
    #222190
  • Pipeline finished with Success
    about 1 year ago
    #222202
  • Status changed to Needs work about 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi

    I applied MR !1 into the module and there's still a few PHPCS issues

    ➜  bible git:(3.0.x) curl https://git.drupalcode.org/project/bible/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 31691    0 31691    0     0  57322      0 --:--:-- --:--:-- --:--:-- 58362
    patching file .gitignore
    patching file .gitlab-ci.yml
    patching file README.md
    patching file bible.info.yml
    patching file bible.module
    patching file 'config/install/core.entity_view_display.bible.bible.default.yml'
    patching file 'src/BibleBookInterface.php'
    patching file 'src/BibleInterface.php'
    patching file 'src/BibleListBuilder.php'
    patching file 'src/Entity/Bible.php'
    patching file 'src/Entity/BibleBook.php'
    patching file 'src/Entity/BibleConcordance.php'
    patching file 'src/Entity/BibleNote.php'
    patching file 'src/Entity/BibleVerse.php'
    patching file 'src/Form/BibleForm.php'
    patching file 'src/Form/BibleImportForm.php'
    patching file 'src/Form/BibleSettingsForm.php'
    ➜  bible git:(3.0.x) ✗ ..
    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml bible        
    
    FILE: ...ubing-subing/Projects/d10/drupal_local/web/modules/contrib/bible/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      3 | WARNING | Line exceeds 80 characters; contains 234 characters
      5 | WARNING | Line exceeds 80 characters; contains 91 characters
      7 | WARNING | Line exceeds 80 characters; contains 99 characters
      8 | WARNING | Line exceeds 80 characters; contains 120 characters
      9 | WARNING | Line exceeds 80 characters; contains 115 characters
     17 | WARNING | Line exceeds 80 characters; contains 99 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...ts/d10/drupal_local/web/modules/contrib/bible/src/Form/BibleImportForm.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
    --------------------------------------------------------------------------------
     249 | ERROR   | The array declaration extends to column 83 (the limit is 80).
         |         | The array content should be split up over multiple lines
     260 | ERROR   | The $_FILES super global must not be accessed directly; inject
         |         | the request_stack service and use
         |         | $stack->getCurrentRequest()->files->get('files') instead
     408 | WARNING | t() calls should be avoided in classes, use
         |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
    --------------------------------------------------------------------------------
    
    Time: 518ms; Memory: 12MB
    
    ➜  contrib git:(main) ✗ 
    
  • 🇮🇳India dev2.addweb

    nilesh.addweb made their first commit to this issue’s fork.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India dev2.addweb

    Hello,

    I've resolved the above mentioned issues.

  • Status changed to RTBC about 1 year ago
  • 🇮🇳India riddhi.addweb

    The mentioned page issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • 🇳🇿New Zealand dieuwe Auckland, NZ

    Thanks everyone, I did miss this ticket and made a few more commits that I will resolve when I have some time. At this early stage there are some bits of undergoing very large refactors so I had been a bit sloppy. Will check this and put PHPCS into my workflow.

    Should be ready with an alpha release and stable database definitions by the end of the year.

  • 🇳🇿New Zealand berenddeboer

    I think these issues are addressed now, so we can close this ticket.

Production build 0.71.5 2024