IDEA-211131 Bundled plugins: highlight generic <idea-plugin> "url" values

This commit is contained in:
Yann Cébron
2019-04-16 16:04:08 +02:00
parent 1127e5762f
commit 4c85a4c8b4
3 changed files with 12 additions and 1 deletions
@@ -149,6 +149,7 @@ inspections.plugin.xml.plugin.should.have.jetbrains.vendor=Plugin developed as a
inspections.plugin.xml.plugin.should.include.jetbrains.vendor=Plugin developed as a part of IntelliJ IDEA project should include 'JetBrains' as one of its vendors
inspections.plugin.xml.plugin.jetbrains.vendor.no.url=Plugin developed as a part of IntelliJ IDEA project shouldn''t specify ''{0}'' as url
inspections.plugin.xml.plugin.jetbrains.vendor.no.email=Plugin developed as a part of IntelliJ IDEA project shouldn't specify email
inspections.plugin.xml.plugin.jetbrains.no.generic.plugin.url=Plugin developed as a part of IntelliJ IDEA project shouldn't specify generic plugin url
inspections.plugin.xml.ep.doesnt.have.with=<extensionPoint> does not have <with> tags to specify the types of class fields
inspections.plugin.xml.ep.both.beanClass.and.interface=<extensionPoint> must not specify both 'interface' and 'beanClass' attributes
inspections.plugin.xml.ep.missing.beanClass.and.interface=<extensionPoint> must specify either 'interface' or 'beanClass' attribute
@@ -280,6 +280,15 @@ public class PluginXmlDomInspection extends BasicDomElementsInspection<IdeaPlugi
private static void checkJetBrainsPlugin(IdeaPlugin ideaPlugin, DomElementAnnotationHolder holder, @NotNull Module module) {
if (!PsiUtil.isIdeaProject(module.getProject())) return;
if (DomUtil.hasXml(ideaPlugin.getUrl())) {
String url = ideaPlugin.getUrl().getStringValue();
if ("https://www.jetbrains.com/idea".equals(url)) {
holder.createProblem(ideaPlugin.getUrl(),
DevKitBundle.message("inspections.plugin.xml.plugin.jetbrains.no.generic.plugin.url"),
new RemoveDomElementQuickFix(ideaPlugin.getUrl())).highlightWholeElement();
}
}
if (!hasRealPluginId(ideaPlugin)) return;
String id = ideaPlugin.getId().getStringValue();
@@ -1,4 +1,5 @@
<idea-plugin>
<idea-plugin
<error descr="Plugin developed as a part of IntelliJ IDEA project shouldn't specify generic plugin url">url="https://www.jetbrains.com/idea"</error>>
<id>test</id>
<version>1.0</version>
<vendor <error descr="Plugin developed as a part of IntelliJ IDEA project shouldn't specify 'http://www.jetbrains.com' as url">url="http://www.jetbrains.com"</error>