yegor256/thindeck

View on GitHub

Showing 38 of 38 total issues

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

    @Override
    public Iterable<Directive> exec(final XML deck) throws IOException {
        final Collection<XML> containers = deck.nodes(
            "/deck/containers/container[@waste and @state='alive']"
        );
Severity: Minor
Found in src/main/java/com/thindeck/agents/TerminateDocker.java - About 1 hr to fix

    Method image has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static Iterable<Directive> image(final String... args)
            throws IOException {
            if (args.length == 0) {
                throw new RsForward(
                    new RsFlash(
    Severity: Minor
    Found in src/main/java/com/thindeck/cockpit/deck/TkCommand.java - About 1 hr to fix

      Function send_email has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function send_email(from, success, error) {
        $.ajax(
          {
            type: 'POST',
            url: 'https://mandrillapp.com/api/1.0/messages/send.json',
      Severity: Minor
      Found in website/email.js - About 1 hr to fix

        Method domain has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static Iterable<Directive> domain(final String... args)
                throws IOException {
                if (args.length == 0) {
                    throw new RsForward(
                        new RsFlash(
        Severity: Minor
        Found in src/main/java/com/thindeck/cockpit/deck/TkCommand.java - About 1 hr to fix

          Method exec has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public Iterable<Directive> exec(final XML deck) throws IOException {
                  final Directives dirs = new Directives();
                  final Collection<XML> containers = deck.nodes(
                      "/deck/containers/container[host and http]"
          Severity: Minor
          Found in src/main/java/com/thindeck/agents/CheckState.java - About 1 hr to fix

            Method container has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static Iterable<Directive> container(final String... args)
                    throws IOException {
                    if (args.length == 0) {
                        throw new RsForward(
                            new RsFlash(
            Severity: Minor
            Found in src/main/java/com/thindeck/cockpit/deck/TkCommand.java - About 1 hr to fix

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

                          try {
                              age = (int) ((today.getTime()
                                  - DateFormatUtils.ISO_DATETIME_FORMAT.parse(
                                      deck.xpath("/deck/repo/@added").get(0)
                                  ).getTime()) / TimeUnit.MINUTES.toMillis(1L));
              Severity: Major
              Found in src/main/java/com/thindeck/agents/WipeRepo.java and 2 other locations - About 50 mins to fix
              src/main/java/com/thindeck/agents/BuryContainers.java on lines 66..73
              src/main/java/com/thindeck/agents/TerminateDocker.java on lines 90..97

              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 60.

              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 3 locations. Consider refactoring.
              Open

                          try {
                              age = (int) ((today.getTime()
                                  - DateFormatUtils.ISO_DATETIME_FORMAT.parse(
                                      ctr.xpath("@checked").get(0)
                                  ).getTime()) / TimeUnit.MINUTES.toMillis(1L));
              Severity: Major
              Found in src/main/java/com/thindeck/agents/BuryContainers.java and 2 other locations - About 50 mins to fix
              src/main/java/com/thindeck/agents/TerminateDocker.java on lines 90..97
              src/main/java/com/thindeck/agents/WipeRepo.java on lines 65..72

              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 60.

              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 3 locations. Consider refactoring.
              Open

                          try {
                              age = (int) ((today.getTime()
                                  - DateFormatUtils.ISO_DATETIME_FORMAT.parse(
                                      ctr.xpath("@waste").get(0)
                                  ).getTime()) / TimeUnit.MINUTES.toMillis(1L));
              Severity: Major
              Found in src/main/java/com/thindeck/agents/TerminateDocker.java and 2 other locations - About 50 mins to fix
              src/main/java/com/thindeck/agents/BuryContainers.java on lines 66..73
              src/main/java/com/thindeck/agents/WipeRepo.java on lines 65..72

              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 60.

              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 3 locations. Consider refactoring.
              Open

                      final Iterator<Item> items = this.region.table(DyDeck.TBL)
                          .frame()
                          .through(new QueryValve().withLimit(1))
                          .where(DyDeck.HASH, this.user)
                          .where(DyDeck.RANGE, name)
              Severity: Minor
              Found in src/main/java/com/thindeck/dynamo/DyDecks.java and 2 other locations - About 35 mins to fix
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 81..87
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 136..141

              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 46.

              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 3 locations. Consider refactoring.
              Open

                      final Iterator<Item> items = this.region
                          .table(DyDeck.TBL)
                          .frame()
                          .through(new QueryValve().withLimit(1))
                          .where(DyDeck.HASH, this.user)
              Severity: Minor
              Found in src/main/java/com/thindeck/dynamo/DyDecks.java and 2 other locations - About 35 mins to fix
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 108..113
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 136..141

              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 46.

              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 3 locations. Consider refactoring.
              Open

                      final Iterator<Item> items = this.region.table(DyDeck.TBL)
                          .frame()
                          .through(new QueryValve().withLimit(1))
                          .where(DyDeck.HASH, this.user)
                          .where(DyDeck.RANGE, name)
              Severity: Minor
              Found in src/main/java/com/thindeck/dynamo/DyDecks.java and 2 other locations - About 35 mins to fix
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 81..87
              src/main/java/com/thindeck/dynamo/DyDecks.java on lines 108..113

              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 46.

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

                  @Override
                  public Iterable<Directive> exec(final XML deck) {
                      final boolean ready = !deck.nodes(
                          Joiner.on(" and ").join(
                              "/deck/containers[not(container/@waste)",
              Severity: Minor
              Found in src/main/java/com/thindeck/agents/Swap.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 repo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static Iterable<Directive> repo(final XML deck,
                      final String... args) throws IOException {
                      if (args.length == 0) {
                          throw new RsForward(
                              new RsFlash(
              Severity: Minor
              Found in src/main/java/com/thindeck/cockpit/deck/TkCommand.java - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
                  public void run() {
                      final AtomicInteger grp = new AtomicInteger();
                      final ExecutorService exec = Executors.newCachedThreadPool(
              Severity: Minor
              Found in src/main/java/com/thindeck/Routine.java - About 25 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 redirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static Take redirect(final String deck, final Take take) {
                      return new Take() {
                          @Override
                          public Response act(final Request req) throws IOException {
                              try {
              Severity: Minor
              Found in src/main/java/com/thindeck/cockpit/deck/FkDeck.java - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public Iterable<Directive> exec(final XML deck) throws IOException {
                      final Collection<XML> images = deck.nodes(
                          "/deck/images/image[repo=/deck/repo/name]"
                      );
              Severity: Minor
              Found in src/main/java/com/thindeck/agents/WipeRepo.java - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  @SuppressWarnings("PMD.AvoidCatchingThrowable")
                  private void exec(final Deck deck) throws IOException {
                      final Collection<String> failure = new LinkedList<>();
                      for (final Agent agent : this.agents) {
                          try {
              Severity: Minor
              Found in src/main/java/com/thindeck/Routine.java - About 25 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