Drapegnik/bsu

View on GitHub
programming/java/sem3/lab7/src/Paint.java

Summary

Maintainability
C
7 hrs
Test Coverage

Method actionPerformed has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == btnColor) {
            Color tempColor = JColorChooser.showDialog(this, "Choose a color", color);
            if (tempColor != null)
Severity: Minor
Found in programming/java/sem3/lab7/src/Paint.java - About 4 hrs 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 actionPerformed has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == btnColor) {
            Color tempColor = JColorChooser.showDialog(this, "Choose a color", color);
            if (tempColor != null)
Severity: Major
Found in programming/java/sem3/lab7/src/Paint.java - About 2 hrs to fix

    Method GetFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private File GetFile(String filtername, String fileext, Boolean open) {
            JFileChooser chooser = new JFileChooser();
            File workingDirectory = new File(System.getProperty("user.dir"));
            chooser.setCurrentDirectory(workingDirectory);
            if (open) {
    Severity: Minor
    Found in programming/java/sem3/lab7/src/Paint.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