Problem/Motivation

There are some Drupal coding standard errors which needs to to be fixed.

Steps to reproduce

Fixed using php codesniffer

my_site_name_dir % vendor/squizlabs/php_codesniffer/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/tweetable_text_for_ckeditor 

FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/css/tweetabletext.css
--------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AFFECTING 14 LINES
--------------------------------------------------------------------------------------------------------------------------
  2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  6 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  7 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
  9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
  9 | ERROR | [x] Expected 1 space after colon in style definition; 0 found
 10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 12 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 13 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 6
 16 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 2
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 15 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------


FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/tweetable_text_ckeditor.module
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 12 | ERROR | [x] Opening brace should be on the same line as the declaration
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/libraries/css/tweetabletext.css
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 4 | ERROR | [x] CSS colours must be defined in lowercase; expected #4099ff but found #4099FF
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------


FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/libraries/README.md
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
 54 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
 55 | ERROR   | [x] Expected 1 newline at end of file; 4 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------


FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/tweetable_text_ckeditor.info.yml
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------------------------------


FILE: /sample/my_site_name_dir/web/modules/contrib/tweetable_text_for_ckeditor/README.txt
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

Time: 186ms; Memory: 8MB

Comments

meghasharma created an issue. See original summary.

meghasharma’s picture

Assigned: meghasharma » Unassigned
Status: Active » Needs review
StatusFileSize
new2.8 KB

Fixed all the errors: please review the patch

meghasharma’s picture

Issue summary: View changes
msuthars’s picture

Assigned: Unassigned » msuthars
imalabya’s picture

Status: Needs review » Needs work

Please fix DrupalPractice issues as well.

FILE: /Users/malabyatewari/Projects/tweetable_text_for_ckeditor/src/Plugin/CKEditorPlugin/TweetableText.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 39 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------
meghasharma’s picture

Status: Needs work » Needs review
StatusFileSize
new3.59 KB
new701 bytes

please review

imalabya’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks @meghasharma

msuthars’s picture

Assigned: msuthars » Unassigned

@imalabya Thanks for reviewing the patch. From next time please check that if an issue is already assigned to someone, that means he/she already is working/reviewing the issue. The feature Assigned is there to check if someone working or not on the issue.

rahul.shinde’s picture

Status: Reviewed & tested by the community » Needs work

@meghasharma, Please address the following,

+++ b/src/Plugin/CKEditorPlugin/TweetableText.php
@@ -2,6 +2,7 @@
+use Drupal\Core\StringTranslation\StringTranslationTrait;

Please remove use statement as this is not used.

meghasharma’s picture

Status: Needs work » Needs review
StatusFileSize
new3.37 KB
new421 bytes

please review

rahul.shinde’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @meghasharma.
Changes looks good to me.

vishnukumar’s picture

Thanks @meghasharma
@rahul.shinde @msuthars @imalabya

  • meghasharma authored a41732f on 1.0.x
    Issue #3170769 by meghasharma, msuthars, imalabya, rahul.shinde,...
vishnukumar’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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