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

Summary

Maintainability
D
2 days
Test Coverage

Slider has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Slider extends XulElement {
    private String _orient = "horizontal", _mode = INTEGER;
    private Double _curpos = 0.0, _minpos = 0.0, _maxpos = 100.0, _pginc = -1.0, _step = -1.0;
    /** The name. */
    private String _name;
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Slider.java - About 6 hrs to fix

    File Slider.java has 265 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* Slider.java
    
        Purpose:
            
        Description:
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Slider.java - About 2 hrs to fix

      Method renderProperties has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException {
              super.renderProperties(renderer);
              if (!"horizontal".equals(_orient))
                  renderer.render("orient", _orient);
              if (!"{0}".equals(_slidingtext))
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Slider.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 setMold has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setMold(String mold) {
              if (isVertical()) {
                  if (mold.startsWith("scale")) {
                      throw new WrongValueException("Unsupported vertical orient in mold : " + mold);
                  } else {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Slider.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 2 locations. Consider refactoring.
      Open

          public void setMaxpos(double maxpos) throws WrongValueException {
              if (maxpos <= 0)
                  throw new WrongValueException("Nonpositive is not allowed: " + maxpos);
      
              if (Double.compare(_maxpos, maxpos) != 0) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Slider.java on lines 199..209

      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 setMinpos(double minpos) throws WrongValueException {
              if (minpos < 0)
                  throw new WrongValueException("Nonpositive is not allowed: " + minpos);
      
              if (Double.compare(_minpos, minpos) != 0) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 1 other location - About 1 hr to fix
      zul/src/main/java/org/zkoss/zul/Slider.java on lines 241..251

      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

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

          public void setOrient(String orient) throws WrongValueException {
              if (!"horizontal".equals(orient) && !"vertical".equals(orient))
                  throw new WrongValueException("orient cannot be " + orient);
              if (!Objects.equals(orient, _orient)) {
                  _orient = orient;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 3 other locations - About 55 mins to fix
      zul/src/main/java/org/zkoss/zul/Menubar.java on lines 58..66
      zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 93..101
      zul/src/main/java/org/zkoss/zul/Toolbar.java on lines 101..109

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

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

          public void setName(String name) {
              if (name != null && name.length() == 0)
                  name = null;
              if (!Objects.equals(_name, name)) {
                  _name = name;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 18 other locations - About 50 mins to fix
      zk/src/main/java/org/zkoss/zk/ui/HtmlBasedComponent.java on lines 323..330
      zul/src/main/java/org/zkoss/zul/Area.java on lines 110..117
      zul/src/main/java/org/zkoss/zul/Box.java on lines 129..136
      zul/src/main/java/org/zkoss/zul/Box.java on lines 185..192
      zul/src/main/java/org/zkoss/zul/Box.java on lines 250..257
      zul/src/main/java/org/zkoss/zul/Calendar.java on lines 237..244
      zul/src/main/java/org/zkoss/zul/Checkbox.java on lines 225..232
      zul/src/main/java/org/zkoss/zul/Grid.java on lines 1332..1339
      zul/src/main/java/org/zkoss/zul/Layout.java on lines 40..47
      zul/src/main/java/org/zkoss/zul/Listbox.java on lines 827..834
      zul/src/main/java/org/zkoss/zul/Listbox.java on lines 1483..1490
      zul/src/main/java/org/zkoss/zul/Radiogroup.java on lines 276..283
      zul/src/main/java/org/zkoss/zul/Script.java on lines 105..113
      zul/src/main/java/org/zkoss/zul/Script.java on lines 211..219
      zul/src/main/java/org/zkoss/zul/Selectbox.java on lines 191..198
      zul/src/main/java/org/zkoss/zul/Style.java on lines 119..126
      zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 403..411
      zul/src/main/java/org/zkoss/zul/Tree.java on lines 819..826

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

      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 setMold(String mold) {
              if (isVertical()) {
                  if (mold.startsWith("scale")) {
                      throw new WrongValueException("Unsupported vertical orient in mold : " + mold);
                  } else {
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 1 other location - About 40 mins to fix
      zul/src/main/java/org/zkoss/zul/Tabbox.java on lines 518..528

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

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

          public void setScaleInput(double scaleInput) {
              if (_scaleInput <= 0)
                  throw new WrongValueException("The value of scaleInput should be larger than 0");
              if (_scaleInput != scaleInput) {
                  _scaleInput = scaleInput;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 6 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Auxheader.java on lines 55..62
      zul/src/main/java/org/zkoss/zul/Auxheader.java on lines 74..81
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 49..56
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 70..77
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 123..130
      zul/src/main/java/org/zkoss/zul/Slider.java on lines 476..483

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

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

          public void setStrokeWidth(double strokeWidth) {
              if (strokeWidth <= 0)
                  throw new WrongValueException("The value of strokeWidth should be larger than 0");
              if (_strokeWidth != strokeWidth) {
                  _strokeWidth = strokeWidth;
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Slider.java and 6 other locations - About 35 mins to fix
      zul/src/main/java/org/zkoss/zul/Auxheader.java on lines 55..62
      zul/src/main/java/org/zkoss/zul/Auxheader.java on lines 74..81
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 49..56
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 70..77
      zul/src/main/java/org/zkoss/zul/Frozen.java on lines 123..130
      zul/src/main/java/org/zkoss/zul/Slider.java on lines 504..511

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

      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