forked from unshare/hybris-integration-intellij-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#264 | Added new Flexible Search inspection rules
- Loading branch information
Showing
23 changed files
with
228 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
resources/inspectionDescriptions/FxsUnknownTypeNameInspection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
~ This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
~ Copyright (C) 2019 EPAM Systems <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation, either version 3 of the | ||
~ License, or (at your option) any later version. | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
~ See the GNU Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public License | ||
~ along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<html lang="en"> | ||
<body> | ||
This type does not exist in Type System (items.xml). | ||
</body> | ||
</html> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
resources/inspectionDescriptions/ImpexUnknownTypeAttributeInspection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- | ||
~ This file is part of "hybris integration" plugin for Intellij IDEA. | ||
~ Copyright (C) 2014-2019 Alexander Bartash <[email protected]> | ||
~ | ||
~ This program is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation, either version 3 of the | ||
~ License, or (at your option) any later version. | ||
~ | ||
~ This program is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
~ See the GNU Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public License | ||
~ along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<html> | ||
<body> | ||
This attribute does not exist in type system (items.xml). | ||
</body> | ||
</html> |
57 changes: 57 additions & 0 deletions
57
...dea/plugin/hybris/codeInspection/rule/flexibleSearch/FxsUnknownTypeAttributeInspection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
* Copyright (C) 2019 EPAM Systems <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.intellij.idea.plugin.hybris.codeInspection.rule.flexibleSearch | ||
|
||
import com.intellij.codeHighlighting.HighlightDisplayLevel | ||
import com.intellij.codeInspection.LocalInspectionTool | ||
import com.intellij.codeInspection.ProblemHighlightType | ||
import com.intellij.codeInspection.ProblemsHolder | ||
import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils | ||
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchColumnReference | ||
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchVisitor | ||
import com.intellij.idea.plugin.hybris.flexibleSearch.references.FxsTSAttributeReference | ||
import com.intellij.psi.PsiElementVisitor | ||
|
||
class FxsUnknownTypeAttributeInspection : LocalInspectionTool() { | ||
override fun getDefaultLevel(): HighlightDisplayLevel { | ||
return HighlightDisplayLevel.ERROR | ||
} | ||
|
||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor = object : FlexibleSearchVisitor() { | ||
|
||
override fun visitColumnReference(parameter: FlexibleSearchColumnReference) { | ||
val references = parameter.references | ||
if (references.isEmpty()) return | ||
|
||
val firstReference = references.firstOrNull() ?: return | ||
if (firstReference !is FxsTSAttributeReference) return | ||
|
||
val result = firstReference.multiResolve(false) | ||
if (result.isNotEmpty()) return | ||
val itemType = firstReference.getType() | ||
?: "unknown" | ||
|
||
holder.registerProblem( | ||
parameter, | ||
HybrisI18NBundleUtils.message("hybris.inspections.UnknownTypeAttributeInspection.key", parameter.text, itemType), | ||
ProblemHighlightType.ERROR | ||
) | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...lij/idea/plugin/hybris/codeInspection/rule/flexibleSearch/FxsUnknownTypeNameInspection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA. | ||
* Copyright (C) 2019 EPAM Systems <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.intellij.idea.plugin.hybris.codeInspection.rule.flexibleSearch | ||
|
||
import com.intellij.codeHighlighting.HighlightDisplayLevel | ||
import com.intellij.codeInspection.LocalInspectionTool | ||
import com.intellij.codeInspection.ProblemHighlightType | ||
import com.intellij.codeInspection.ProblemsHolder | ||
import com.intellij.idea.plugin.hybris.common.utils.HybrisI18NBundleUtils | ||
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchTableName | ||
import com.intellij.idea.plugin.hybris.flexibleSearch.psi.FlexibleSearchVisitor | ||
import com.intellij.idea.plugin.hybris.psi.reference.TSReferenceBase | ||
import com.intellij.psi.PsiElementVisitor | ||
|
||
class FxsUnknownTypeNameInspection : LocalInspectionTool() { | ||
override fun getDefaultLevel(): HighlightDisplayLevel { | ||
return HighlightDisplayLevel.ERROR | ||
} | ||
|
||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor = object : FlexibleSearchVisitor() { | ||
override fun visitTableName(parameter: FlexibleSearchTableName) { | ||
val references = parameter.references | ||
if (references.isEmpty()) return | ||
|
||
val firstReference = references.firstOrNull() ?: return | ||
if (firstReference !is TSReferenceBase<*>) return | ||
|
||
val result = firstReference.multiResolve(false) | ||
if (result.isNotEmpty()) return | ||
|
||
holder.registerProblem( | ||
parameter, | ||
HybrisI18NBundleUtils.message("hybris.inspections.UnknownTypeNameInspection.key", parameter.text), | ||
ProblemHighlightType.ERROR | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,7 @@ import com.intellij.psi.PsiReference | |
* @author Nosov Aleksandr <[email protected]> | ||
*/ | ||
|
||
abstract class TypeNameMixin(astNode: ASTNode) : ASTWrapperPsiElement(astNode), | ||
FlexibleSearchTableName { | ||
abstract class TypeNameMixin(astNode: ASTNode) : ASTWrapperPsiElement(astNode), FlexibleSearchTableName { | ||
|
||
private var myReference: FxsTSItemReference? = null | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.