Skip to content

Commit

Permalink
feat(#3742): fix all the code offences
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Dec 24, 2024
1 parent 179d1ef commit b26f3d5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
8 changes: 4 additions & 4 deletions eo-parser/src/main/java/org/eolang/parser/errors/Lines.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ final class Lines {
/**
* The source.
*/
private final List<Text> lines;
private final List<Text> source;

/**
* Ctor.
* @param lines The source in lines
*/
Lines(final List<Text> lines) {
this.lines = lines;
this.source = lines;
}

/**
Expand All @@ -54,10 +54,10 @@ final class Lines {
*/
String line(final int number) {
final Optional<String> result;
if (number < 1 || number > this.lines.size()) {
if (number < 1 || number > this.source.size()) {
result = Optional.empty();
} else {
result = Optional.ofNullable(this.lines.get(number - 1))
result = Optional.ofNullable(this.source.get(number - 1))
.map(UncheckedText::new)
.map(UncheckedText::asString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* </p>
* @since 0.50
* @todo #3332:30min Add more decorators for the error message.
* For example, {@link org.eolang.parser.ParsingErrors} currently contains logic related to the message formatting.
* For example, {@link ParsingErrors} currently contains logic related to the message formatting.
* It's better to create a separate class for this purpose.
*/
final class UnderlinedMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
* This package contains all the classes related to errors that can be found in the parsing process.
* @since 0.50
*/
package org.eolang.parser.errors;
package org.eolang.parser.errors;
28 changes: 28 additions & 0 deletions eo-parser/src/test/java/org/eolang/parser/errors/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2024 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Contains tests for the error handling in the parser.
* @since 0.50
*/
package org.eolang.parser.errors;

0 comments on commit b26f3d5

Please sign in to comment.