Problem/Motivation

The project contains a number of deviations from the Drupal coding standards (https://www.drupal.org/docs/develop/standards/coding-standards). Following a common set of coding standards makes it easier for other Drupal developers to contribute code.

Proposed resolution

Update current deviations from the Drupal coding standards. A list of necessary changes can be generated from the online https://pareview.sh/ or locally through Code sniffer (https://www.drupal.org/node/1419988)

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

idebr created an issue. See original summary.

ritzz’s picture

Assigned: Unassigned » ritzz

Working on it.

tessa bakker’s picture

Status: Active » Needs work

One issue left to fix, the LICENSE is needed for GitHub:

FILE: /root/repos/pareviewsh/pareview_temp/src/GuardianManager.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 12 WARNINGS AFFECTING 12 LINES
--------------------------------------------------------------------------
24 | 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
50 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
73 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
76 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
83 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
90 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
92 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
115 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
145 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
176 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
177 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
--------------------------------------------------------------------------
idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new11.25 KB

Attached patch should fix most of the remaining coding standard issues.

tessa bakker’s picture

Looks really good!

Some small things:
* drupal_set_message is deprecated with D8.5
* the user storage is only needed within the Manager, replacing entityTypeManager with userStorage make the code cleaner
* r129 $site = $this->configFactory->getEditable('system.site')->get('name'); isn't an editable variable, $this->configFactory->get('system.site')->... is more than enough

tessa bakker’s picture

Status: Needs review » Needs work
idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB
new11.85 KB

#7.1 Created a followup issue to replace drupal_set_message(), since there is no stable version of Drupal 8.5.x yet. The issue is available at #2941390: Replace deprecated drupal_set_message() with Messenger service

#7.2 Moved entityTypeManager->getStorage('user') to the construct function based on the pattern in \Drupal\Core\Installer\Form\SiteConfigureForm. Is this what you had in mind?

#7.3 Replaced $this->configFactory->getEditable('system.site') with $this->configFactory->get('system.site')

tessa bakker’s picture

Assigned: ritzz » Unassigned
Status: Needs review » Fixed

Thanks for the new patch :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.