MarshallAsch/solitaire

View on GitHub

Showing 119 of 119 total issues

Method mouseReleased has a Cognitive Complexity of 124 (exceeds 5 allowed). Consider refactoring.
Open

     public void mouseReleased (MouseEvent e)
     {
          //if the game is paused then do nothing
          if (!play)
               return;
Severity: Minor
Found in solitare/Board.java - About 2 days 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

File Board.java has 890 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * packaging
 * cross platform compatibilty
 */

Severity: Major
Found in solitare/Board.java - About 2 days to fix

Method mouseReleased has 168 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public void mouseReleased (MouseEvent e)
     {
          //if the game is paused then do nothing
          if (!play)
               return;
Severity: Major
Found in solitare/Board.java - About 6 hrs to fix

Method setUndo has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

     private void setUndo()
     {
          ArrayList<Integer> xValue, yValue, pileNum, pileIndex, topIndex, tempIndex, scoreTemp;
          ArrayList<Boolean> showFace, inPile, inAce;
          ArrayList<ArrayList> l1;
Severity: Minor
Found in solitare/Board.java - About 6 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

File SettingsPanel.java has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* panel calss to change the settings in the game
 * 
 */

import java.awt.*;
Severity: Minor
Found in solitare/SettingsPanel.java - About 5 hrs to fix

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

               {
                    sub = dom.createElement("user");
                    sub1 = dom.createElement("userName");
                    sub1.appendChild(dom.createTextNode(userName[i]));
                    sub.appendChild(sub1);
Severity: Major
Found in solitare/SettingsPanel.java and 1 other location - About 5 hrs to fix
solitare/Login.java on lines 275..314

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

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

               {
                    //put all info back into file
                    sub = dom.createElement("user");
                    sub1 = dom.createElement("userName");
                    sub1.appendChild(dom.createTextNode(userName[i]));
Severity: Major
Found in solitare/Login.java and 1 other location - About 5 hrs to fix
solitare/SettingsPanel.java on lines 324..363

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

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

     private void initColorSelection()
     {
          labels = new JPanel(new GridLayout(0, 1));
          boxes = new JPanel(new GridLayout(0, 1));
          sliders = new JPanel(new GridLayout(0, 1));
Severity: Major
Found in solitare/SettingsPanel.java and 1 other location - About 5 hrs to fix
solitare/NewUserSettingsPanel.java on lines 101..155

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

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

     private void initColorSelection()
     {
          labels = new JPanel(new GridLayout(0, 1));
          boxes = new JPanel(new GridLayout(0, 1));
          sliders = new JPanel(new GridLayout(0, 1));
Severity: Major
Found in solitare/NewUserSettingsPanel.java and 1 other location - About 5 hrs to fix
solitare/SettingsPanel.java on lines 98..156

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

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

     private void initCardBack()
     {
          buttonGroup1 = new ButtonGroup();
          
          title1 = new JLabel("Choose a card back");
Severity: Major
Found in solitare/SettingsPanel.java and 1 other location - About 5 hrs to fix
solitare/NewUserSettingsPanel.java on lines 229..278

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

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

     private void initCardBack()
     {
          buttonGroup1 = new ButtonGroup();
          
          title1 = new JLabel("Choose a card back");
Severity: Major
Found in solitare/NewUserSettingsPanel.java and 1 other location - About 5 hrs to fix
solitare/SettingsPanel.java on lines 410..459

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

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

Consider simplifying this complex logical expression.
Open

                    if (pile.get(i).size() > 0 && i < 7 && e.getX() >= 200 + 63*i && e.getX() <= 200 +
                        63*(i+1) && e.getY() >= pile.get(i).get(pile.get(i).size()-1).getY() && e.getY() <=
                        pile.get(i).get(pile.get(i).size()-1).getY() + 91 &&
                        pile.get(i).get(pile.get(i).size()-1).isShowFace() && 
                        pile.get(i).get(pile.get(i).size()-1).getNum() == moved.getNum() + 1 &&
Severity: Critical
Found in solitare/Board.java - About 4 hrs to fix

Method init has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void init(Board board)
     {
          add(board);
          
          //create menu
Severity: Major
Found in solitare/Application.java - About 3 hrs to fix

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

     public void propertyChange(PropertyChangeEvent e) 
     {
          //get values
          r = ((Number)r2.getValue()).intValue();
          g = ((Number)g2.getValue()).intValue();
Severity: Major
Found in solitare/NewUserSettingsPanel.java and 1 other location - About 3 hrs to fix
solitare/SettingsPanel.java on lines 173..208

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

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

     public void propertyChange(PropertyChangeEvent e) 
     {
          //get values
          r = ((Number)r2.getValue()).intValue();
          g = ((Number)g2.getValue()).intValue();
Severity: Major
Found in solitare/SettingsPanel.java and 1 other location - About 3 hrs to fix
solitare/NewUserSettingsPanel.java on lines 172..207

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

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

Method undo has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

     public void undo()
     {
          //if the history is empty then do nothing
          if (history.size() == 0)
               return;
Severity: Minor
Found in solitare/Board.java - About 3 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 paintComponent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

     public void paintComponent(Graphics g)
     {
          //seperate by 20
          int timeY = 0, scoreY = 0, numMovesY = 0;
          
Severity: Minor
Found in solitare/Board.java - About 3 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 mousePressed has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

     public void mousePressed (MouseEvent e)
     {
          //if the game is stoped do nothing
          if (!play)
               return;
Severity: Minor
Found in solitare/Board.java - About 3 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 setUndo has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void setUndo()
     {
          ArrayList<Integer> xValue, yValue, pileNum, pileIndex, topIndex, tempIndex, scoreTemp;
          ArrayList<Boolean> showFace, inPile, inAce;
          ArrayList<ArrayList> l1;
Severity: Major
Found in solitare/Board.java - About 3 hrs to fix

Method init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void init()
     {
          //initilize the settings
          settings(Run.x);
          //check if a user is logged in
Severity: Major
Found in solitare/Board.java - About 3 hrs to fix
Severity
Category
Status
Source
Language