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 32
32
import com .magento .idea .magento2uct .inspections .UctProblemsHolder ;
33
33
import com .magento .idea .magento2uct .packages .SupportedIssue ;
34
34
import com .magento .idea .magento2uct .settings .UctSettingsService ;
35
+ import com .magento .idea .magento2uct .util .inspection .SortDescriptorResultsUtil ;
35
36
import java .nio .file .Paths ;
36
37
import org .jetbrains .annotations .NotNull ;
37
38
import org .jetbrains .annotations .Nullable ;
@@ -129,7 +130,9 @@ public void execute() {
129
130
}
130
131
131
132
for (final ProblemDescriptor descriptor
132
- : fileProblemsHolder .getResults ()) {
133
+ : SortDescriptorResultsUtil .sort (
134
+ fileProblemsHolder .getResults ()
135
+ )) {
133
136
final Integer code = fileProblemsHolder .getErrorCodeForDescriptor (
134
137
descriptor
135
138
);
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