Hello Team,

I have started to solve the coding standard of the module.
I can see too many coding standard issues are there that we can solve. I tried with a few files and will be finished more soon.
If possible please review my PR and merge it.

Thanks
--Ken

Issue fork salesforce-3222661

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

Ken Patolia created an issue. See original summary.

aaronbauman’s picture

Thanks for your attention on this module.
Can you please create a merge request when it's ready?

We'll need to get these updates into 5.x branch as well

sourabhjain’s picture

Assigned: Unassigned » sourabhjain

I am trying to resolve more issues related to coding standard.

sourabhjain’s picture

Assigned: sourabhjain » Unassigned
Status: Active » Needs review
StatusFileSize
new82.87 KB

Resolved the coding standard issues. Please review.

dipesh_goswami’s picture

Assigned: Unassigned » dipesh_goswami

Hi,
I am reviewing your patch.

dipesh_goswami’s picture

Assigned: dipesh_goswami » Unassigned
Status: Needs review » Needs work

Hi sourabhjain,
Your patch applied cleanly.
Most of the errors are solved.
Some errors left (shown below):

$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig salesforce-3222661/

FILE: ...les\salesforce_example\src\EventSubscriber\SalesforceExampleSubscriber.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  82 | 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
 134 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 159 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 172 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...dules\salesforce_logger\src\EventSubscriber\SalesforceLoggerSubscriber.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 16 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
 57 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: ...sforce-3222661\modules\salesforce_mapping\src\Entity\SalesforceMapping.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 291 | WARNING | Unused variable $i.
 445 | WARNING | Unused variable $i.
 450 | WARNING | Exceptions should not be translated
--------------------------------------------------------------------------------


FILE: ...es\salesforce_mapping\src\Plugin\SalesforceMappingField\PropertiesBase.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 31 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...alesforce_mapping\src\Plugin\SalesforceMappingField\PropertiesExtended.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 27 | WARNING | Unused variable $dummy.
--------------------------------------------------------------------------------


FILE: ...salesforce_mapping\src\Plugin\SalesforceMappingField\RelatedProperties.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 106 | WARNING | Unused variable $dummy.
 186 | WARNING | Unused variable $group.
--------------------------------------------------------------------------------


FILE: ...222661\modules\salesforce_mapping\src\SalesforceMappingFieldPluginBase.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 410 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
 412 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         | $this->t() instead
--------------------------------------------------------------------------------


FILE: ...ing\tests\modules\salesforce_mapping_test\salesforce_mapping_test.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------
  6 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
  7 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
  8 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
  9 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 10 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 11 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 12 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 13 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 14 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 15 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
 16 | WARNING | All dependencies must be prefixed with the project name, for
    |         | example "drupal:"
--------------------------------------------------------------------------------


FILE: ...61\modules\salesforce_mapping_ui\src\Controller\AutocompleteController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 15 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...61\modules\salesforce_mapping_ui\src\Controller\MappedObjectController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 25 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: ...sforce-3222661\modules\salesforce_mapping_ui\src\Form\MappedObjectForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 106 | WARNING | Unused variable $entity_id.
--------------------------------------------------------------------------------


FILE: ...661\modules\salesforce_mapping_ui\src\Form\SalesforceMappingFieldsForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 301 | ERROR | Doc comment is empty
--------------------------------------------------------------------------------


FILE: ...1\modules\salesforce_mapping_ui\src\Form\SalesforceMappingFormCrudBase.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 449 | WARNING | Unused variable $entity_type_id.
--------------------------------------------------------------------------------


FILE: ...\modules\salesforce_mapping_ui\src\Tests\SalesforceMappingCrudFormTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 62 | WARNING | Unused global variable $base_path.
--------------------------------------------------------------------------------


FILE: ...trib\salesforce-3222661\modules\salesforce_oauth\salesforce_oauth.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 8 | WARNING | All dependencies must be prefixed with the project name, for
   |         | example "drupal:"
--------------------------------------------------------------------------------


FILE: ...2661\modules\salesforce_oauth\src\Controller\SalesforceOAuthController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 18 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
 78 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
 80 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: ...es\salesforce_oauth\tests\src\FunctionalJavascript\SalesforceOAuthTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 54 | ERROR | Public method name "SalesforceOAuthTest::testOAuth" is not in
    |       | lowerCamel format
 92 | ERROR | Public method name "SalesforceOAuthTest::testOAuthCallback" is
    |       | not in lowerCamel format
--------------------------------------------------------------------------------


FILE: ...ntrib\salesforce-3222661\modules\salesforce_pull\salesforce_pull.drush.inc
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
 132 | ERROR   | The array declaration extends to column 113 (the limit is 80).
     |         | The array content should be split up over multiple lines
 144 | ERROR   | The array declaration extends to column 118 (the limit is 80).
     |         | The array content should be split up over multiple lines
 191 | WARNING | Unused variable $i.
--------------------------------------------------------------------------------


FILE: ...contrib\salesforce-3222661\modules\salesforce_pull\salesforce_pull.install
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 49 | ERROR | unserialize() is insecure unless allowed classes are limited. Use
    |       | a safe format like JSON or use the allowed_classes option.
--------------------------------------------------------------------------------


FILE: ...ce-3222661\modules\salesforce_pull\src\Commands\SalesforcePullCommands.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 248 | WARNING | Unused variable $i.
 350 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...ce-3222661\modules\salesforce_push\src\Commands\SalesforcePushCommands.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 152 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...\contrib\salesforce-3222661\modules\salesforce_push\src\PushController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 76 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: ...alesforce-3222661\modules\salesforce_push\tests\src\Unit\PushQueueTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 34 | ERROR | Missing member variable doc comment
--------------------------------------------------------------------------------


