eo-runtime/src/main/java/org/eolang/PhDefault.java

Summary

Maintainability
C
1 day
Test Coverage

File PhDefault.java has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016-2024 Objectionary.com
 *
Severity: Minor
Found in eo-runtime/src/main/java/org/eolang/PhDefault.java - About 3 hrs to fix

    Method take has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public Phi take(final String name) {
            PhDefault.NESTING.set(PhDefault.NESTING.get() + 1);
            final Phi object;
            if (this.attrs.containsKey(name)) {
    Severity: Major
    Found in eo-runtime/src/main/java/org/eolang/PhDefault.java - About 2 hrs to fix

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

          @Override
          public String φTerm() {
              final List<String> list = new ArrayList<>(this.attrs.size());
              final String format = "%s ↦ %s";
              if (this.data.get() != null) {
      Severity: Minor
      Found in eo-runtime/src/main/java/org/eolang/PhDefault.java - About 1 hr to fix

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

            private String attr(final int pos) {
                if (0 > pos) {
                    throw new ExFailure(
                        String.format(
                            "Attribute position can't be negative (%d)",
        Severity: Minor
        Found in eo-runtime/src/main/java/org/eolang/PhDefault.java - About 1 hr to fix

          Method take has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public Phi take(final String name) {
                  PhDefault.NESTING.set(PhDefault.NESTING.get() + 1);
                  final Phi object;
                  if (this.attrs.containsKey(name)) {
          Severity: Minor
          Found in eo-runtime/src/main/java/org/eolang/PhDefault.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 delta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public byte[] delta() {
                  final byte[] bytes;
                  if (this.data.get() != null) {
                      bytes = this.data.get();
          Severity: Minor
          Found in eo-runtime/src/main/java/org/eolang/PhDefault.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

          There are no issues that match your filters.

          Category
          Status