Problem/Motivation

I noticed there was a long list of errors when running the phpcs check on the module (4928 errors and 144 warnings). You can see the file attached bellow (I didn't copied the text here since it's too long).

Steps to reproduce

Open the Gutenberg module directory on your terminal and run the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml . > phpcs_gutenber_all_errors.txt

Proposed resolution

Fix either automatically or manually all errors and create patches accordingly.

Remaining tasks

As the list of errors is too long I'll divide in sub-tasks, one for each folder on the root. It will make creating patches and reviewing code easier.

  • config/
  • css/
  • modules/
  • scripts/
  • src/
  • vendor/
  • other files in root

The Config directory phpcs issues in gutenberg module are handled in this issue Config Thread
The CSS & Scripts phpcs issues in gutenberg module are handled in this issue CSS & Scripts Thread
The Modules directory phpcs issues in gutenberg module are handled in this issue Modules Thread
The Vendor directory phpcs issues in gutenberg module are handled in this issue Vendor Thread

Issue fork gutenberg-3255691

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andregp created an issue. See original summary.

andregp’s picture

Issue summary: View changes
Matheus Macario’s picture

Assigned: andregp » Matheus Macario

i'll work on that.

Matheus Macario’s picture

Assigned: Matheus Macario » Unassigned

Since our previous talk, i'm unassigning this issue, and working on the child issues opened from you.

andregp’s picture

Just waiting #3255698: PHPCS errors on src/ directory to be moved to RTBC to resolve this parent issue.

tmaiochi’s picture

Assigned: Unassigned » tmaiochi

As the #3255698: PHPCS errors on src/ directory was moved to RTBC I'll work on this.

tmaiochi’s picture

Assigned: tmaiochi » Unassigned

I talked with the reporter, and this is a issue to organize and define which folder needs to work with PHPCS, so I'm unassigning this issue.

andregp’s picture

Issue summary: View changes
Guilherme Rabelo’s picture

Assigned: Unassigned » Guilherme Rabelo
Status: Active » Needs work

I will work on solving these PHPCS errors!

andregp’s picture

Title: PHPCS errors on code » [META] PHPCS errors on code
Guilherme Rabelo’s picture

Assigned: Guilherme Rabelo » Unassigned
Status: Needs work » Active
sourabhjain’s picture

Assigned: Unassigned » sourabhjain
sourabhjain’s picture

Assigned: sourabhjain » Unassigned

WagnerMelo made their first commit to this issue’s fork.

arti_parmar’s picture

Assigned: Unassigned » arti_parmar
Status: Active » Needs review
StatusFileSize
new3.52 MB

I have fixed this error "[META] PHPCS errors on code" . I am providing a new patch. Please review this.
Thanks!.

indrapatil’s picture

Assigned: arti_parmar » indrapatil

I will test this patch

indrapatil’s picture

StatusFileSize
new114.47 KB

This patch failed.

indrapatil’s picture

Assigned: indrapatil » Unassigned
eiriksm’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

If someone could create a merge request for this, so we have an up to date patch there, that would be great, thanks 🙏

realsp’s picture

Assigned: Unassigned » realsp

I'll create a MR for this issue

realsp’s picture

Issue tags: +Coding standards

The Config directory phpcs issues in gutenberg module are handled in this issue Config Thread
The CSS & Scripts phpcs issues in gutenberg module are handled in this issue CSS & Scripts Thread
The Modules directory phpcs issues in gutenberg module are handled in this issue Modules Thread
The Vendor directory phpcs issues in gutenberg module are handled in this issue Vendor Thread

In this issue, I'm fixing src/ directory phpcs issues

realsp’s picture

Issue summary: View changes
realsp’s picture

Issue summary: View changes

realsp’s picture

Kindly review the MR, Thank you.

realsp’s picture

Status: Needs work » Needs review
nikolay shapovalov’s picture

Assigned: realsp » Unassigned

marcofernandes made their first commit to this issue’s fork.

cleavinjosh’s picture

Status: Needs review » Needs work

Hi @marcofernandes,

I tried to apply MR!88 but I encountered some errors.

➜  gutenberg git:(8.x-2.9) ✗ curl https://git.drupalcode.org/project/gutenberg/-/merge_requests/88.diff | git apply -v
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 74951    0 74951    0     0   181k      0 --:--:-- --:--:-- --:--:--  181k
Checking patch gutenberg.services.yml...
Checking patch src/Ajax/UpdateMediaEntitiesCommand.php...
Checking patch src/BlockProcessor/DuotoneProcessor.php...
Checking patch src/BlockProcessor/OEmbedProcessor.php...
Checking patch src/BlockProcessor/ReusableBlockProcessor.php...
Checking patch src/BlocksLibraryManager.php...
Checking patch src/BlocksRendererHelper.php...
Checking patch src/Controller/BlocksController.php...
Checking patch src/Controller/MediaController.php...
Checking patch src/Controller/ReusableBlocksController.php...
Checking patch src/Controller/SearchController.php...
Checking patch src/Controller/UtilsController.php...
Checking patch src/DataProvider/BaseDataProvider.php...
Checking patch src/DataProvider/FileEntityDataProvider.php...
Checking patch src/DataProvider/MediaEntityDataProvider.php...
Checking patch src/Discovery/BlockJsonDiscovery.php...
Checking patch src/Form/BlockSettingsForm.php...
Checking patch src/GutenbergElementInfoAlter.php...
Checking patch src/GutenbergLibraryManager.php...
Checking patch src/GutenbergMediaLibraryUiBuilder.php...
Checking patch src/GutenbergPluginManager.php...
Checking patch src/MappingFieldsHelper.php...
error: while searching for:

    // Fetch only blocks with mapping fields.
    $block_parser = new BlockParser();
    $blocks = $block_parser->parse($field_content, [$this, 'filterMappingFieldsBlock']);

    // Let's build the field's array of values.
    $fields = [];

error: patch failed: src/MappingFieldsHelper.php:76
error: src/MappingFieldsHelper.php: patch does not apply
Checking patch src/MediaSelectionProcessor/MediaSelectionProcessorInterface.php...
Checking patch src/OEmbedResolver.php...
Checking patch src/Parser/BlockParser.php...
Checking patch src/Parser/BlockParserFrame.php...
Checking patch src/Plugin/Editor/Gutenberg.php...
Checking patch src/Plugin/Filter/GutenbergFilter.php...
Checking patch src/Plugin/GutenbergPlugin/DrupalImage.php...
Checking patch src/ScanDir.php...
Checking patch src/Service/MediaService.php...
error: while searching for:
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\editor\Entity\Editor;
use Drupal\file\FileInterface;
use Drupal\gutenberg\DataProvider\EntityDataProviderManager;

error: patch failed: src/Service/MediaService.php:8
error: src/Service/MediaService.php: patch does not apply
Checking patch src/TinyColor.php...
➜  gutenberg git:(8.x-2.9) ✗

Please check and advise.
Thank you.