Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions app/config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--

Expand Down Expand Up @@ -72,8 +72,8 @@
<!-- See https://checkstyle.org/config_sizes.html -->
<module name="FileLength"/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="120"/>
<property name="fileExtensions" value="java"/>
<property name="max" value="120"/>
</module>

<!-- Checks for whitespace -->
Expand All @@ -83,10 +83,10 @@
<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Checks for Headers -->
Expand Down Expand Up @@ -164,24 +164,24 @@
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField" >
<property name="ignoreSetter" value="true" />
<property name="ignoreConstructorParameter" value="true" />
</module>
<property name="ignoreSetter" value="true" />
<property name="ignoreConstructorParameter" value="true" />
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!-- <module name="MagicNumber"/> -->
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See https://checkstyle.org/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<!-- <module name="HideUtilityClassConstructor"/> -->
<module name="InterfaceIsType"/>
<!-- <module name="VisibilityModifier"/> -->
<module name="VisibilityModifier"/>

<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
Expand All @@ -191,7 +191,7 @@
<module name="UpperEll"/>

<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="basicOffset" value="4"/>
</module>

<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
Expand All @@ -201,8 +201,6 @@
<property name="optional" value="true"/>
</module>

<module name="SuppressionCommentFilter">
<property name="checkFormat" value="MethodLength"/>
</module>
</module>

</module>
2 changes: 1 addition & 1 deletion app/src/main/java/hexlet/code/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@Command(name = "gendiff", mixinStandardHelpOptions = true, version = "gendiff 0.9",
description = "Compares two configuration files and shows a difference.")
public class App implements Callable<Integer> {
public final class App implements Callable<Integer> {

@Option(names = {"-f", "--format"}, paramLabel = "format", defaultValue = "stylish",
description = "output format [default: stylish]")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/hexlet/code/source/Differ.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static String generate(String filePath1, String filePath2, String format)
stage = dataSecond.containsKey(key) ? ADDED : DELETED;
}

List<Object> date = new ArrayList<>(3);
List<Object> date = new ArrayList<>();
date.add(stage);
date.add(dataFirstValue);
date.add(dataSecondValue);
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/hexlet/code/source/formatters/Plain.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public static String plain(Map<String, List<Object>> differenceMap) {
StringBuilder result = new StringBuilder();
differenceMap.forEach((key, value) -> {
String addString = "Property '" + key + "' was ";
if (value.size() != 3) {
throw new IllegalArgumentException("Неподходящие данные");
}

var currentState = value.getFirst();

Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/hexlet/code/source/formatters/Stylish.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ public static String stylish(Map<String, List<Object>> differenceMap) {
differenceMap.forEach((key, value) -> {
String addedString = "";

if (value.size() != 3) {
throw new IllegalArgumentException("Неподходящие данные");
}

if (value.getFirst().equals(Differ.DELETED) || value.getFirst().equals(Differ.CHANGED)) {
addedString += "- " + key + ": " + value.get(1) + "\n";
}
Expand Down
Loading