Fix all the coding standards issues

Created on 15 May 2023, over 1 year ago
Updated 5 June 2023, over 1 year ago

Problem/Motivation

At the moment the project contains a lot of Drupal coding standard issues.

Codesniffer throws an error for the requirement of dependency injection in three files - MediaMigrateCommands.php and MediaFileCopy.php and MediaEntityGenerator.php

Steps to reproduce

Run the ./vendor/bin/phpstan and ./vendor/bin/phpcs commands on the module.
You can use D10 default dev settings for that.
The files with issues you can find in the attachments of the issue.

Proposed resolution

Fix all phpcs and phpstan issues.
E.g. - use dependency injection and containers for the required services.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

  • Issue created by @sidharth_soman
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    I am working on this and will provide an MR.

  • Status changed to Active over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work over 1 year ago
  • 🇺🇦Ukraine HitchShock Ukraine

    Hi @sidharth_soman thanks for raising the issue.
    I had a plan to create a new ticket to fix all the coding standards of the module, 'coz we really have a lot of issues with it.
    If you don't mind, I'll use your ticket to fix all issues, not only DI.

  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Please review. Resolved the PHPCS issue.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Assigned to arpitk
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India arpitk

    HI I reviewed the MR. Scanning the phpcs it shows readme files errors . And scanning phpcs for DrupalPractice its showing errors. Please see the attached picture. Need to work on them.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arpitk

    I have worked on the remaining Dependency injection issues reported phpcs DrupalPractice. Please review

    Thanks!

  • 🇺🇦Ukraine HitchShock Ukraine

    Reviewed proposed solutions (patches):

    • Thanks for raising the issue but your MR doesn't fix anything but breaks the code: media_file_copy and media_entity_generator plugins and migrate-duplicate command. It looks like you just created an MR without understanding what the code does and which DI should be applied. That is, your commit had to be essentially reversed. Please, don't do like that in the future!
    • @sakthi_dev and @arpitk thanks for you commits. Only small issues were fixed in your solutions. Great job!

    P.S. @arpitk push your patch into the MR in the future, please. It will simplify the review process and life of the reviewers.

    Done:

    • Also, I used typical phpcs and phpstan configs from the D10 to recheck the module. Fixed all the other issues I found.
    • Tested the module after the fixes on the empty and real projects.

    P.S. Keeping a ticket in review status to allow someone else to review it. If the task remains unchanged for 2 weeks, the solution will be automatically added to the dev branch.

  • Status changed to Fixed over 1 year ago
  • 🇺🇦Ukraine HitchShock Ukraine
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024