File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
src/com/magento/idea/magento2uct Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 3232import com .magento .idea .magento2uct .inspections .UctProblemsHolder ;
3333import com .magento .idea .magento2uct .packages .SupportedIssue ;
3434import com .magento .idea .magento2uct .settings .UctSettingsService ;
35+ import com .magento .idea .magento2uct .util .inspection .SortDescriptorResultsUtil ;
3536import java .nio .file .Paths ;
3637import org .jetbrains .annotations .NotNull ;
3738import org .jetbrains .annotations .Nullable ;
@@ -129,7 +130,9 @@ public void execute() {
129130 }
130131
131132 for (final ProblemDescriptor descriptor
132- : fileProblemsHolder .getResults ()) {
133+ : SortDescriptorResultsUtil .sort (
134+ fileProblemsHolder .getResults ()
135+ )) {
133136 final Integer code = fileProblemsHolder .getErrorCodeForDescriptor (
134137 descriptor
135138 );
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+
6+ package com .magento .idea .magento2uct .util .inspection ;
7+
8+ import com .intellij .codeInspection .ProblemDescriptor ;
9+ import java .util .Comparator ;
10+ import java .util .LinkedList ;
11+ import java .util .List ;
12+
13+ public final class SortDescriptorResultsUtil {
14+
15+ private SortDescriptorResultsUtil () {
16+ }
17+
18+ /**
19+ * Get problems sorted by its lines.
20+ *
21+ * @param problems List[ProblemDescriptor]
22+ *
23+ * @return List[ProblemDescriptor]
24+ */
25+ public static List <ProblemDescriptor > sort (final List <ProblemDescriptor > problems ) {
26+ if (problems .isEmpty ()) {
27+ return problems ;
28+ }
29+ problems .sort (Comparator .comparingInt (ProblemDescriptor ::getLineNumber ));
30+
31+ return new LinkedList <>(problems );
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments