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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* This implementation make significant use of the command pattern to support a
* delegation chain of commands based on implementations of {@link ICommand}.
*/
@SuppressWarnings("PMD.CouplingBetweenObjects")
public class CLIProcessor {
private static final Logger LOGGER = LogManager.getLogger(CLIProcessor.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ public ExitStatus processCommand() {
* the command line information
* @return the result of executing the command
*/
@SuppressWarnings({
"PMD.OnlyOneReturn", // readability
"PMD.AvoidCatchingGenericException" // needed here
})
@NonNull
private ExitStatus invokeCommand(@NonNull CommandLine cmdLine) {
ExitStatus retval;
Expand Down Expand Up @@ -648,7 +644,7 @@ public void showHelp() {
// This avoids native terminal detection which triggers Java 21+ warnings
int terminalWidth = getTerminalWidth();

try (PrintWriter writer = new PrintWriter( // NOPMD not owned
try (PrintWriter writer = new PrintWriter(
AutoCloser.preventClose(out),
true,
StandardCharsets.UTF_8)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ private static void writeToFile(@NonNull String outputFile, @NonNull String scri
}
}

@SuppressWarnings("PMD.SystemPrintln")
private static void writeToStdout(@NonNull String script) {
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(System.out, StandardCharsets.UTF_8), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public AmbiguousDate parse(String value) {
= String.format("%sT00:00:00%s", matcher.group(1), matcher.group(2) == null ? "" : matcher.group(2));
try {
TemporalAccessor accessor = DateFormats.DATE_TIME_WITH_TZ.parse(parseValue);
return new AmbiguousDate(ObjectUtils.notNull(ZonedDateTime.from(accessor)), true); // NOPMD - readability
return new AmbiguousDate(ObjectUtils.notNull(ZonedDateTime.from(accessor)), true);
} catch (DateTimeParseException ex) {
try {
TemporalAccessor accessor = DateFormats.DATE_TIME_WITH_OPTIONAL_TZ.parse(parseValue);
Expand All @@ -81,7 +81,7 @@ public AmbiguousDate parse(String value) {
} catch (DateTimeParseException ex2) {
IllegalArgumentException newEx = new IllegalArgumentException(ex2.getLocalizedMessage(), ex2);
newEx.addSuppressed(ex);
throw newEx; // NOPMD - false positive
throw newEx;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private XmlMarkupParser() {
*/
public MarkupLine parseMarkupline(
@NonNull XMLEventReader2 reader,
@NonNull URI resource) throws XMLStreamException { // NOPMD - acceptable
@NonNull URI resource) throws XMLStreamException {
StringBuilder buffer = new StringBuilder();
parseContents(reader, resource, null, buffer);
String html = buffer.toString().trim();
Expand Down Expand Up @@ -134,8 +134,7 @@ public MarkupMultiline parseMarkupMultiline(
private void parseToString(
@NonNull XMLEventReader2 reader,
@NonNull URI resource,
@NonNull StringBuilder buffer) // NOPMD - acceptable
throws XMLStreamException {
@NonNull StringBuilder buffer) throws XMLStreamException {
// if (LOGGER.isDebugEnabled()) {
// LOGGER.debug("parseToString(enter): {}",
// XmlEventUtil.toString(reader.peek()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public boolean parse(LightInlineParser inlineParser) {
assert type != null;
assert idReference != null;
inlineParser.appendNode(new InsertAnchorNode(type, idReference));
return true; // NOPMD - readability
return true;
}
}
return false;
Expand Down Expand Up @@ -256,7 +256,7 @@ public Set<HtmlNodeRendererHandler<?>> getHtmlNodeRendererHandlers() {
: Collections.emptySet();
}

private void processInsert( // NOPMD used as lambda
private void processInsert(
Element node,
@SuppressWarnings("unused") HtmlNodeConverterContext context,
HtmlMarkdownWriter out) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,7 @@ protected abstract void writeElementStart(
*/
protected abstract void writeElementEnd(@NonNull QName qname) throws E;

@SuppressWarnings({
"unchecked",
"PMD.UnusedPrivateMethod"
}) // while unused, keeping code for when inline HTML is supported
@SuppressWarnings("unchecked") // while unused, keeping code for when inline HTML is supported
private void writeHtml(Node node) throws E {
Document doc = Jsoup.parse(node.getChars().toString());
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
@SuppressFBWarnings(value = "THROWS_METHOD_THROWS_CLAUSE_THROWABLE",
justification = "There is a need to support varying exceptions from multiple stream writers")
public interface IMarkupWriter<T, E extends Throwable> { // NOPMD
public interface IMarkupWriter<T, E extends Throwable> {
/**
* Write an HTML element with the provided local name, with no attributes.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected void visit(@NonNull Node node, @NonNull IMarkupWriter<T, E> writer) th
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.CognitiveComplexity", "PMD.NcssCount" })
protected boolean processInlineElements(
@NonNull Node node,
@NonNull IMarkupWriter<T, E> writer) throws E { // NOPMD - acceptable
@NonNull IMarkupWriter<T, E> writer) throws E {
boolean retval = true;
if (node instanceof Text) {
writer.writeText((Text) node);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* The implementation of a Metapath
* <a href="https://www.w3.org/TR/xpath-31/#eval_context">dynamic context</a>.
*/
public class DynamicContext { // NOPMD - intentional data class
public class DynamicContext {

@NonNull
private final Map<Integer, ISequence<?>> letVariableMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public abstract class AbstractCSTVisitorBase
* if the expanded QName prefix is not bound or if the resulting
* namespace is invalid
*/
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.CognitiveComplexity" })
@NonNull
static QName toQName(@NonNull Metapath10.EqnameContext eqname, @NonNull StaticContext context,
boolean requireNamespace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* expressions representing the left and right sides of the comparison, and a
* comparison operator.
*/
public abstract class AbstractComparison // NOPMD - unavoidable
public abstract class AbstractComparison
extends AbstractBinaryExpression<IExpression, IExpression>
implements IBooleanLogicExpression {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* first expression evaluates to {@code false}, otherwise it will return
* {@code true}.
*/
public class And // NOPMD - intentional name
public class And
extends AbstractNAryExpression
implements IBooleanLogicExpression {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public ISequenceType getSequenceType() {
return sequenceType;
}

@SuppressWarnings("null")
@Override
public String toSignature() {
StringBuilder builder = new StringBuilder();
Expand All @@ -54,10 +53,10 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true; // NOPMD - readability
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false; // NOPMD - readability
return false;
}
ArgumentImpl other = (ArgumentImpl) obj;
return Objects.equals(name, other.name) && Objects.equals(sequenceType, other.sequenceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected static ISequence<?> convertSequence(
if (IAnyAtomicItem.class.isAssignableFrom(requiredSequenceTypeClass)) {
Stream<? extends IAnyAtomicItem> atomicStream = stream.flatMap(IItem::atomize);

// if (IUntypedAtomicItem.class.isInstance(item)) { // NOPMD
// if (IUntypedAtomicItem.class.isInstance(item)) {
// // TODO: apply cast to atomic type
// }

Expand Down Expand Up @@ -303,10 +303,10 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true; // NOPMD - readability
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false; // NOPMD - readability
return false;
}
AbstractFunction other = (AbstractFunction) obj;
return Objects.equals(getQName(), other.getQName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ISequence<ITEM> execute(@NonNull IFunction function,

IAnyAtomicItem item = arg.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

ITEM castItem = castExecutor.cast(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static ISequence<INumericItem> execute(

INumericItem item = sequence.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

return ISequence.of(item.castAsType(item.abs()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static ISequence<IAnyAtomicItem> execute(
@Nullable
public static IAnyAtomicItem average(@NonNull Collection<? extends IAnyAtomicItem> items) {
if (items.isEmpty()) {
return null; // NOPMD - readability
return null;
}

// tell cpd to start ignoring code - CPD-OFF
Expand Down Expand Up @@ -150,7 +150,7 @@ public static IAnyAtomicItem average(@NonNull Collection<? extends IAnyAtomicIte
return retval;
}

@SuppressWarnings("PMD.UnnecessaryCast")
@SuppressWarnings("unchecked")
@NonNull
private static <T, R extends T> R average(
@NonNull Collection<? extends T> items,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private static ISequence<IAnyUriItem> executeOneArg(@NonNull IFunction function,
public static IAnyUriItem fnBaseUri(INodeItem nodeItem) {
IAnyUriItem retval;
if (nodeItem == null) {
retval = null; // NOPMD - intentional
retval = null;
} else {
URI baseUri = nodeItem.getBaseUri();
retval = baseUri == null ? null : IAnyUriItem.valueOf(baseUri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static ISequence<INumericItem> execute(

INumericItem item = sequence.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

return ISequence.of(item.castAsType(item.ceiling()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static ISequence<IAnyUriItem> executeOneArg(
ISequence<? extends IStringItem> relativeSequence
= FunctionUtils.asType(ObjectUtils.requireNonNull(arguments.get(0)));
if (relativeSequence.isEmpty()) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

IStringItem relativeString = relativeSequence.getFirstItem(true);
Expand All @@ -110,21 +110,20 @@ private static ISequence<IAnyUriItem> executeOneArg(
* @return a sequence containing the resolved URI or and empty sequence if
* either the base or relative URI is {@code null}
*/
@SuppressWarnings("PMD.UnusedPrivateMethod") // used in lambda
@NonNull
private static ISequence<IAnyUriItem> executeTwoArg(
@NonNull IFunction function, // NOPMD - ok
@NonNull IFunction function,
@NonNull List<ISequence<?>> arguments,
@NonNull DynamicContext dynamicContext, // NOPMD - ok
IItem focus) { // NOPMD - ok
@NonNull DynamicContext dynamicContext,
IItem focus) {

/* there will always be two arguments */
assert arguments.size() == 2;

ISequence<? extends IStringItem> relativeSequence = FunctionUtils.asType(
ObjectUtils.requireNonNull(arguments.get(0)));
if (relativeSequence.isEmpty()) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

ISequence<? extends IStringItem> baseSequence = FunctionUtils.asType(ObjectUtils.requireNonNull(arguments.get(1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static ISequence<INumericItem> executeOneArg(

INumericItem item = sequence.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

return ISequence.of(item.round());
Expand All @@ -100,7 +100,7 @@ private static ISequence<INumericItem> executeTwoArg(

INumericItem item = sequence.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

IIntegerItem precision = FunctionUtils.asType(ObjectUtils.requireNonNull(arguments.get(1).getFirstItem(true)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public final class FnTokenize {
.build();
// CPD-ON

@SuppressWarnings({ "PMD.UnusedFormalParameter", "unused" })
@SuppressWarnings("unused")
@NonNull
private static ISequence<IStringItem> executeOneArg(
@NonNull IFunction function,
Expand All @@ -118,7 +118,7 @@ private static ISequence<IStringItem> executeOneArg(
.map(IStringItem::valueOf)));
}

@SuppressWarnings({ "PMD.UnusedFormalParameter", "unused" })
@SuppressWarnings("unused")
@NonNull
private static ISequence<IStringItem> executeTwoArg(
@NonNull IFunction function,
Expand All @@ -131,7 +131,7 @@ private static ISequence<IStringItem> executeTwoArg(
return execute(input, pattern, IStringItem.valueOf(""));
}

@SuppressWarnings({ "PMD.UnusedFormalParameter", "unused" })
@SuppressWarnings("unused")
@NonNull
private static ISequence<IStringItem> executeThreeArg(
@NonNull IFunction function,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public ISequence<INumericItem> execute(@NonNull IFunction function,
ISequence<? extends INumericItem> sequence = FunctionUtils.asType(
ObjectUtils.requireNonNull(arguments.get(0)));
if (sequence.isEmpty()) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

INumericItem item = sequence.getFirstItem(true);
if (item == null) {
return ISequence.empty(); // NOPMD - readability
return ISequence.empty();
}

INumericItem result = executor.execute(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
/**
* Supports compiling and executing Metapath expressions.
*/
@SuppressWarnings({
"PMD.CouplingBetweenObjects" // necessary since this class aggregates functionality
})
public class MetapathExpression
extends AbstractMetapathExpression {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static <T extends R, R extends IItem> ISequence<R> map(
* {@link ISequence}
*/
@NonNull
static <ITEM_TYPE extends IItem> ISequence<ITEM_TYPE> ofCollection( // NOPMD - intentional
static <ITEM_TYPE extends IItem> ISequence<ITEM_TYPE> ofCollection(
@NonNull Collection<ITEM_TYPE> items) {
ISequence<ITEM_TYPE> retval;
if (items instanceof ISequence) {
Expand All @@ -286,7 +286,7 @@ static <ITEM_TYPE extends IItem> ISequence<ITEM_TYPE> ofCollection( // NOPMD - i
* @return the new sequence
*/
@NonNull
static <T extends IItem> ISequence<T> of( // NOPMD - intentional
static <T extends IItem> ISequence<T> of(
@Nullable T item) {
return item == null ? empty() : new SingletonSequence<>(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ default IAtomicOrUnionType<IMarkupLineItem> getType() {
* a line of markup
* @return the new item
*/
@SuppressWarnings("PMD.AvoidCatchingGenericException")
@NonNull
static IMarkupLineItem valueOf(@NonNull String value) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ default IAtomicOrUnionType<IMarkupMultilineItem> getType() {
* a line of markup
* @return the new item
*/
@SuppressWarnings("PMD.AvoidCatchingGenericException")
@NonNull
static IMarkupMultilineItem valueOf(@NonNull String value) {
try {
Expand Down
Loading
Loading