Skip to content

Commit

Permalink
413 Checkstyle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zsandoz committed Aug 17, 2022
1 parent 8b2e8c2 commit c4dace3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/main/java/com/amihaiemil/eoyaml/ReadYamlSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ final class ReadYamlSequence extends BaseYamlSequence {
this.guessIndentation = guessIndentation;
}

/**
* Retrieve the values of this sequence.
* @checkstyle CyclomaticComplexity (200 lines)
*/
@Override
public Collection<YamlNode> values() {
final List<YamlNode> kids = new LinkedList<>();
Expand Down Expand Up @@ -166,13 +170,16 @@ public Collection<YamlNode> values() {
)));
} else {
if(this.mappingStartsAtDash(line)) {
final YamlLine previous = line.number() == 0
? new YamlLine.NullYamlLine()
: this.all.line(line.number() - 1);
YamlLine dashMapPrevious;
if (line.number() == 0) {
dashMapPrevious = new YamlLine.NullYamlLine();
} else {
dashMapPrevious = this.all.line(line.number() - 1);
}
kids.add(
new ReadYamlMapping(
line.number() + 1,
previous,
dashMapPrevious,
this.all,
this.guessIndentation
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/amihaiemil/eoyaml/SameIndentationLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public Iterator<YamlLine> iterator() {
final YamlLine first = iterator.next();
sameIndentation.add(first);
int firstIndentation = first.indentation();
boolean firstIsMappingStartsWithDash =
boolean firstIsDashMap =
this.mappingStartsAtDash(first);
while (iterator.hasNext()) {
YamlLine current = iterator.next();
if (firstIsMappingStartsWithDash
if (firstIsDashMap
&& this.mapping(current)
&& current.indentation() == firstIndentation + 2) {
sameIndentation.add(current);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public void returnsYamlMappingWithScalarValuesStartingAtDash(){

/**
* ReadYamlSequence can return the YamlMapping which starts right at the
* dash line and has only one entry
* dash line and has only one entry.
* @checkstyle ExecutableStatementCount (100 lines)
*/
@Test
public void returnsShortYamlMappingWithScalarValuesStartingAtDash(){
Expand Down

0 comments on commit c4dace3

Please sign in to comment.