MarshallAsch/solitaire

View on GitHub
solitare/Board.java

Summary

Maintainability
F
2 wks
Test Coverage

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

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

Method mouseClicked has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

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

     public void paintComponent(Graphics g)
     {
          //seperate by 20
          int timeY = 0, scoreY = 0, numMovesY = 0;
          
Severity: Major
Found in solitare/Board.java - About 2 hrs to fix

Method undo has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public void undo()
     {
          //if the history is empty then do nothing
          if (history.size() == 0)
               return;
Severity: Major
Found in solitare/Board.java - About 2 hrs to fix

Method possibleMove has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

     private boolean possibleMove()
     {
          //if card cards that it can be placed on are in the same pile then false (same suit one below, 
          //one above opposite suit)
          
Severity: Minor
Found in solitare/Board.java - About 2 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 initCards has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

     public ArrayList<Card> initCards()
     {
          Card[] deck = new Card[52];
          int rand, change = 0, num = 1;
          char suit = 'H';
Severity: Minor
Found in solitare/Board.java - About 2 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 initCards has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public ArrayList<Card> initCards()
     {
          Card[] deck = new Card[52];
          int rand, change = 0, num = 1;
          char suit = 'H';
Severity: Major
Found in solitare/Board.java - About 2 hrs to fix

Method mousePressed has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Consider simplifying this complex logical expression.
Open

                    else if (movePile.isEmpty() && pile.get(i).size() > 0 && i > 7 && e.getY() >= 5 &&
                             e.getY() <= 96 && e.getX() >= 404 + 68*(i-8) && e.getX() <= 404 + 68*(i-7) &&
                             moved.getNum() == pile.get(i).get(pile.get(i).size()-1).getNum() + 1 &&
                             pile.get(i).get(pile.get(i).size()-1).getSuit() == moved.getSuit())
                    {
Severity: Critical
Found in solitare/Board.java - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                    if(num1+1 == num2 && ((suit1 == 'H' || suit1 == 'D') && (suit2 == 'C' || suit2 == 'S')) 
                            || ((suit2 == 'H' || suit2 == 'D') && (suit1 == 'C' || suit1 == 'S')))
                         counter++; 
Severity: Critical
Found in solitare/Board.java - About 1 hr to fix

Method mouseClicked has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public void mouseClicked (MouseEvent e)
     {
          //if game is stoped do nothing
          if (!play)
               return;
Severity: Minor
Found in solitare/Board.java - About 1 hr to fix

Method flip3 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void flip3()
     {
          int cardLeft = 0, amount = temp.size() - 1;
          
          //pre pair to flip the correct number of cards if there are not enough left to flip 3
Severity: Minor
Found in solitare/Board.java - About 1 hr to fix

Method settings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

     public void settings(int loginStatus)
     {
          //if no user is logged in then set to 0 (default user)
          if (loginStatus == -1)
               loginStatus = 0;
Severity: Minor
Found in solitare/Board.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 settings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public void settings(int loginStatus)
     {
          //if no user is logged in then set to 0 (default user)
          if (loginStatus == -1)
               loginStatus = 0;
Severity: Minor
Found in solitare/Board.java - About 1 hr to fix

Method flip1 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void flip1()
     {
          int cardLeft = 0, amount = temp.size() - 1;
          
          //if deck is not empty
Severity: Minor
Found in solitare/Board.java - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

               else if (i != 7 && pile.get(i).size() > 0 && e.getX() >= pile.get(i).get(pile.get(i).size()-1)
                             .getX() && e.getX() <= pile.get(i).get(pile.get(i).size()-1).getX() + 63 &&
                        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())
Severity: Major
Found in solitare/Board.java - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                    else if (pile.get(i).size() == 0 && i > 7 && moved.getNum() == 1 && e.getY() >= 5 &&
                             e.getY() <= 96 && e.getX() >= 404 + 68*(i-8) && e.getX() <= 404 + 68*(i-7))
                    {
                         moved.setPosition(404 + 68*(i-8), 5);
                         moved.setInAce(true);
Severity: Major
Found in solitare/Board.java - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

               if (i == 7 && top.size() > 0 && e.getX() >= top.get(top.size()-1).getX() && e.getX() <=
                   top.get(top.size()-1).getX() + 63 && e.getY() >= top.get(top.size()-1).getY() && e.getY()
                        <= top.get(top.size()-1).getY() + 91 && top.get(top.size()-1).isShowFace())  
               {
                    setUndo();  //add move to hystory 
Severity: Major
Found in solitare/Board.java - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                    else if (pile.get(i).size() == 0 && i < 7 && e.getX() >=  68*(i) + 200 && e.getX() <= 
                             68*(i+1) + 200 && e.getY() >= 105 && e.getY() <= 196 && moved.getNum() == 13)
                    {
                         moved.setPosition(68*(i) + 200, 105);
                         moved.setInAce(false);
Severity: Major
Found in solitare/Board.java - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

                              if (index1 >7)
                                   score += scoringSystem[scoreSystemUsed][4];   //add to score
Severity: Major
Found in solitare/Board.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                              if (deck.get(i).equals(temp.get(p)))
                              {
                                   tempIndex.set(i, p);
                              }
Severity: Major
Found in solitare/Board.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                              for (int p = j+1; p < pile.get(i).size(); p++)
                              {
                                   movePile.add(pile.get(i).get(p));
                              }
Severity: Major
Found in solitare/Board.java - About 45 mins to fix

Method flip3 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

     private void flip3()
     {
          int cardLeft = 0, amount = temp.size() - 1;
          
          //pre pair to flip the correct number of cards if there are not enough left to flip 3
Severity: Minor
Found in solitare/Board.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

Avoid deeply nested control flow statements.
Open

                              for (int j = 0; j < movePile.size(); j++)
                              {
                                   movePile.get(j).setPosition(pile.get(i).get(pile.get(i).size()-1).getX(),
                                                               pile.get(i).get(pile.get(i).size()-1).getY()+
                                                               20);
Severity: Major
Found in solitare/Board.java - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                              if (deck.get(i).equals(top.get(p)))
                              {
                                   topIndex.set(i, p);
                              }
Severity: Major
Found in solitare/Board.java - About 45 mins to fix

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

     public void mouseDragged (MouseEvent e)
     {
          //if the game is dissabled do nothing
          if (!play)
               return;
Severity: Minor
Found in solitare/Board.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 initCards has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

     private ArrayList<Card> initCards(ArrayList<Card> shuffled)
     {
          int num = 0;
          
          //put the cards into the correct spot
Severity: Minor
Found in solitare/Board.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 flip1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

     private void flip1()
     {
          int cardLeft = 0, amount = temp.size() - 1;
          
          //if deck is not empty
Severity: Minor
Found in solitare/Board.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

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

                         if (!movePile.isEmpty())
                         {
                              for (int j = 0; j < movePile.size(); j++)
                              {
                                   movePile.get(j).setPosition(pile.get(i).get(pile.get(i).size()-1).getX(),
Severity: Major
Found in solitare/Board.java and 1 other location - About 2 hrs to fix
solitare/Board.java on lines 959..973

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

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 (!movePile.isEmpty())
                         {
                              //cycle through movepile to place
                              for (int j = 0; j < movePile.size(); j++)
                              {
Severity: Major
Found in solitare/Board.java and 1 other location - About 2 hrs to fix
solitare/Board.java on lines 1061..1074

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

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(index1 != 7)   //if the card is not from the pile
                         {
                              pile.get(index1).remove(pile.get(index1).size()-1);   //remove from old pile
                              if (index1 >7)
                                   score += scoringSystem[scoreSystemUsed][4];   //add to score
Severity: Major
Found in solitare/Board.java and 1 other location - About 2 hrs to fix
solitare/Board.java on lines 1005..1020

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

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 (index1 !=7)
                         {
                              pile.get(index1).remove(pile.get(index1).size()-1);
                              if (index1 < 7)
                                   score += scoringSystem[scoreSystemUsed][2];
Severity: Major
Found in solitare/Board.java and 1 other location - About 2 hrs to fix
solitare/Board.java on lines 974..989

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

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

          else if (amount == 1)
          {
               cardLeft = 1;
          }
          else
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 733..749

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

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 (amount > 0)
          {
               cardLeft = 1;
          }
          else
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 692..708

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

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

          for (int j = 8; j < 12; j++)
          {
               for (int i = 0; i < pile.get(j).size(); i++)
               {
                    g.drawImage(pile.get(j).get(i).getDisplay(), pile.get(j).get(i).getX(),
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 324..331

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

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

          for (int j = 0; j < 7; j++)
          {
               for (int i = 0; i < pile.get(j).size(); i++)
               {
                    g.drawImage(pile.get(j).get(i).getDisplay(), pile.get(j).get(i).getX(),
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 341..348

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

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

          for (int i = 0; i < cardLeft; i++)
          {
               amount = temp.size() -1;
               temp.get(amount).setX(73 + 10*i);
               temp.get(amount).showFace(true);
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 758..765

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

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

          for (int i = 0; i < cardLeft; i++)
          {
               amount = temp.size() -1;
               temp.get(amount).setX(73 + 10*i);
               temp.get(amount).showFace(true);
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 717..724

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

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

                        (((pile.get(i).get(pile.get(i).size()-1).getSuit() == 'H' ||
                           pile.get(i).get(pile.get(i).size()-1).getSuit() == 'D') && 
                          (moved.getSuit() =='S' || moved.getSuit() == 'C')) || 
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 948..950

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

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

                         ((pile.get(i).get(pile.get(i).size()-1).getSuit() == 'C' || 
                           pile.get(i).get(pile.get(i).size()-1).getSuit() == 'S') && 
                          (moved.getSuit() == 'H' || moved.getSuit() == 'D'))))
Severity: Major
Found in solitare/Board.java and 1 other location - About 1 hr to fix
solitare/Board.java on lines 945..947

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

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

                         for (int p = 0; p < top.size(); p++)
                         {
                              //if its in the top then indicate position
                              if (deck.get(i).equals(top.get(p)))
                              {
Severity: Minor
Found in solitare/Board.java and 1 other location - About 40 mins to fix
solitare/Board.java on lines 426..432

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

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

                         for (int p = 0; p < temp.size(); p++)
                         {
                              if (deck.get(i).equals(temp.get(p)))
                              {
                                   tempIndex.set(i, p);
Severity: Minor
Found in solitare/Board.java and 1 other location - About 40 mins to fix
solitare/Board.java on lines 416..423

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

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

               if (change == 1)
                    suit = 'C';
               else if (change == 2)
                    suit = 'D';
               else if (change == 3)
Severity: Minor
Found in solitare/Board.java and 1 other location - About 40 mins to fix
solitare/Run.java on lines 72..77

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

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 ((int)hist.get(8).get(i) != -1)
                         temp.set((int)hist.get(8).get(i), deck.get(i));
Severity: Minor
Found in solitare/Board.java and 1 other location - About 35 mins to fix
solitare/Board.java on lines 512..513

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

                    if ((int)hist.get(7).get(i) != -1)
                         top.set((int)hist.get(7).get(i), deck.get(i));
Severity: Minor
Found in solitare/Board.java and 1 other location - About 35 mins to fix
solitare/Board.java on lines 514..515

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

                    {
                         pile.get((int)hist.get(5).get(i)).set((int)hist.get(6).get(i), deck.get(i));
                    }
Severity: Minor
Found in solitare/Board.java and 1 other location - About 30 mins to fix
solitare/Board.java on lines 507..509

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

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

                    shuffled.get(num).setPosition((68*(i-1) + 200), (105 + 20*j));
Severity: Minor
Found in solitare/Board.java and 1 other location - About 30 mins to fix
solitare/Board.java on lines 648..648

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

                    {
                         pile.get((int)hist.get(5).get(i)).add((int)hist.get(6).get(i), deck.get(i));
                    }
Severity: Minor
Found in solitare/Board.java and 1 other location - About 30 mins to fix
solitare/Board.java on lines 503..505

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

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

                    shuffled.get(num).setPosition((68*(i-1) + 200), (105 + 20*j));
Severity: Minor
Found in solitare/Board.java and 1 other location - About 30 mins to fix
solitare/Board.java on lines 570..570

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