Problem/Motivation

❯ phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

FILE: /Users/specbee/Sites/Projects/secure_html/secure_html.module
-------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------
 6 | ERROR | [x] Doc comment short description must be on the first line
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: /Users/specbee/Sites/Projects/secure_html/src/Plugin/Filter/SecureHtmlFilter.php
--------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------------
  9 | ERROR | [ ] Missing short description in doc comment
 27 | ERROR | [x] list(...) is forbidden, use [...] instead.
 43 | ERROR | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------

Time: 110ms; Memory: 10MB

Steps to reproduce

Run following command
phpcs --standard=“Drupal,DrupalPractice” --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

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

Shanu Chouhan created an issue. See original summary.

shanu chouhan’s picture

Assigned: shanu chouhan » Unassigned
Status: Active » Needs review
StatusFileSize
new1.51 KB

I have Created a patch to fix this issue.

avpaderno’s picture

Title: Drupal coding standards issues » Fix the issues reported by phpcs
Priority: Normal » Minor
Issue tags: +Coding standards

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

dineshkumarbollu’s picture

StatusFileSize
new23.1 KB

Hi

The patch#2 applied cleanly but found 1 phpcbf warning that is fixed in the MR.

Thanks.

avpaderno’s picture

Status: Needs review » Needs work
 /**
  * @file
- *
  * Hook implementations.
  */

Since that comment is edited, the description should be changed too. (Hook implementations for the Secure html module.)

 /**
+ * A filter that Wraps content in an iframe.
+ *

Wraps is misspelled, since it has been capitalized when it should not.

Also, the report shown in the issue summary is for a single file, but the MR changes two files. Either the report is updated or the MR changes what the report says to change.

dineshkumarbollu’s picture

Status: Needs work » Needs review

Hi
I changed the 2 comment which reported above, while running phpcs command before applying patch changes are in 2 files.

Thanks

avpaderno’s picture

Status: Needs review » Needs work
+ /**
++ * A filter that Wraps content in an iframe.
++ *
+  * @Filter(
+-      list($k, $v) = explode("=", $str);
++      [$k, $v] = explode("=", $str);
+   public function settingsForm(array $form, FormStateInterface $form_state) {
+-    $form['secure_html_settings'] = array(
++    $form['secure_html_settings'] = [

There are extra plus/minus signs that need to be removed.

- * Hook implementations.
+ * Hook implementations for the Secure html module..

There are two periods at the end of the description instead of one.

imustakim’s picture

Assigned: Unassigned » imustakim
imustakim’s picture

Assigned: imustakim » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.77 KB

Patch updated.
Please review.

avpaderno’s picture

Status: Needs review » Needs work
 /**
  * @file
- *
- * Hook implementations.
+ * Hook implementations for Secure HTML module.
  */

The module name is Secure html, not Secure HTML.
A definite article is missing after for.

The report shows warnings/errors for a single file, but the patch changes two files. Either the patch changes only the file for which the issue summary reports warnings/errors or the report is changed to reflect the changes done.

imustakim’s picture

Issue summary: View changes
imustakim’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB
new247 bytes

Patch updated.
Please review.

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

  • anrkaid committed 06564578 on 1.0.x authored by imustakim
    Issue #3359098 by dineshkumarbollu, imustakim, Shanu Chouhan, anrkaid,...
anrkaid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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