zul/src/main/java/org/zkoss/zul/Chart.java

Summary

Maintainability
F
3 days
Test Coverage

Chart has 73 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Chart extends Imagemap {
    private static final long serialVersionUID = 20091008183601L;
    //chart type
    public static final String PIE = "pie";
    public static final String FUNNEL = "funnel";
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Chart.java - About 1 day to fix

    File Chart.java has 592 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* Chart.java
    
        Purpose:
            
        Description:
    Severity: Major
    Found in zul/src/main/java/org/zkoss/zul/Chart.java - About 1 day to fix

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

          public Object clone() {
              final Chart clone = (Chart) super.clone();
      
              // Due to the not unique ID of the area component creating in JFreeChartEngine, we have to clear
              // all its children first.
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.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

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

          protected ChartEngine newChartEngine() throws UiException {
              final String PROP = "org.zkoss.zul.chart.engine.class";
              final String klass = Library.getProperty(PROP);
              if (klass == null)
                  throw new UiException("Library property,  " + PROP + ", required");
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 2 other locations - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Captcha.java on lines 388..403
      zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 157..172

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

      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

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

              if (clone._model != null) {
                  if (clone._model instanceof ComponentCloneListener) {
                      final ChartModel model = (ChartModel) ((ComponentCloneListener) clone._model).willClone(clone);
                      if (model != null)
                          clone._model = model;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 734..742

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

      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

          public void setBgColor(String color) {
              if (Objects.equals(color, _bgColor)) {
                  return;
              }
              _bgColor = color;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 470..482

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

      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

          public void setPaneColor(String color) {
              if (Objects.equals(color, _paneColor)) {
                  return;
              }
              _paneColor = color;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 549..561

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

      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

          public void onPageAttached(Page newpage, Page oldpage) {
              super.onPageAttached(newpage, oldpage);
              if (_model != null) {
                  smartDrawChart();
                  if (_dataListener != null) {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 45 mins to fix
      zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 808..817

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

      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 3 locations. Consider refactoring.
      Open

          public void setPaneAlpha(int alpha) {
              if (alpha == _paneAlpha) {
                  return;
              }
              if (alpha > 255 || alpha < 0) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 2 other locations - About 45 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 504..514
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 527..536

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

      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 3 locations. Consider refactoring.
      Open

          public void setBgAlpha(int alpha) {
              if (alpha == _bgAlpha) {
                  return;
              }
              if (alpha > 255 || alpha < 0) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 2 other locations - About 45 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 448..457
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 504..514

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

      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 3 locations. Consider refactoring.
      Open

          public void setFgAlpha(int alpha) {
              if (alpha == _fgAlpha) {
                  return;
              }
      
      
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 2 other locations - About 45 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 448..457
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 527..536

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

      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

          public void setHeight(String h) {
              if (Objects.equals(h, getHeight())) {
                  return;
              }
              _intHeight = stringToInt(h);
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 317..324

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

      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

              if (j > 0) {
                  final String num = str.substring(0, j);
                  return (int) (Integer.parseInt(num) * 13.3333);
              }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 989..992

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

      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

              if (j > 0) {
                  final String num = str.substring(0, j);
                  return (int) (Integer.parseInt(num) * 1.3333);
              }
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 995..998

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

      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

          public void setWidth(String w) {
              if (Objects.equals(w, getWidth())) {
                  return;
              }
              _intWidth = stringToInt(w);
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Chart.java and 1 other location - About 30 mins to fix
      zul/src/main/java/org/zkoss/zul/Chart.java on lines 344..351

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

      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

      There are no issues that match your filters.

      Category
      Status