- 🇮🇳India praveenpb Bangalore
Hi cilefen, Thanks for your quick response.
Please find the details below. It seems "Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps" triggering here.
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
47 | ERROR | Public method name "CustomCkeditor5::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem" is not in lowerCamel format
| | (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)Files.TxtFileLineLength.TooLong)
90 | ERROR | Public method name "CustomCkeditor5::mapCKEditor4SettingsToCKEditor5Configuration" is not in lowerCamel format
| | (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)Files.TxtFileLineLength.TooLong)
97 | ERROR | Public method name "CustomCkeditor5::computeCKEditor5PluginSubsetConfiguration" is not in lowerCamel format
| | (Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps) - 🇬🇧United Kingdom longwave UK
The issue for this is 📌 [meta] Fix 'Drupal.NamingConventions.ValidFunctionName' coding standard Active
@longwave Thank you for locating that issue. What is the scoping for standards fixes? Is this a duplicate?
- Status changed to Postponed: needs info
almost 2 years ago 1:26am 18 April 2023 - 🇳🇿New Zealand quietone
The error shows this failing on the sniff "Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps)" which is not enabled in not in the set of standards used by core and neither is "Drupal.NamingConventions.ValidFunctionName".
That points to this being a configuration error, that is, if one wants to use the same coding standards as core.Oh, I see the command is using the 'Drupal' standard which is not what core does.
@praveenpb, Can you change your command to use the same standard as core
--standard="core/phpcs.xml.dist"
and report back? The full details of what core does can be found in core/scripts/dev/commit-code-check.sh.Thanks
- 🇬🇧United Kingdom longwave UK
So the issue here is that core does not follow a particular standard, but custom code that does want to follow all standards is affected by this, because the non-compliant interface methods provided by core are implemented in the custom code. Not sure what we should do about this.
- 🇮🇳India praveenpb Bangalore
When I run it with
--standard="core/phpcs.xml.dist"
, it doesn't throw any errors.
So my questions are,1. Which one is the recommended standard to follow with custom code?
2. Is it fine if we follow what core follows? Otherwise we may face such issues if we implement non-compliant interface methods provided by core right?Thanks
- Status changed to Fixed
almost 2 years ago 4:55pm 20 April 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Is it fine if we follow what core follows?
Yes, that's what I would recommend. In your contrib modules, you can reuse Drupal core's coding standards by running
phpcs
like this: https://git.drupalcode.org/project/automatic_updates/-/blob/3.0.x/script.... Automatically closed - issue fixed for 2 weeks with no activity.