Skip to content

Commit 070cfc0

Browse files
committed
fix linter errors
Signed-off-by: Kirill Mokevnin <mokevnin@gmail.com>
1 parent 8d5bd63 commit 070cfc0

File tree

3 files changed

+49
-33
lines changed

3 files changed

+49
-33
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
```java
88
import static io.hexlet.utils.ArraysAsSets;
99

10-
String[] firstNames = { "Vasya", "Kolya", "Petya" };
11-
String[] secondNames = { "Igor", "Petya", "Sergey", "Vasya", "Sasha" };
10+
String[] firstNames = {"Vasya", "Kolya", "Petya"};
11+
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
1212

1313
intersection(firstNames, secondNames);
1414
// ["Vasya", "Petya"]
@@ -19,8 +19,8 @@ intersection(firstNames, secondNames);
1919
```java
2020
import static io.hexlet.utils.ArraysAsSets;
2121

22-
String[] firstNames = { "Vasya", "Kolya", "Petya" };
23-
String[] secondNames = { "Igor", "Petya", "Sergey", "Vasya", "Sasha" };
22+
String[] firstNames = {"Vasya", "Kolya", "Petya"};
23+
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
2424

2525
union(firstNames, secondNames);
2626
// ["Petya", "Sasha", "Igor", "Kolya", "Vasya", "Sergey"]
@@ -31,8 +31,8 @@ union(firstNames, secondNames);
3131
```java
3232
import static io.hexlet.utils.ArraysAsSets;
3333

34-
String[] firstNames = { "Vasya", "Kolya", "Petya" };
35-
String[] secondNames = { "Igor", "Petya", "Sergey", "Vasya", "Sasha" };
34+
String[] firstNames = {"Vasya", "Kolya", "Petya"};
35+
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
3636
difference(firstNames, secondNames);
3737
// ["Kolya"]
3838
```

config/checkstyle/checkstyle.xml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC
3-
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4-
"https://checkstyle.org/dtds/configuration_1_3.dtd">
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

66
<!--
7+
78
Checkstyle configuration that checks the sun coding conventions from:
9+
810
- the Java Language Specification at
911
https://docs.oracle.com/javase/specs/jls/se11/html/index.html
12+
1013
- the Sun Code Conventions at https://www.oracle.com/technetwork/java/codeconvtoc-136057.html
14+
1115
- the Javadoc guidelines at
1216
https://www.oracle.com/technetwork/java/javase/documentation/index-137868.html
17+
1318
- the JDK Api documentation https://docs.oracle.com/en/java/javase/11/
19+
1420
- some best practices
21+
1522
Checkstyle is very configurable. Be sure to read the documentation at
1623
https://checkstyle.org (or in your downloaded distribution).
24+
1725
Most Checks are configurable, be sure to consult the documentation.
26+
1827
To completely disable a check, just comment it out or delete it from the file.
1928
To suppress certain violations please review suppression filters.
29+
2030
Finally, it is worth reading the documentation.
31+
2132
-->
2233

2334
<module name="Checker">
2435
<!--
2536
If you set the basedir property below, then all reported file
2637
names will be relative to the specified directory. See
2738
https://checkstyle.org/5.x/config.html#Checker
39+
2840
<property name="basedir" value="${basedir}"/>
2941
-->
3042
<property name="severity" value="error"/>
@@ -60,8 +72,8 @@
6072
<!-- See https://checkstyle.org/config_sizes.html -->
6173
<module name="FileLength"/>
6274
<module name="LineLength">
63-
<property name="fileExtensions" value="java"/>
64-
<property name="max" value="120"/>
75+
<property name="fileExtensions" value="java"/>
76+
<property name="max" value="120"/>
6577
</module>
6678

6779
<!-- Checks for whitespace -->
@@ -71,10 +83,10 @@
7183
<!-- Miscellaneous other checks. -->
7284
<!-- See https://checkstyle.org/config_misc.html -->
7385
<module name="RegexpSingleline">
74-
<property name="format" value="\s+$"/>
75-
<property name="minimum" value="0"/>
76-
<property name="maximum" value="0"/>
77-
<property name="message" value="Line has trailing spaces."/>
86+
<property name="format" value="\s+$"/>
87+
<property name="minimum" value="0"/>
88+
<property name="maximum" value="0"/>
89+
<property name="message" value="Line has trailing spaces."/>
7890
</module>
7991

8092
<!-- Checks for Headers -->
@@ -88,11 +100,11 @@
88100

