Showing 72 of 117 total issues
HttpServletRequestFake
has 72 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings({
"PMD.TooManyMethods",
"PMD.ExcessiveImports",
"PMD.ExcessivePublicCount"
})
File HttpServletRequestFake.java
has 431 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2024 Yegor Bugayenko
*
HttpServletResponseFake
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.TooManyMethods")
public final class HttpServletResponseFake implements HttpServletResponse {
/**
* A Takes response.
*/
Method wrap
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.AvoidCatchingGenericException")
private static Response wrap(final Response res, final Fallback fbk,
final Request req) {
return new ResponseOf(
() -> {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
VerboseList
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.TooManyMethods")
public final class VerboseList<T> implements List<T> {
/**
* Original list.
Method copy
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public void copy() throws IOException {
int match = 0;
boolean cont = true;
while (cont) {
if (!this.buffer.hasRemaining()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method act
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public Response act(final Request req) throws Exception {
final Scalar<Long> time = System::currentTimeMillis;
final long start = time.value();
Method init
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@SuppressWarnings("PMD.CyclomaticComplexity")
public void init() throws ServletException {
super.init();
final String cname = this.getServletConfig()
Method exec
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void exec(final FtRemote.Script script) throws Exception {
final AtomicBoolean exit = new AtomicBoolean();
final CountDownLatch latch = new CountDownLatch(1);
final Thread thread = new Thread(
() -> {
Method toString
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String toString() {
final StringBuilder text = new StringBuilder(this.bare());
if (!this.params.isEmpty()) {
boolean first = true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method wrap
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.AvoidCatchingGenericException")
private static Response wrap(final Response res, final Fallback fbk,
final Request req) {
return new ResponseOf(
() -> {
Method exec
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void exec(final MainRemote.Script script) throws Exception {
final File file = File.createTempFile("takes-", ".txt");
if (!file.delete()) {
throw new IOException(
String.format(
Method enter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Opt<Identity> enter(final Request req) throws IOException {
// @checkstyle ExecutableStatementCount (100 lines)
Opt<Identity> user = new Opt.Empty<>();
final UncheckedText head = new Unchecked<>(
Method requests
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Map<String, List<Request>> requests(
final Request req) throws IOException {
final String header = new RqHeaders.Smart(req).single("Content-Type");
final Unchecked<Boolean> multipart = new Unchecked<>(
new StartsWith(
Method make
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static Map<Integer, String> make() {
final Map<Integer, String> map = new HashMap<>(0);
map.put(HttpURLConnection.HTTP_OK, "OK");
map.put(HttpURLConnection.HTTP_CREATED, "Created");
map.put(HttpURLConnection.HTTP_ACCEPTED, "Accepted");
Method route
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static Response route(final Take take, final Fallback fbk,
final Request req) throws Exception {
final long start = System.currentTimeMillis();
Response res;
try {
Method enter
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Opt<Identity> enter(final Request request) throws IOException {
final Iterator<String> headers = new RqHeaders.Smart(request)
.header("authorization").iterator();
if (!headers.hasNext()) {
Method start
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void start(final Exit exit) throws IOException {
final Take tks;
if (this.options.hitRefresh()) {
tks = request -> this.take.act(
Method map
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private Map<String, List<String>> map() throws IOException {
final Iterator<String> head = this.head().iterator();
if (!head.hasNext()) {
throw new HttpException(
Method map
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private Map<String, List<String>> map() throws IOException {
final Iterator<String> head = this.head().iterator();
if (!head.hasNext()) {
throw new HttpException(