mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
assertion to ensure tools do not register INFORMATION level problems in batch
such problems are intended to provide a quick fix only which should be treated as intention, thus should not be shown in batch mode
This commit is contained in:
@@ -41,7 +41,9 @@ public enum ProblemHighlightType {
|
||||
/** Enforces {@link com.intellij.codeHighlighting.HighlightDisplayLevel#WEAK_WARNING} severity level */
|
||||
WEAK_WARNING,
|
||||
|
||||
/** Enforces {@link com.intellij.codeHighlighting.HighlightDisplayLevel#DO_NOT_SHOW} severity level */
|
||||
/** Enforces {@link com.intellij.codeHighlighting.HighlightDisplayLevel#DO_NOT_SHOW} severity level
|
||||
* Please ensure that if used from inspection explicitly, corresponding problem is added in the onTheFly mode only
|
||||
*/
|
||||
INFORMATION,
|
||||
|
||||
/** JEP 277 enhanced deprecation */
|
||||
|
||||
@@ -134,12 +134,21 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
@NotNull final List<LocalInspectionToolWrapper> toolWrappers) {
|
||||
final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
|
||||
inspect(new ArrayList<>(toolWrappers), iManager, false, false, progress);
|
||||
boolean isSingleToolRun = context.getCurrentProfile().getSingleTool() != null;
|
||||
addDescriptorsFromInjectedResults(iManager, context);
|
||||
List<InspectionResult> resultList = result.get(getFile());
|
||||
if (resultList == null) return;
|
||||
Set<String> toolsWithInformationInBatch = new HashSet<>();
|
||||
for (InspectionResult inspectionResult : resultList) {
|
||||
LocalInspectionToolWrapper toolWrapper = inspectionResult.tool;
|
||||
final String shortName = toolWrapper.getShortName();
|
||||
for (ProblemDescriptor descriptor : inspectionResult.foundProblems) {
|
||||
if (!isSingleToolRun &&
|
||||
descriptor.getHighlightType() == ProblemHighlightType.INFORMATION &&
|
||||
toolsWithInformationInBatch.add(shortName)) {
|
||||
LOG.error("Tool '" + shortName + "' registers INFORMATION level problem in batch mode, " +
|
||||
"though warning or level is used in user's settings");
|
||||
}
|
||||
addDescriptors(toolWrapper, descriptor, context);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user