silentbalanceyh/vertx-zero

View on GitHub
vertx-ifx/zero-ifx-stomp/src/main/java/io/vertx/ext/stomp/impl/RemindDestination.java

Summary

Maintainability
C
1 day
Test Coverage

Method structureMatches has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean structureMatches(final JsonObject match, final Object body) {
        if (match == null || body == null) {
            return true;
        }

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

    private Frame transform(final Message<Object> msg, final Subscription subscription, final Object bodyData) {
        final String messageId = UUID.randomUUID().toString();

        final Frame frame = new Frame();
        frame.setCommand(Command.MESSAGE);

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

    private Frame transform(final Message<Object> msg, final Subscription subscription, final Object bodyData) {
        final String messageId = UUID.randomUUID().toString();

        final Frame frame = new Frame();
        frame.setCommand(Command.MESSAGE);

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

        @Override
        public synchronized Destination subscribe(final StompServerConnection connection, final Frame frame) {
            final String address = frame.getDestination();
            /*
             * Need to check whether the client can receive message from the event bus (outbound).

      Method checkMatches has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean checkMatches(final boolean inbound, final String address, final Object body) {
      
              final List<PermittedOptions> matches = inbound ? this.options.getInboundPermitteds() : this.options.getOutboundPermitteds();
      
              for (final PermittedOptions matchHolder : 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 structureMatches has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean structureMatches(final JsonObject match, final Object body) {
              if (match == null || body == null) {
                  return true;
              }
      
      

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

            @Override
            public Destination dispatch(final StompServerConnection connection, final Frame frame) {
                final String address = frame.getDestination();
                // Send a frame to the event bus, check if this inbound traffic is allowed.
                if (this.checkMatches(true, address, frame.getBody())) {

          Avoid too many return statements within this method.
          Open

                      return false;

            Avoid too many return statements within this method.
            Open

                        return true;

              There are no issues that match your filters.

              Category
              Status