yegor256/takes

View on GitHub

Showing 117 of 117 total issues

HttpServletRequestFake has 69 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings({
    "PMD.TooManyMethods",
    "PMD.ExcessiveImports",
    "PMD.ExcessivePublicCount"
})
Severity: Major
Found in src/main/java/org/takes/servlet/HttpServletRequestFake.java - About 1 day to fix

    File HttpServletRequestFake.java has 418 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * The MIT License (MIT)
     *
     * Copyright (c) 2014-2024 Yegor Bugayenko
     *
    Severity: Minor
    Found in src/main/java/org/takes/servlet/HttpServletRequestFake.java - About 6 hrs to fix

      HttpServletResponseFake has 37 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @SuppressWarnings("PMD.TooManyMethods")
      public final class HttpServletResponseFake implements HttpServletResponse {
          /**
           * A Takes response.
           */
      Severity: Minor
      Found in src/main/java/org/takes/servlet/HttpServletResponseFake.java - About 4 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @EqualsAndHashCode
            final class Smart implements RqHeaders {
                /**
                 * Original.
                 */
        Severity: Major
        Found in src/main/java/org/takes/rq/RqHeaders.java and 1 other location - About 3 hrs to fix
        src/main/java/org/takes/rs/RsHeaders.java on lines 184..268

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 198.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @EqualsAndHashCode
            final class Smart implements RsHeaders {
                /**
                 * Original.
                 */
        Severity: Major
        Found in src/main/java/org/takes/rs/RsHeaders.java and 1 other location - About 3 hrs to fix
        src/main/java/org/takes/rq/RqHeaders.java on lines 184..268

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 198.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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(
                    () -> {
        Severity: Minor
        Found in src/main/java/org/takes/facets/fallback/TkFallback.java - About 2 hrs 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

        VerboseList has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @SuppressWarnings("PMD.TooManyMethods")
        public final class VerboseList<T> implements List<T> {
        
            /**
             * Original list.
        Severity: Minor
        Found in src/main/java/org/takes/misc/VerboseList.java - About 2 hrs to fix

          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()) {
          Severity: Minor
          Found in src/main/java/org/takes/rq/multipart/CopyBytesUntilBoundary.java - About 2 hrs 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 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();
          Severity: Major
          Found in src/main/java/org/takes/tk/TkSlf4j.java - About 2 hrs to fix

            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(
                        () -> {
            Severity: Major
            Found in src/main/java/org/takes/http/FtRemote.java - About 2 hrs to fix

              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()
              Severity: Major
              Found in src/main/java/org/takes/servlet/SrvTake.java - About 2 hrs to fix

                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;
                Severity: Minor
                Found in src/main/java/org/takes/misc/Href.java - About 2 hrs 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 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(
                            () -> {
                Severity: Major
                Found in src/main/java/org/takes/facets/fallback/TkFallback.java - About 2 hrs to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              () -> {
                                  final long start = System.currentTimeMillis();
                                  Iterable<String> head;
                                  try {
                                      head = res.head();
                  Severity: Major
                  Found in src/main/java/org/takes/facets/fallback/TkFallback.java and 1 other location - About 2 hrs to fix
                  src/main/java/org/takes/facets/fallback/TkFallback.java on lines 181..207

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 142.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              () -> {
                                  final long start = System.currentTimeMillis();
                                  InputStream body;
                                  try {
                                      body = res.body();
                  Severity: Major
                  Found in src/main/java/org/takes/facets/fallback/TkFallback.java and 1 other location - About 2 hrs to fix
                  src/main/java/org/takes/facets/fallback/TkFallback.java on lines 154..180

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 142.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              while (head.hasNext()) {
                                  final String line = head.next();
                                  final String[] parts = line.split(":", 2);
                                  if (parts.length < 2) {
                                      throw new HttpException(
                  Severity: Major
                  Found in src/main/java/org/takes/rq/RqHeaders.java and 1 other location - About 2 hrs to fix
                  src/main/java/org/takes/rs/RsHeaders.java on lines 148..172

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 138.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              while (head.hasNext()) {
                                  final String line = head.next();
                                  final String[] parts = line.split(":", 2);
                                  if (parts.length < 2) {
                                      throw new HttpException(
                  Severity: Major
                  Found in src/main/java/org/takes/rs/RsHeaders.java and 1 other location - About 2 hrs to fix
                  src/main/java/org/takes/rq/RqHeaders.java on lines 148..172

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 138.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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(
                  Severity: Major
                  Found in src/main/java/org/takes/http/MainRemote.java - About 2 hrs to fix

                    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<>(
                    Severity: Minor
                    Found in src/main/java/org/takes/facets/auth/PsToken.java - About 2 hrs to fix

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          @Override
                          @SuppressFBWarnings("EQ_UNUSUAL")
                          public boolean equals(final Object that) {
                              return new Unchecked<>(
                                  new Or(
                      Severity: Major
                      Found in src/main/java/org/takes/rq/RequestOf.java and 1 other location - About 2 hrs to fix
                      src/main/java/org/takes/rs/ResponseOf.java on lines 89..118

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 128.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language