89101
<!-- Checks for Javadoc comments. -->
90102
<!-- See https://checkstyle.org/config_javadoc.html -->
91-
<!-- <module name="InvalidJavadocPosition"/>-->
92-
<!-- <module name="JavadocMethod"/>-->
93-
<!-- <module name="JavadocType"/>-->
103+
<module name="InvalidJavadocPosition"/>
104+
<module name="JavadocMethod"/>
105+
<module name="JavadocType"/>
94106
<!-- <module name="JavadocVariable"/> -->
95-
<!-- <module name="JavadocStyle"/>-->
107+
<module name="JavadocStyle"/>
96108
<!-- <module name="MissingJavadocMethod"/> -->
97109

98110
<!-- Checks for Naming Conventions. -->
@@ -151,18 +163,18 @@
151163
<!-- See https://checkstyle.org/config_coding.html -->
152164
<module name="EmptyStatement"/>
153165
<module name="EqualsHashCode"/>
154-
<!-- <module name="HiddenField"/>-->
166+
<module name="HiddenField"/>
155167
<module name="IllegalInstantiation"/>
156168
<module name="InnerAssignment"/>
157-
<!-- <module name="MagicNumber"/>-->
169+
<module name="MagicNumber"/>
158170
<module name="MissingSwitchDefault"/>
159171
<module name="MultipleVariableDeclarations"/>
160172
<module name="SimplifyBooleanExpression"/>
161173
<module name="SimplifyBooleanReturn"/>
162174

163175
<!-- Checks for class design -->
164176
<!-- See https://checkstyle.org/config_design.html -->
165-
<!-- <module name="DesignForExtension"/>-->
177+
<module name="DesignForExtension"/>
166178
<module name="FinalClass"/>
167179
<!-- <module name="HideUtilityClassConstructor"/> -->
168180
<module name="InterfaceIsType"/>
@@ -172,9 +184,13 @@
172184
<!-- See https://checkstyle.org/config_misc.html -->
173185
<module name="ArrayTypeStyle"/>
174186
<!-- <module name="FinalParameters"/> -->
175-
<!-- <module name="TodoComment"/> -->
187+
<module name="TodoComment"/>
176188
<module name="UpperEll"/>
177189

190+
<module name="Indentation">
191+
<property name="basicOffset" value="4"/>
192+
</module>
193+
178194
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
179195
<module name="SuppressionXpathFilter">
180196
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
@@ -184,4 +200,4 @@
184200

185201
</module>
186202

187-
</module>
203+
</module>

lib/src/test/java/io/hexlet/utils/ArraysAsSetsTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@
66

77
public class ArraysAsSetsTest {
88

9-
private final String[] strColl1 = { "Vasya", "Kolya", "Petya" };
10-
private final String[] strColl2 = { "Igor", "Petya", "Sergey", "Vasya", "Sasha" };
11-
private final Integer[] intColl1 = { 13, 22, 14 };
12-
private final Integer[] intColl2 = { 12, 13, 45, 22, 99 };
9+
private final String[] strColl1 = {"Vasya", "Kolya", "Petya"};
10+
private final String[] strColl2 = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
11+
private final Integer[] intColl1 = {13, 22, 14};
12+
private final Integer[] intColl2 = {12, 13, 45, 22, 99};
1313

1414

1515
@Test
1616
void intersectionTest() {
17-
final String[] expected = { "Vasya", "Petya" };
17+
final String[] expected = {"Vasya", "Petya"};
1818
assertArrayEquals(ArraysAsSets.intersection(this.strColl1, this.strColl2), expected);
1919

20-
final Integer[] expected2 = { 13, 22 };
20+
final Integer[] expected2 = {13, 22};
2121
assertArrayEquals(ArraysAsSets.intersection(this.intColl1, this.intColl2), expected2);
2222
}
2323

2424
@Test
2525
void unionTest() {
26-
final String[] expected = { "Petya", "Sasha", "Igor", "Kolya", "Vasya", "Sergey" };
26+
final String[] expected = {"Petya", "Sasha", "Igor", "Kolya", "Vasya", "Sergey"};
2727
assertArrayEquals(ArraysAsSets.union(this.strColl1, this.strColl2), expected);
2828

29-
final Integer[] expected2 = { 99, 22, 12, 13, 45, 14 };
29+
final Integer[] expected2 = {99, 22, 12, 13, 45, 14};
3030
assertArrayEquals(ArraysAsSets.union(this.intColl1, this.intColl2), expected2);
3131
}
3232

3333
@Test
3434
void differenceTest() {
35-
final String[] expected = { "Kolya" };
35+
final String[] expected = {"Kolya"};
3636
assertArrayEquals(ArraysAsSets.difference(this.strColl1, this.strColl2), expected);
3737

38-
final Integer[] expected2 = { 14 };
38+
final Integer[] expected2 = {14};
3939
assertArrayEquals(ArraysAsSets.difference(this.intColl1, this.intColl2), expected2);
4040
}
4141
}

0 commit comments

Comments
 (0)