1414import com .github .packageurl .PackageURL ;
1515import com .intellij .codeInsight .daemon .DaemonCodeAnalyzer ;
1616import com .intellij .codeInsight .daemon .HighlightDisplayKey ;
17+ import com .intellij .codeHighlighting .HighlightDisplayLevel ;
1718import com .intellij .codeInspection .InspectionProfile ;
1819import com .intellij .codeInspection .InspectionProfileEntry ;
1920import com .intellij .lang .annotation .AnnotationBuilder ;
@@ -165,7 +166,7 @@ public void apply(@NotNull PsiFile file, Map<Dependency, Result> annotationResul
165166 if (!quickfixes .isEmpty () && this .isQuickFixApplicable (e )) {
166167 quickfixes .forEach ((source , report ) ->{
167168 AnnotationBuilder builder = holder
168- .newAnnotation (getHighlightSeverity (report ), messageBuilder .toString ())
169+ .newAnnotation (getHighlightSeverity (report , e ), messageBuilder .toString ())
169170 .tooltip (tooltipBuilder .toString ())
170171 .range (e );
171172 if (CAIntentionAction .isQuickFixAvailable (report )) {
@@ -189,16 +190,24 @@ public void apply(@NotNull PsiFile file, Map<Dependency, Result> annotationResul
189190 }
190191
191192 @ NotNull
192- private static HighlightSeverity getHighlightSeverity (DependencyReport report ) {
193- if (CAIntentionAction .thereAreNoIssues (report ) && CAIntentionAction .thereIsRecommendation (report ))
194- {
195- return HighlightSeverity .WEAK_WARNING ;
193+ private HighlightSeverity getHighlightSeverity (DependencyReport report , @ NotNull PsiElement context ) {
194+ // Get the configured severity from the inspection settings
195+ final InspectionProfileEntry inspection = this .getInspection (context , this .getInspectionShortName ());
196+ if (inspection != null ) {
197+ final InspectionProfile profile = InspectionProjectProfileManager .getInstance (context .getProject ()).getCurrentProfile ();
198+ final HighlightDisplayKey key = HighlightDisplayKey .find (this .getInspectionShortName ());
199+ if (key != null ) {
200+ HighlightDisplayLevel level = profile .getErrorLevel (key , context );
201+ return level .getSeverity ();
202+ }
196203 }
197- else
198- {
204+
205+ // Fallback to original logic if inspection settings can't be determined
206+ if (CAIntentionAction .thereAreNoIssues (report ) && CAIntentionAction .thereIsRecommendation (report )) {
207+ return HighlightSeverity .WEAK_WARNING ;
208+ } else {
199209 return HighlightSeverity .ERROR ;
200210 }
201-
202211 }
203212
204213 abstract protected String getInspectionShortName ();
0 commit comments