yegor256/thindeck

View on GitHub

Showing 38 of 38 total issues

Method run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    public void run() {
        final AtomicInteger grp = new AtomicInteger();
        final ExecutorService exec = Executors.newCachedThreadPool(
Severity: Major
Found in src/main/java/com/thindeck/Routine.java - About 2 hrs to fix

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

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

          @Override
          public Response act(final Request req) throws IOException {
              final Deck deck = new RqDeck(this.base, req).deck();
              final Href home = new Href("/d").path(deck.name());
              final PrettyTime pretty = new PrettyTime();
      Severity: Minor
      Found in src/main/java/com/thindeck/cockpit/deck/TkIndex.java - About 1 hr to fix

        Method regex has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static Take regex(final Base base) throws IOException {
                return new TkFork(
                    new FkParams(
                        PsByFlag.class.getSimpleName(),
                        Pattern.compile(".+"),
        Severity: Minor
        Found in src/main/java/com/thindeck/cockpit/TkApp.java - About 1 hr to fix

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

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

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

          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

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

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

          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 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void exec(final Iterable<Deck> decks) throws IOException {
                  final Iterable<String> confs = Iterables.concat(
                      Iterables.transform(
                          decks,
          Severity: Minor
          Found in src/main/java/com/thindeck/bosses/CleanNginx.java - About 1 hr to fix

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

                    @Override
                    public String exec(final String host, final Map<String, String> args)
                        throws IOException {
                        final String command = Joiner.on(" && ").join(
                            Iterables.concat(
            Severity: Minor
            Found in src/main/java/com/thindeck/agents/Script.java - About 1 hr to fix

              Method make has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static Take make(final Take take) {
                      return new TkAuth(
                          take,
                          new PsChain(
                              new TkAppAuth.FakePass(),
              Severity: Minor
              Found in src/main/java/com/thindeck/cockpit/TkAppAuth.java - About 1 hr to fix

                Method update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void update(final String domain, final XML deck)
                        throws IOException {
                        // @checkstyle LineLength (1 line)
                        final String terms = "not(@waste) and @type='green' and @state='alive' and http";
                        final String servers = Joiner.on(' ').join(
                Severity: Minor
                Found in src/main/java/com/thindeck/agents/UpdateNginx.java - About 1 hr to fix

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

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

                              function () {
                                $("#wait-icon").hide();
                                $("#signup-container").html($("#signed-up-container-success").html());
                                $("#signed-up-container-success").fadeIn(400);
                              },
                    Severity: Major
                    Found in website/email.js and 1 other location - About 1 hr to fix
                    website/email.js on lines 43..47

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

                    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

                              function () {
                                $("#wait-icon").hide();
                                $("#signup-container").html($("#signed-up-container-failure").html());
                                $("#signed-up-container-failure").fadeIn(400);
                              }
                    Severity: Major
                    Found in website/email.js and 1 other location - About 1 hr to fix
                    website/email.js on lines 38..42

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

                    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 32 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[not(@waste) and @state='dead']"
                            );
                    Severity: Minor
                    Found in src/main/java/com/thindeck/agents/BuryContainers.java - About 1 hr to fix

                      Method build has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private String build(final String deck, final XML repo)
                              throws IOException {
                              final String name = String.format(
                                  "%s-%08x", deck,
                                  BuildImage.RND.nextInt()
                      Severity: Minor
                      Found in src/main/java/com/thindeck/agents/BuildImage.java - About 1 hr to fix

                        Method add has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            public void add(final String name) throws IOException {
                                if (!name.matches("[a-z]{3,12}")) {
                                    throw new IllegalStateException(
                                        String.format(
                        Severity: Minor
                        Found in src/main/java/com/thindeck/dynamo/DyDecks.java - About 1 hr to fix

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

                              private static Response make(final String xsl, final Base base,
                                  final Request req, final XeSource... src) throws IOException {
                                  final Response xbl = new RsXembly(
                                      new XeStylesheet(xsl),
                                      new XePage(base, req, src)
                          Severity: Minor
                          Found in src/main/java/com/thindeck/cockpit/RsPage.java - About 1 hr to fix

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

                                @Override
                                public Iterable<Directive> exec(final XML deck) throws IOException {
                                    final Collection<XML> images = deck.nodes(
                                        "/deck/images/image[not(@waste)]"
                                    );
                            Severity: Minor
                            Found in src/main/java/com/thindeck/agents/StartDocker.java - About 1 hr to fix

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

                                  private static Iterable<Directive> answer(final XML deck, final String cmd)
                                      throws IOException {
                                      final Directives dirs = new Directives().xpath("/deck");
                                      final String[] parts = cmd.trim().split("\\s+");
                                      if ("domain".equals(parts[0])) {
                              Severity: Minor
                              Found in src/main/java/com/thindeck/cockpit/deck/TkCommand.java - About 1 hr to fix

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

                                    @Override
                                    public Iterable<String> iterate(final long since) {
                                        return Iterables.transform(
                                            this.region.table(DyEvents.TBL)
                                                .frame()
                                Severity: Minor
                                Found in src/main/java/com/thindeck/dynamo/DyEvents.java - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language