Problem/Motivation

The project fails to adhere to the coding standards tested for by the coder module.


FILE: ...sites/drupal8alt.dev/modules/akamai/src/AkamaiAuthentication.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] There must be exactly one blank line after the file
   |       |     comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...isk/dev/sites/drupal8alt.dev/modules/akamai/src/AkamaiClient.php
----------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------
 199 | ERROR | [ ] Comment indentation error, expected only 1 spaces
 275 | ERROR | [ ] Return comment must be on the next line
 277 | ERROR | [ ] Private method name "AkamaiClient::_getQueue" is
     |       |     not in lowerCamel format
 313 | ERROR | [x] Missing function doc comment
 317 | ERROR | [x] Missing function doc comment
 327 | ERROR | [x] Missing function doc comment
 337 | ERROR | [x] Missing function doc comment
 347 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ites/drupal8alt.dev/modules/akamai/src/Form/CacheControlForm.php
----------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
  33 | ERROR   | Missing parameter name
  36 | ERROR   | Variable "akamaiClient" is camel caps format. do not
     |         | use mixed case (camelCase), use lower case and _
  37 | ERROR   | Variable "akamaiClient" is camel caps format. do not
     |         | use mixed case (camelCase), use lower case and _
 152 | WARNING | Translatable strings must not begin or end with
     |         | white spaces, use placeholders with t() for
     |         | variables
 170 | ERROR   | If the line declaring an array spans longer than 80
     |         | characters, each element should be broken into its
     |         | own line
 184 | WARNING | Only string literals should be passed to t() where
     |         | possible
----------------------------------------------------------------------


FILE: .../dev/sites/drupal8alt.dev/modules/akamai/src/Form/ConfigForm.php
----------------------------------------------------------------------
FOUND 17 ERRORS AND 2 WARNINGS AFFECTING 12 LINES
----------------------------------------------------------------------
  44 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  44 | ERROR   | [x] Comment indentation error after @todo element,
     |         |     expected 3 spaces
  45 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  45 | ERROR   | [ ] Comment indentation error, expected only 4
     |         |     spaces
  46 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  47 | WARNING | [ ] Line exceeds 80 characters; contains 133
     |         |     characters
  47 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  48 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  49 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  50 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  51 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  51 | ERROR   | [ ] Comment indentation error, expected only 4
     |         |     spaces
  52 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  53 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  54 | WARNING | [x] There must be no blank line following an inline
     |         |     comment
  54 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 0
  54 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, or question marks
 169 | ERROR   | [x] No space found before comment text; expected "//
     |         |     ->set('disabled', $values['disabled'])" but
     |         |     found "//->set('disabled', $values['disabled'])"
 169 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, or question marks
----------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...s/drupal8alt.dev/modules/akamai/src/Tests/AkamaiHomepageTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 71 | WARNING | Do not concatenate strings to translatable strings,
    |         | they should be part of the t() argument and you
    |         | should use placeholders
----------------------------------------------------------------------

Time: 332ms; Memory: 8.75Mb

Proposed resolution

Fix where possible all the code style issues. After applying the patch there are no fails.

Remaining tasks

User interface changes

Some strings are made properly translatable.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 2685715.2.patch9.12 KBalexpott
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes
FileSize
9.12 KB
alexpott’s picture

Status: Active » Needs review

As automated tests are not being run here is a local run...

d8test --module akamai

Drupal test run
---------------

Tests to be run:
  - Drupal\akamai\Tests\AkamaiHomepageTest

Test run started:
  Friday, March 11, 2016 - 14:19

Test summary
------------

Drupal\akamai\Tests\AkamaiHomepageTest                        16 passes

Test run duration: 12 sec
alexpott’s picture

Here are some notes on the more functional changes in the patch...

  1. +++ b/src/Form/CacheControlForm.php
    @@ -149,7 +149,12 @@ class CacheControlForm extends FormBase {
    -      $message = $paths . \Drupal::translation()->formatPlural(count($invalid_paths), ' path is invalid and does not exist', ' paths are invalid and do not exist') . $this->t(' on the site. Please provide valid URLs for purging.');
    

    Note that splitting the sentence here actually makes this impossible to translate in many languages... the solution is to give the translator the full context. Also concatenating strings which possibly contain markup is not advised - and yes in order to translate a string properly it can be necessary to add markup.

  2. +++ b/src/Form/CacheControlForm.php
    @@ -178,10 +185,7 @@ class CacheControlForm extends FormBase {
    -    $message = 'You are not authenticated to Akamai CCU v2. Until you authenticate, you will not be able to clear URLs from the Akamai cache. @link';
    -    $message = $this->t($message, ['@link' => $this->l($link_text, $url)]);
    

    So localise.d.o can't pick up this string so without this change translators will never get to translate it.

Cameron Tod’s picture

Status: Needs review » Fixed

Looks great, committed, thanks!

  • cam8001 committed 42cab28 on 8.x-3.x authored by alexpott
    Issue #2685715 by alexpott: Apply coder fixes to the project and tidy up...

Status: Fixed » Closed (fixed)

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