zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java

Summary

Maintainability
B
6 hrs
Test Coverage

Method checkCompDenpendency has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap, String elName) {
        if (xr.depends.size() > 0) {
            return;
        }

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 1 hr 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 checkCompDenpendency has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static void checkCompDenpendency(XMLResource xr, Map<String, XMLResource> rcmap, String elName) {
        if (xr.depends.size() > 0) {
            return;
        }

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 1 hr to fix

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

        private static List<Element> findAmbiguousComps(Map<String, XMLResource> rcmap, Element el) {
            List<Element> ambigComps = new ArrayList<Element>();
            for (Map.Entry<String, XMLResource> entry: rcmap.entrySet()) { // find Ambiguous Components
                Element root = entry.getValue().document.getRootElement();
                if (root == null)
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 55 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 getResources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public Enumeration<URL> getResources(String name) throws IOException {
            name = resolveName(name);
    
            // no need to use Classes.getContextClassLoader() here because of the loading order issue
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 45 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 resolveDependency has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private static void resolveDependency(XMLResource xr,
        List<Resource> rcs, Map<String, XMLResource> rcmap, Set<String> resolving, String elName) {
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 35 mins to fix

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

          public URL getResource(String name) {
              // no need to use Classes.getContextClassLoader() here because of the loading order issue
              final ClassLoader cl = Thread.currentThread().getContextClassLoader();
              URL url = cl != null ? cl.getResource(resolveName(name)): null;
              if (url != null) {
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.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 resolveDependency has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private static void resolveDependency(XMLResource xr,
          List<Resource> rcs, Map<String, XMLResource> rcmap, Set<String> resolving, String elName) {
              if (!resolving.add(xr.name))
                  throw new IllegalStateException("Recusrive reference among "+resolving);
              
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.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