FILE: ...s\salesforce_webform\src\Plugin\SalesforceMappingField\WebformElements.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 100 | WARNING | Unused variable $main_element_name.
--------------------------------------------------------------------------------


FILE: ...s\dipeshdrupal\web\modules\contrib\salesforce-3222661\salesforce.drush.inc
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 491 | ERROR | The trigger_error message 'Salesforce module support for Drush 8
     |       | is deprecated and will be removed in a future release' does not
     |       | match the relaxed standard format: %thing% is deprecated in
     |       | %deprecation-version% any free text %removal-version%.
     |       | %extra-info%. See %cr-link%
--------------------------------------------------------------------------------


FILE: ...ocs\dipeshdrupal\web\modules\contrib\salesforce-3222661\salesforce.install
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 448 | ERROR | unserialize() is insecure unless allowed classes are limited.
     |       | Use a safe format like JSON or use the allowed_classes option.
--------------------------------------------------------------------------------


FILE: ...web\modules\contrib\salesforce-3222661\src\Commands\SalesforceCommands.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 422 | WARNING | Unused variable $k.
--------------------------------------------------------------------------------


FILE: ...docs\dipeshdrupal\web\modules\contrib\salesforce-3222661\src\Exception.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 11 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...b\modules\contrib\salesforce-3222661\src\Form\SalesforceAuthDeleteForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 11 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...pal\web\modules\contrib\salesforce-3222661\src\Form\SalesforceAuthForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 177 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...b\modules\contrib\salesforce-3222661\src\Form\SalesforceAuthRevokeForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 11 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...web\modules\contrib\salesforce-3222661\src\Form\SalesforceAuthSettings.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 16 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...eshdrupal\web\modules\contrib\salesforce-3222661\src\Form\SettingsForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
  82 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 118 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 129 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 140 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 158 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 158 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 166 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 169 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 182 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
 185 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: ...ipeshdrupal\web\modules\contrib\salesforce-3222661\src\Rest\RestClient.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
 176 | WARNING | Exceptions should not be translated
 215 | WARNING | Exceptions should not be translated
 250 | WARNING | Exceptions should not be translated
 269 | WARNING | Exceptions should not be translated
 426 | WARNING | Unused variable $key.
 481 | WARNING | Exceptions should not be translated
--------------------------------------------------------------------------------


FILE: ...shdrupal\web\modules\contrib\salesforce-3222661\src\Rest\RestException.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...eshdrupal\web\modules\contrib\salesforce-3222661\src\Rest\RestResponse.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 14 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
 89 | WARNING | Exceptions should not be translated
--------------------------------------------------------------------------------


FILE: ...l\web\modules\contrib\salesforce-3222661\src\Rest\RestResponseDescribe.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...\web\modules\contrib\salesforce-3222661\src\Rest\RestResponseResources.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...cs\dipeshdrupal\web\modules\contrib\salesforce-3222661\src\SelectQuery.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...eshdrupal\web\modules\contrib\salesforce-3222661\src\SelectQueryResult.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...pp\htdocs\dipeshdrupal\web\modules\contrib\salesforce-3222661\src\SFID.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...htdocs\dipeshdrupal\web\modules\contrib\salesforce-3222661\src\SObject.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | WARNING | The class short comment should describe what the class does and
   |         | not simply repeat the class name
--------------------------------------------------------------------------------

Time: 4 secs; Memory: 18MB

So, moving it to "Needs work".

asheesh kumar pal’s picture

Assigned: Unassigned » asheesh kumar pal

i m working on this issue

asheesh kumar pal’s picture

StatusFileSize
new108.22 KB

I have fixed some issues please review it.

asheesh kumar pal’s picture

Assigned: asheesh kumar pal » Unassigned
Status: Needs work » Needs review
StatusFileSize
new108.22 KB

I have fixed some issues please review it.

ritviktak’s picture

Assigned: Unassigned » ritviktak
ritviktak’s picture

Assigned: ritviktak » Unassigned
StatusFileSize
new108.22 KB

Hey asheesh, i have reviewed your patch.
It got failed to apply. Due to below whitespace warnings.

coding_standard_fix-3307056-10.patch:1005: trailing whitespace.
$this->assertElementPresent("[name='field_mappings[$i][config][drupal_field_value]'],
coding_standard_fix-3307056-10.patch:1007: trailing whitespace.
$this->assertElementPresent("[name='field_mappings[$i][config][salesforce_field]'],
coding_standard_fix-3307056-10.patch:1476: trailing whitespace.
$items = $this->connection->queryRange('SELECT * FROM {' . static::TABLE_NAME . '}
warning: 3 lines add whitespace errors.

I have fixed this issue & uploading a patch for same.

ritviktak’s picture

StatusFileSize
new118.2 KB
new294.52 KB

Hey, I have resolved all the remaining issues. Uploading final patch which includes all the remaining issues resolved. I have applied it on my local, it applied cleanly. Please refer to patch coding_standard_fix-3222661-13.patch & screenshot.

manuvelasco’s picture

The path from #13 applies successfully and I don't see any warning now.

matt_paz’s picture

Not sure if it is appropriate to note here or not, but I noticed the following as well:

Deprecated function: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\salesforce_mapping\SalesforceMappingFieldPluginBase->pushValue() (line 272 of modules/contrib/salesforce/modules/salesforce_mapping/src/SalesforceMappingFieldPluginBase.php).

aaronbauman’s picture

Version: 8.x-4.2 » 5.0.x-dev
StatusFileSize
new90.29 KB

Thanks everyone for the patches.
4.x no longer supported, so i re-rolled against 5.x

aaronbauman’s picture

Status: Needs review » Fixed

Committed a modified version of this patch. Thanks for the contrib

Status: Fixed » Closed (fixed)

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