yegor256/takes

View on GitHub

Showing 72 of 117 total issues

Method unsalt has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @SuppressWarnings("PMD.CyclomaticComplexity")
    private static byte[] unsalt(final byte[] text) {
        if (text.length == 0) {
            throw new DecodingException("empty input");
        }
Severity: Minor
Found in src/main/java/org/takes/facets/auth/codecs/CcSalted.java - About 1 hr to fix

    Method token has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private String token(final String home, final String code)
            throws IOException {
            final String response = this.request
                .uri()
                .set(
    Severity: Minor
    Found in src/main/java/org/takes/facets/auth/social/PsFacebook.java - About 1 hr to fix

      Method copy has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void copy() throws IOException {
              int match = 0;
              boolean cont = true;
              while (cont) {
                  if (!this.buffer.hasRemaining()) {
      Severity: Minor
      Found in src/main/java/org/takes/rq/multipart/CopyBytesUntilBoundary.java - About 1 hr to fix

        Method start has a Cognitive Complexity of 11 (exceeds 5 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(
        Severity: Minor
        Found in src/main/java/org/takes/http/FtCli.java - About 1 hr 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 resolve has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                @Override
                public Source resolve(final String href, final String base)
                    throws TransformerException {
                    final URI uri;
                    if (base == null || base.isEmpty()) {
        Severity: Minor
        Found in src/main/java/org/takes/rs/RsXslt.java - About 1 hr 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 resolve has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                @Override
                public Source resolve(final String href, final String base)
                    throws TransformerException {
                    final URI uri;
                    if (base == null || base.isEmpty()) {
        Severity: Minor
        Found in src/main/java/org/takes/rs/RsXslt.java - About 1 hr to fix

          Method head has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public Iterable<String> head() {
                  final Collection<String> head = new LinkedList<>();
                  head.add(new HttpHead(this.sreq).toString());
                  final Collection<String> names = Collections.list(
          Severity: Minor
          Found in src/main/java/org/takes/servlet/RqFrom.java - About 1 hr to fix

            Method act has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                @SuppressWarnings("PMD.AvoidCatchingGenericException")
                public Response act(final Request req) throws IOException {
                    if (this.count <= 0) {
                        throw new IllegalArgumentException(
            Severity: Minor
            Found in src/main/java/org/takes/tk/TkRetry.java - About 1 hr to fix

              Method next has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static State next(final InputStream stream, final State state,
                      final ByteArrayOutputStream line) throws IOException {
                      final int next = stream.read();
                      if (next == -1) {
                          throw new IOException("chunked stream ended unexpectedly");
              Severity: Minor
              Found in src/main/java/org/takes/rq/ChunkedInputStream.java - About 1 hr to fix

                Method header has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        @Override
                        public List<String> header(final CharSequence key)
                            throws IOException {
                            final List<String> values = this.map().getOrDefault(
                                new UncheckedText(
                Severity: Minor
                Found in src/main/java/org/takes/rq/RqHeaders.java - About 1 hr to fix

                  Method header has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          @Override
                          public List<String> header(final CharSequence key)
                              throws IOException {
                              final List<String> values = this.map().getOrDefault(
                                  new UncheckedText(
                  Severity: Minor
                  Found in src/main/java/org/takes/rs/RsHeaders.java - About 1 hr to fix

                    Method chunkSize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static int chunkSize(final InputStream stream)
                            throws IOException {
                            final ByteArrayOutputStream baos = ChunkedInputStream.sizeLine(stream);
                            final String data = baos.toString(Charset.defaultCharset().name());
                            final int separator = data.indexOf(';');
                    Severity: Minor
                    Found in src/main/java/org/takes/rq/ChunkedInputStream.java - About 1 hr to fix

                      Method urn has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private Opt<String> urn(final String user, final String pwd) {
                                  final String urn;
                                  try {
                                      urn = this.usernames.get(
                                          String.format(
                      Severity: Minor
                      Found in src/main/java/org/takes/facets/auth/PsBasic.java - About 1 hr to fix

                        Method asMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
                            private static SortedMap<String, List<String>> asMap(final String query) {
                                final SortedMap<String, List<String>> params = new TreeMap<>();
                                if (query != null) {
                                    for (final String pair : query.split("&")) {
                        Severity: Minor
                        Found in src/main/java/org/takes/misc/Href.java - About 1 hr 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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
                            private static Request parse(final InputStream input) throws IOException {
                                boolean eof = true;
                                final Collection<String> head = new LinkedList<>();
                                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        Severity: Minor
                        Found in src/main/java/org/takes/rq/RqLive.java - About 1 hr 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 parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
                            private static Request parse(final InputStream input) throws IOException {
                                boolean eof = true;
                                final Collection<String> head = new LinkedList<>();
                                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        Severity: Minor
                        Found in src/main/java/org/takes/rq/RqLive.java - About 1 hr to fix

                          Method response has 27 lines of code (exceeds 25 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 1 hr to fix

                            Method prepareDocType has 27 lines of code (exceeds 25 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 1 hr to fix

                              Method printHead has 27 lines of code (exceeds 25 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 1 hr to fix

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

                                    @Override
                                    public Opt<Response> route(final Request req) throws IOException {
                                        final Iterator<String> headers =
                                            new RqHeaders.Base(req).header("Accept-Encoding").iterator();
                                        final Opt<Response> resp;
                                Severity: Minor
                                Found in src/main/java/org/takes/facets/fork/FkEncoding.java - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language