Skip to content

Commit 870497f

Browse files
author
Vitaliy Boyko
committed
Static fixes and test fixes
1 parent a05a21f commit 870497f

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

src/com/magento/idea/magento2plugin/actions/generation/dialog/eavattribute/EavAttributeDialog.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@
4545
import javax.swing.KeyStroke;
4646
import org.jetbrains.annotations.NotNull;
4747

48-
@SuppressWarnings({"PMD.GodClass", "PMD.TooManyMethods"})
48+
@SuppressWarnings({
49+
"PMD.GodClass",
50+
"PMD.TooManyMethods",
51+
"PMD.ExcessiveImports",
52+
"PMD.AccessorMethodGeneration"
53+
})
4954
public abstract class EavAttributeDialog extends AbstractDialog {
5055

5156
protected String moduleName;
@@ -297,6 +302,10 @@ protected void generateExtraFilesBeforeDataPatchGeneration() {
297302
generateSourceModelFile();
298303
}
299304

305+
@SuppressWarnings({
306+
"PMD.EmptyMethodInAbstractClassShouldBeAbstract",
307+
"PMD.UncommentedEmptyMethodBody"
308+
})
300309
protected void generateExtraFilesAfterDataPatchGeneration(
301310
final EavEntityDataInterface eavEntityDataInterface
302311
) {}
@@ -319,7 +328,6 @@ protected void addCancelActionForEsc() {
319328
);
320329
}
321330

322-
@SuppressWarnings("PMD.AccessorMethodGeneration")
323331
protected void setAttributeInputComboBoxAction(
324332
final JComboBox<ComboBoxItemData> sourceComboBox,
325333
final JComboBox<ComboBoxItemData> inputComboBox
@@ -333,7 +341,6 @@ protected void setAttributeInputComboBoxAction(
333341
);
334342
}
335343

336-
@SuppressWarnings("PMD.AccessorMethodGeneration")
337344
protected void setSourceComboBoxAction(final JComboBox<ComboBoxItemData> sourceComboBox) {
338345
if (sourceComboBox == null) {
339346
return;
@@ -344,7 +351,6 @@ protected void setSourceComboBoxAction(final JComboBox<ComboBoxItemData> sourceC
344351
);
345352
}
346353

347-
@SuppressWarnings("PMD.AccessorMethodGeneration")
348354
protected void setSourceModelPanelAction(
349355
final JPanel attributeCustomSourceModelPanel,
350356
final JTextField sourceModelDirectoryTexField
@@ -358,7 +364,6 @@ protected void setSourceModelPanelAction(
358364
);
359365
}
360366

361-
@SuppressWarnings("PMD.AccessorMethodGeneration")
362367
protected void addOptionPanelListener(
363368
final JComboBox<ComboBoxItemData> attributeSourceComboBox,
364369
final JComboBox<ComboBoxItemData> attributeInputComboBox,
@@ -407,7 +412,6 @@ protected void setAutocompleteListenerForAttributeCodeField(
407412
.addDocumentListener(new AttributeCodeAdapter(attributeCodeTextField));
408413
}
409414

410-
@SuppressWarnings("PMD.AccessorMethodGeneration")
411415
protected void setAutocompleteListenerForDataPathNameField(
412416
final JTextField mainTextField,
413417
final JTextField dependentTextField
@@ -421,7 +425,6 @@ protected void setAutocompleteListenerForDataPathNameField(
421425
.addDocumentListener(new DataPatchNameAdapter(dependentTextField, getEntityName()));
422426
}
423427

424-
@SuppressWarnings("PMD.AccessorMethodGeneration")
425428
protected void setAutocompleteListenerForSourceModelNameField(
426429
final JTextField mainTextField,
427430
final JTextField dependentTextField

src/com/magento/idea/magento2plugin/actions/generation/generator/CustomerEavAttributePatchGenerator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ protected void fillAttributes(final Properties attributes) {
5757
.append(
5858
"EAV_CONFIG_CLASS",
5959
DataPatchDependency.EAV_CONFIG.getClassPatch()
60-
)
61-
.append(
60+
).append(
61+
"ATTRIBUTE_RESOURCE",
62+
DataPatchDependency.ATTRIBUTE_RESOURCE.getClassPatch()
63+
).append(
6264
"CUSTOMER_METADATA_INTERFACE",
6365
DataPatchDependency.CUSTOMER_METADATA_INTERFACE.getClassPatch()
6466
);

src/com/magento/idea/magento2plugin/actions/generation/generator/EavAttributeSetupPatchGenerator.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ protected void fillAttributes(final Properties attributes) {
7676
.append(
7777
"MODULE_DATA_SETUP_INTERFACE",
7878
DataPatchDependency.MODULE_DATA_SETUP_INTERFACE.getClassPatch()
79-
).append(
80-
"ATTRIBUTE_RESOURCE",
81-
DataPatchDependency.ATTRIBUTE_RESOURCE.getClassPatch()
8279
)
8380
.append(
8481
"EAV_SETUP_FACTORY",

src/com/magento/idea/magento2plugin/actions/generation/generator/util/eav/DefaultAttributeMapper.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import java.util.Map;
1818

1919
public class DefaultAttributeMapper implements AttributeMapperInterface {
20+
private final static String PHP_DOUBLE_ARROW_OPERATOR = " => ";
21+
2022
@Override
2123
public List<String> mapAttributesByEntityData(final EavEntityDataInterface entityData) {
2224
final List<String> attributesWithValues = new ArrayList<>();
@@ -118,7 +120,7 @@ protected String getMappedOptions(
118120
}
119121

120122
protected String getParsedOptions(final Map<Integer, String> optionValues) {
121-
final String valueNode = "->" + wrapStringValueForTemplate("value") + " => ";
123+
final String valueNode = "->" + wrapStringValueForTemplate("value") + PHP_DOUBLE_ARROW_OPERATOR;
122124
final StringBuilder optionsContent = new StringBuilder();
123125

124126
for (final Integer optionKey : optionValues.keySet()) {
@@ -131,8 +133,8 @@ protected String getParsedOptions(final Map<Integer, String> optionValues) {
131133
optionsContent
132134
.append("->")
133135
.append(wrapStringValueForTemplate("option_" + optionKey))
134-
.append(" => ")
135-
.append("[")
136+
.append(PHP_DOUBLE_ARROW_OPERATOR)
137+
.append('[')
136138
.append(wrapStringValueForTemplate(optionValue))
137139
.append("], ");
138140
}
@@ -141,7 +143,7 @@ protected String getParsedOptions(final Map<Integer, String> optionValues) {
141143
}
142144

143145
protected String getParsedOptionSortOrders(final Map<Integer, String> optionSortOrders) {
144-
final String orderNode = "->" + wrapStringValueForTemplate("order") + " => ";
146+
final String orderNode = "->" + wrapStringValueForTemplate("order") + PHP_DOUBLE_ARROW_OPERATOR;
145147
final StringBuilder ordersContent = new StringBuilder();
146148

147149
for (final Integer optionKey : optionSortOrders.keySet()) {
@@ -154,9 +156,9 @@ protected String getParsedOptionSortOrders(final Map<Integer, String> optionSort
154156
ordersContent
155157
.append("->")
156158
.append(wrapStringValueForTemplate("option_" + optionKey))
157-
.append(" => ")
159+
.append(PHP_DOUBLE_ARROW_OPERATOR)
158160
.append(orderValue)
159-
.append(",");
161+
.append(',');
160162
}
161163

162164
return orderNode + "[" + ordersContent + "->]->";

0 commit comments

Comments
 (0)