macgregor/alexandria

View on GitHub

Showing 28 of 263 total issues

Method setAttributes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        @Override
        public void setAttributes(Node node, AttributablePart part, Attributes attributes) {
            /*
            Jive syntax language options:
            None,

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

    public void execute(Batch<T> batch, Task<T> task, AfterBatch<T> after) throws BatchProcessException {
        try {
            for (T t : batch.collect(context)) {
                try {
                    task.execute(context, t);

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

    public void findParentPlace(Config.DocumentMetadata metadata) throws IOException {
        log.debug(String.format("Jive parent place detected, attempting to retrieve from remote."));

        String parentPlaceUrl = context.getExtraPropertiesForDocument(metadata).get(JIVE_PARENT_URI);
        String parentPlaceName = JiveUtils.jiveParentPlaceName(parentPlaceUrl);

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

File JiveRemote.java has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.github.macgregor.alexandria.remotes;

import com.github.macgregor.alexandria.Config;
import com.github.macgregor.alexandria.Context;
import com.github.macgregor.alexandria.exceptions.AlexandriaException;

    File RemoteDocument.java has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.github.macgregor.alexandria.remotes;
    
    import com.fasterxml.jackson.core.JsonFactory;
    import com.fasterxml.jackson.databind.JavaType;
    import com.fasterxml.jackson.databind.JsonNode;

      Method sync has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected void sync() throws AlexandriaException {
              BatchProcess<Config.DocumentMetadata> batchProcess = new BatchProcess<>(context);
              batchProcess.execute(context -> context.config().metadata().get(), (context, metadata) -> {
                  log.debug(String.format("Syncing %s with remote.", metadata.sourceFileName()));
                  remote.validateDocumentMetadata(metadata);

        Method execute has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void execute(Batch<T> batch, Task<T> task, AfterBatch<T> after) throws BatchProcessException {
                try {
                    for (T t : batch.collect(context)) {
                        try {
                            task.execute(context, t);

          Method setAttributes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  @Override
                  public void setAttributes(Node node, AttributablePart part, Attributes attributes) {
                      /*
                      Jive syntax language options:
                      None,

            Method updateMetadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected static Config.DocumentMetadata updateMetadata(Config.DocumentMetadata metadata, JiveData.JiveContent content) {
                    metadata.createdOn(Optional.ofNullable(content.published));
                    metadata.lastUpdated(Optional.ofNullable(content.updated));
            
                    if(content.resources != null && content.resources.containsKey("html")){

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

                public void findParentPlace(Config.DocumentMetadata metadata) throws IOException {
                    log.debug(String.format("Jive parent place detected, attempting to retrieve from remote."));
            
                    String parentPlaceUrl = context.getExtraPropertiesForDocument(metadata).get(JIVE_PARENT_URI);
                    String parentPlaceName = JiveUtils.jiveParentPlaceName(parentPlaceUrl);

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

                  protected Response doRequest(Request request) throws HttpException {
                      log.debug(request.toString());
                      if(request.body() != null) {
                          try {
                              log.debug(Requests.bodyToString(request));

                Method nextPage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        protected Iterator<T> nextPage() {
                            RemoteDocument remoteDocument = requestBuilder
                                    .queryParameter(requestBuilder.pageSizeRequestParameter, pageSize.toString())
                                    .queryParameter(requestBuilder.pageOffsetRequestParameter, offset.toString())
                                    .build();

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

                      protected Response doRequest(Request request) throws HttpException {
                          log.debug(request.toString());
                          if(request.body() != null) {
                              try {
                                  log.debug(Requests.bodyToString(request));

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

                          private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) {
                              html.line();
                              html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre();
                  
                              BasedSequence info = node.getInfo();

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

                          private void render(FencedCodeBlock node, NodeRendererContext context, HtmlWriter html) {
                              html.line();
                              html.srcPosWithTrailingEOL(node.getChars()).withAttr().tag("pre").openPre();
                  
                              BasedSequence info = node.getInfo();

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

                            public State determineState() throws IOException {
                                if(this.deletedOn().isPresent()){
                                    return State.DELETED;
                                }
                    
                    

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

                        public static String interpolate(String input){
                            if(input != null) {
                                Pattern p = Pattern.compile(VARIABLE_INTERPOLATION_PATTERN);
                                Matcher m = p.matcher(input);
                                if (m.matches()) {

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

                        @Override
                        public void delete(Config.DocumentMetadata metadata) throws IOException {
                            boolean deleted = false;
                            try{
                                JiveData.JiveContent content = findDocument(metadata);

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

                        @Override
                        public void create(Config.DocumentMetadata metadata) throws IOException {
                            JiveUtils.setTrackingTagAsNeeded(context, metadata);
                            boolean found = false;
                            try {

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

                        @Override
                        public void execute() throws MojoExecutionException, MojoFailureException {
                            if(isExecutionRoot()) {
                                try {
                                    init();

                    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