31
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-09-28 04:59:04 +00:00

check reserved words

This commit is contained in:
Denis Ryabov 2021-05-11 23:07:22 +03:00
parent 8e53d6f964
commit 4ac26c9282
2 changed files with 4 additions and 10 deletions

View File

@ -45,8 +45,7 @@ COM_JEDCHECKER_INFO_XML_NAME_XML="The name tag in this file is: <b>%s</b>"
COM_JEDCHECKER_INFO_XML_VERSION_XML="Version tag has the value: %s"
COM_JEDCHECKER_INFO_XML_CREATIONDATE_XML="The creationDate tag has the value: %s"
COM_JEDCHECKER_INFO_XML_NO_MANIFEST="No manifest file found"
COM_JEDCHECKER_INFO_XML_NAME_MODULE_PLUGIN="Listing name ('%s') contains 'module' or 'plugin'"
COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS="Keywords such as module, plugin or template are considered reserved words and can't be used in the extension names ('%s')"
COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS="Keywords such as module, plugin or template are considered reserved words ('%2$s') and can't be used in the extension names ('%1$s')"
COM_JEDCHECKER_INFO_XML_NAME_VERSION="Version in name/title ('%s')"
COM_JEDCHECKER_INFO_XML_NAME_JOOMLA="An extension name ('%s') can't start with the word 'Joomla'"
COM_JEDCHECKER_INFO_XML_NAME_JOOMLA_DERIVATIVE="Extensions that use 'Joomla' or a derivative of Joomla in the extension name ('%s') need to be licensed by OSM"

View File

@ -134,15 +134,10 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
$this->report->addInfo($file, implode('<br />', $info));
// NM3 - Listing name contains “module” or “plugin”
if (preg_match('/module|plugin/i', $extensionName))
// (and other reserved words)
if (preg_match('/\b(?:module|plugin|component|template|extension|free)\b/i', $extensionName, $match))
{
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_MODULE_PLUGIN', $extensionName));
}
// The "template" is reserved keyword
if (stripos($extensionName, 'template') !== false)
{
$this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName));
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName, strtolower($match[0])));
}
// NM5 - Version in name/title