yegor256/takes

View on GitHub

Showing 72 of 117 total issues

Method enter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Opt<Identity> enter(final Request trequest)
        throws IOException {
        final Href href = new RqHref.Base(trequest).href();
        final Iterator<String> code = href.param(PsFacebook.CODE).iterator();
Severity: Minor
Found in src/main/java/org/takes/facets/auth/social/PsFacebook.java - About 1 hr to fix

    Method cookie has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            @Override
            public Iterable<String> cookie(final CharSequence key)
                throws IOException {
                final Map<String, String> map = this.map();
                final String value = map.getOrDefault(
    Severity: Minor
    Found in src/main/java/org/takes/facets/cookies/RqCookies.java - About 1 hr to fix

      Method equals has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          @SuppressFBWarnings("EQ_UNUSUAL")
          public boolean equals(final Object that) {
              return new Unchecked<>(
                  new Or(
      Severity: Minor
      Found in src/main/java/org/takes/rs/ResponseOf.java - About 1 hr to fix

        Method equals has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            @SuppressFBWarnings("EQ_UNUSUAL")
            public boolean equals(final Object that) {
                return new Unchecked<>(
                    new Or(
        Severity: Minor
        Found in src/main/java/org/takes/rq/RequestOf.java - About 1 hr to fix

          Method request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
              private com.jcabi.http.Request request(final Request req,
                  final URI dest) throws Exception {
                  final String method = new RqMethod.Base(req).method();
                  com.jcabi.http.Request proxied = new JdkRequest(dest).method(method);
          Severity: Minor
          Found in src/main/java/org/takes/tk/TkProxy.java - About 1 hr to fix

            Method freshMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private Map<String, List<String>> freshMap() throws IOException {
                    final String body = new RqPrint(this.req).printBody();
                    final Map<String, List<String>> map = new HashMap<>(1);
                    for (final String pair : body.split("&")) {
                        if (pair.isEmpty()) {
            Severity: Minor
            Found in src/main/java/org/takes/rq/form/RqFormBase.java - About 1 hr to fix

              Method request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
                  private com.jcabi.http.Request request(final Request req,
                      final URI dest) throws Exception {
                      final String method = new RqMethod.Base(req).method();
                      com.jcabi.http.Request proxied = new JdkRequest(dest).method(method);
              Severity: Minor
              Found in src/main/java/org/takes/tk/TkProxy.java - About 55 mins to fix

              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 a Cognitive Complexity of 8 (exceeds 5 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();
              Severity: Minor
              Found in src/main/java/org/takes/tk/TkSlf4j.java - About 45 mins to fix

              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 map has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      private Map<String, String> map() throws IOException {
                          final Map<String, String> map = new HashMap<>(0);
                          final Iterable<String> values =
                              new RqHeaders.Base(this).header("Cookie");
                          for (final String value : values) {
              Severity: Minor
              Found in src/main/java/org/takes/facets/cookies/RqCookies.java - About 45 mins to fix

              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 prepareDocType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static void prepareDocType(final InputStream body,
                      final Transformer transformer) throws IOException {
                      try {
                          final String html = "html";
                          final DocumentType doctype = RsPrettyXml.getDocType(body);
              Severity: Minor
              Found in src/main/java/org/takes/rs/RsPrettyXml.java - About 45 mins to fix

              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 read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public int read(final byte[] buf, final int off, final int len)
                      throws IOException {
                      if (!this.eof && this.pos >= this.size) {
                          this.nextChunk();
              Severity: Minor
              Found in src/main/java/org/takes/rq/ChunkedInputStream.java - About 45 mins to fix

              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 route has a Cognitive Complexity of 8 (exceeds 5 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 {
              Severity: Minor
              Found in src/main/java/org/takes/facets/fallback/TkFallback.java - About 45 mins to fix

              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 exec has a Cognitive Complexity of 8 (exceeds 5 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(
                          () -> {
              Severity: Minor
              Found in src/main/java/org/takes/http/FtRemote.java - About 45 mins to fix

              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 exec has a Cognitive Complexity of 7 (exceeds 5 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(
              Severity: Minor
              Found in src/main/java/org/takes/http/MainRemote.java - About 35 mins to fix

              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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  @SuppressWarnings("PMD.CyclomaticComplexity")
                  public void init() throws ServletException {
                      super.init();
                      final String cname = this.getServletConfig()
              Severity: Minor
              Found in src/main/java/org/takes/servlet/SrvTake.java - About 35 mins to fix

              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 enter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public Opt<Identity> enter(final Request req) throws Exception {
                      final Iterator<String> flg = new RqHref.Base(req).href()
                          .param(this.flag).iterator();
                      Opt<Identity> user = new Opt.Empty<>();
              Severity: Minor
              Found in src/main/java/org/takes/facets/auth/PsByFlag.java - About 35 mins to fix

              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 xor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private byte[] xor(final byte[] input) {
                      final byte[] output = new byte[input.length];
                      if (this.secret.length == 0) {
                          System.arraycopy(input, 0, output, 0, input.length);
                      } else {
              Severity: Minor
              Found in src/main/java/org/takes/facets/auth/codecs/CcXor.java - About 35 mins to fix

              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 printHead has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void printHead(final OutputStream output) throws IOException {
                      final String eol = "\r\n";
                      final Writer writer =
                          new OutputStreamWriter(output, StandardCharsets.UTF_8);
                      int pos = 0;
              Severity: Minor
              Found in src/main/java/org/takes/rs/RsPrint.java - About 35 mins to fix

              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 response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private Response response(final String home, final URI dest,
                      final com.jcabi.http.Response rsp) {
                      final Collection<String> hdrs = new LinkedList<>();
                      hdrs.add(
                          String.format(
              Severity: Minor
              Found in src/main/java/org/takes/tk/TkProxy.java - About 35 mins to fix

              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 freshMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private Map<String, List<String>> freshMap() throws IOException {
                      final String body = new RqPrint(this.req).printBody();
                      final Map<String, List<String>> map = new HashMap<>(1);
                      for (final String pair : body.split("&")) {
                          if (pair.isEmpty()) {
              Severity: Minor
              Found in src/main/java/org/takes/rq/form/RqFormBase.java - About 35 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language