- Issue created by @samit.310@gmail.com
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 4:30am 21 February 2023 - Status changed to RTBC
almost 2 years ago 11:13am 21 February 2023 - ๐ฎ๐ณIndia TanujJain-TJ
Verified patch #2, tested it on Drupal 10.1x and hierarchy manager 3.3.1, the patch applied successfully and fixed all above mentioned phpcs errors and warnings. RTBC +1
- Status changed to Needs work
almost 2 years ago 2:02pm 21 February 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
- // jsoneditor min js. + // Jsoneditor min js. $cdn_library = _hierarchy_manager_use_cdn($libraries, 'libraries.jsoneditor', 'js'); if ($cdn_library) { $libraries['libraries.jsoneditor']['js'] = $cdn_library; } - // jsoneditor default theme. + // Jsoneditor default theme.
Those comments can be removed, since they just say what is already obvious from the code.
+/** + * The HmMenuController Controller Class. + */
A documentation comment for a class should not repeat the class name, which is already given from the code, and which type of class it is. It should describe the class purpose.
+ * @return null|object + * The hierarchy_manager object.
The description should use something different from hierarchy_manager and say when
NULL
is returned.- * parent id + * Parent id.
The article is missing.
- * The configurations - * + * The configurations. + *
It is configuration.
- // The overview form implemented by Drupal Menu UI module + // The overview form implemented by Drupal Menu UI module.
That sentence can be removed.
+ * @return null|array + * Form array of display plugin instance OR null.
The articles are missing and OR is misspelled.
- // Urls - $source_url = Url::fromRoute('hierarchy_manager.menu.tree.json', ['mid' => $mid], ['query' => ['token' => $token, 'destination' => $destination]])->toString(); - $update_url = Url::fromRoute('hierarchy_manager.menu.tree.update', ['mid' => $mid], ['query' => ['token' => $token]])->toString(); + // Urls.
It should be URLs, but that comment is useless and can be removed.
+ * @return bool|null * Return TRUE if the menu plugin is enabled, * otherwise return FALSE.
The type hinting does not match with the description.
'#title' => $this - ->t('Search'), + ->t('Search'),
The method should be on the same line containing the variable.
+ /** * Build the tree form. */ public function getForm(string $url_source, string $url_update, array &$form = [], FormStateInterface &$form_state = NULL, $options = NULL); - + /** * Build the data array that JS library accepts. */
The parameters are not described.
- Status changed to Needs review
almost 2 years ago 10:52am 23 February 2023 - Status changed to Needs work
almost 2 years ago 7:28pm 23 February 2023 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
+ * @return null|object + * The hierarchy manager object.
It still does not explain when
NULL
is returned.- * parent id + * The Parent id.
parent was already written correctly; it is id that needs to be fixed.
- * User account. + * User account. * @param string $vid - * Vocabulary ID. + * Vocabulary ID.
The article is missing.
- * Class HMConfigForm. + * The HMConfigForm Class.
Adding the article is not sufficient. The documentation comment for a class should describe the class purpose.
+ * The Parent form array. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The Form state object. + * + * @return null|array + * The Form array of display plugin instance or null.
Parent should be written in lower-case characters, since it is not at the beginning of a sentence; the same is true for Form.
The last comment does not make much sense.- * @return boolean|NULL - * Return TRUE if the menu plugin is enabled, - * otherwise return FALSE. + * @return bool|null + * Return menu plugin is enabled */
The existing description is already correct, except it does not explain when
NULL
is returned (assuming it is really returned). The new description is not grammatically correct.+ * @param string $url_update + * The URL update.
Probably it is The update URL.
+ * @param string $confirm + * The confirm true/false.
Since it is a string, and probably not limited to true and false as its values, that description needs to be changed.
- // Custom data + // Custom data.
That comment can be removed, since it does not explain much.
+ * @param bool $draggable + * The draggable status.
Whether the item is draggable. is probably better.
+ * @return null|object * The display plugin instance.
It does not explain when
NULL
is returned. - ๐ฎ๐ณIndia kkalashnikov Ghaziabad, India
thanks @apaderno for reviewing. I have taken care all those points in this patch.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
* @param bool $replace_local - * Force to replace local libraries with CDN. + * The Force to replace local libraries with CDN.
Force to replace local libraries with CDN. is wrong to describe a Boolean parameter, but adding an article does not fix the sentence. Furthermore, adding the article changes the verb to a noun.
- * @return NULL|object + * @return null|object + * The hierarchy manager object or null.
At least it says it can return NULL.
/** - * Class HmDisplayProfileForm. + * The HmDisplayProfileForm Class.
With or without Class, before or after the class name, still the documentation comment just repeats the class name.
+ * @return null|array + * The form array of display plugin instance or null.
The article is missing.
- * @return boolean|NULL - * Return TRUE if the menu plugin is enabled, - * otherwise return FALSE. + * @return bool|null + * Return menu plugin is enabled
The original comment was almost correct, except it did not need to say Return/return.
+ * @param array $form + * The form array.
The form is sufficient.
+ * @param string $confirm + * The confirm.
That needs to be expanded.
- Status changed to Needs review
almost 2 years ago 7:36am 24 March 2023 - ๐ฎ๐ณIndia kkalashnikov Ghaziabad, India
@apaderno Included comments #10 in this MR.
- Status changed to Needs work
6 months ago 12:41am 31 July 2024 Hi @kkalashnikov,
Applied the patch you provided, it was applied successfully but errors were still reported. Please see below:
hierarchy_manager git:(3.x) curl https://git.drupalcode.org/project/hierarchy_manager/-/merge_requests/18.diff | patch -p1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 42625 0 42625 0 0 99532 0 --:--:-- --:--:-- --:--:-- 99k patching file README.md patching file css/Plugin/jstree/hm.jstree.css patching file hierarchy_manager.install patching file hierarchy_manager.module patching file src/Controller/HmMenuController.php patching file src/Controller/HmTaxonomyController.php patching file src/Entity/HmDisplayProfile.php patching file src/Form/HMConfigForm.php patching file src/Form/HmDisplayProfileForm.php patching file src/Form/HmMenuForm.php patching file src/Form/HmOverviewTerms.php patching file src/Plugin/HmDisplayPlugin/HmDisplayJstree.php patching file src/Plugin/HmDisplayPluginInterface.php patching file src/Plugin/HmSetupPlugin/HmMenu.php patching file src/Plugin/HmSetupPluginBase.php patching file src/PluginTypeManager.php โ hierarchy_manager git:(3.x) โ cd .. โ contrib git:(master) โ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig hierarchy_manager FILE: ...v9/web/modules/contrib/hierarchy_manager/src/Form/HmDisplayProfileForm.php -------------------------------------------------------------------------------- FOUND 4 ERRORS AFFECTING 3 LINES -------------------------------------------------------------------------------- 9 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is | | Drupal\hierarchy_manager\Plugin\HmDisplayPluginManager. 27 | ERROR | [x] Multi-line function declaration not indented correctly; | | expected 4 spaces but found 6 27 | ERROR | [x] Multi-line function declarations must have a trailing comma | | after the last parameter 28 | ERROR | [x] Multi-line function declaration not indented correctly; | | expected 2 spaces but found 6 -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...rgissue-v9/web/modules/contrib/hierarchy_manager/src/Form/HMConfigForm.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 28 | ERROR | [x] Multi-line function declarations must have a trailing comma | | after the last parameter -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...-orgissue-v9/web/modules/contrib/hierarchy_manager/src/Form/HmMenuForm.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Drupal\Core\Form\FormStateInterface. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...ssue-v9/web/modules/contrib/hierarchy_manager/src/Form/HmOverviewTerms.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Drupal\Core\Form\FormStateInterface. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...s/contrib/hierarchy_manager/src/Plugin/HmDisplayPlugin/HmDisplayJstree.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 10 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is | | Drupal\hierarchy_manager\Plugin\HmDisplayPluginBase. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: .../modules/contrib/hierarchy_manager/src/Plugin/HmSetupPlugin/HmTaxonomy.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is | | Drupal\hierarchy_manager\Plugin\HmSetupPluginBase. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: .../web/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPlugin/HmMenu.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is | | Drupal\hierarchy_manager\Plugin\HmSetupPluginBase. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: .../web/modules/contrib/hierarchy_manager/src/Plugin/HmSetupPluginManager.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Drupal\Core\Cache\CacheBackendInterface. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: ...eb/modules/contrib/hierarchy_manager/src/Plugin/HmDisplayPluginManager.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Drupal\Core\Cache\CacheBackendInterface. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: .../modules/contrib/hierarchy_manager/src/Controller/HmTaxonomyController.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 14 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Symfony\Component\HttpFoundation\JsonResponse. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- FILE: .../web/modules/contrib/hierarchy_manager/src/Controller/HmMenuController.php -------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first | | wrong one is Drupal\Core\Access\CsrfTokenGenerator. -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- Time: 713ms; Memory: 12MB
Kindly check
Thanks,
Jake- Status changed to Closed: outdated
6 months ago 6:53am 31 July 2024 - ๐ฆ๐บAustralia mingsong ๐ฆ๐บ
Thanks everyone.
I close this issue as it has been fixed with 3.4.0