Skip to content

Commit

Permalink
feat(#180): fix all qulice suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jun 20, 2023
1 parent 755436a commit 1584aa8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
/*
* MIT License
*
* Copyright (c) 2022-2023 Volodya
*
* 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 NONINFRINGEMENT. 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.
*/
package com.github.lombrozo.testnames.complaints;

import com.github.lombrozo.testnames.Complaint;
Expand All @@ -9,12 +32,12 @@
*
* @since 0.1.15
*/
public class LinkedComplaint implements Complaint {
public final class LinkedComplaint implements Complaint {

/**
* The complaint message.
*/
private final String message;
private final String complaint;

/**
* The suggestion how to solve the problem.
Expand All @@ -33,34 +56,36 @@ public class LinkedComplaint implements Complaint {

/**
* Constructor.
* @param message The complaint message.
* @param complaint The complaint message.
* @param suggestion The suggestion how to solve the problem
* @param rule The rule name
* @param document The document name to the rule description in the default repo.
* @checkstyle ParameterNumberCheck (10 lines)
*/
public LinkedComplaint(
final String message,
final String complaint,
final String suggestion,
final Class<?> rule,
final String document
) {
this(message, suggestion, rule.getSimpleName(), LinkedComplaint.link(document));
this(complaint, suggestion, rule.getSimpleName(), LinkedComplaint.url(document));
}

/**
* Constructor.
* @param message The complaint message.
* @param complaint The complaint message.
* @param suggestion The suggestion how to solve the problem
* @param rule The rule name
* @param link The link to the rule description
* @checkstyle ParameterNumberCheck (10 lines)
*/
private LinkedComplaint(
final String message,
final String complaint,
final String suggestion,
final String rule,
final URL link
) {
this.message = message;
this.complaint = complaint;
this.suggestion = suggestion;
this.rule = rule;
this.link = link;
Expand All @@ -71,7 +96,7 @@ public String message() {
return new Complaint.Text(
String.format(
"%s.%n\t%s.%n\tYou can also ignore the rule by adding @SuppressWarnings(\"JTCOP.%s\") annotation.%n\tRule: %s.%n\tYou can read more about the rule here: %s",
this.message,
this.complaint,
this.suggestion,
this.rule,
this.rule,
Expand All @@ -81,11 +106,11 @@ public String message() {
}

/**
* Parses URL from String
* Parses URL from String.
* @param document String representation of the doc markdown file in the repo.
* @return URL link
*/
private static URL link(final String document) {
private static URL url(final String document) {
try {
return new URL(
String.format(
Expand All @@ -95,7 +120,8 @@ private static URL link(final String document) {
);
} catch (final MalformedURLException ex) {
throw new IllegalStateException(
String.format("We have problems with parsing rule documentation link %s",
String.format(
"We have problems with parsing rule documentation link %s",
document
),
ex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public Collection<Complaint> complaints() {
this.getClass(),
"test-word.md"
)

).complaints();
}

Expand Down

3 comments on commit 1584aa8

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 1584aa8 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 180-d1da7234 discovered in docs/rules/not-spam.md) and submitted as #182. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 1584aa8 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 180-c527e625 discovered in docs/rules/test-word.md) and submitted as #183. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 1584aa8 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 180-c5c6cd5e discovered in docs/rules/not-special-characters.md) and submitted as #184. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.