MarshallAsch/solitaire

View on GitHub

Showing 119 of 119 total issues

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

               try {
                    Transformer tr = TransformerFactory.newInstance().newTransformer();
                    tr.setOutputProperty(OutputKeys.INDENT, "yes");
                    tr.setOutputProperty(OutputKeys.METHOD, "xml");
                    tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
Severity: Major
Found in solitare/Login.java and 2 other locations - About 1 hr to fix
solitare/Login.java on lines 316..329
solitare/SettingsPanel.java on lines 365..378

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

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

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

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

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

Method actionPerformed has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     public void actionPerformed (ActionEvent e)
     {
          if (e.getActionCommand().equals("ok"))
          {
               frame.dispose();        //close frame when ok is pressed
Severity: Minor
Found in solitare/HighScorePanel.java - About 1 hr to fix

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

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

Method readHighScores has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private ArrayList<ArrayList> readHighScores()
     {
          ArrayList<String> lineInNames = new ArrayList<String>();
          ArrayList<Integer>lineInScore = new ArrayList<Integer>(), lineInTime = new ArrayList<Integer>(),
               lineInMoves = new ArrayList<Integer>();
Severity: Minor
Found in solitare/HighScoreFrame.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

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

     public void itemStateChanged (ItemEvent e)
     {
          Object source = e.getItemSelectable();
          boolean change = true;
          
Severity: Major
Found in solitare/NewUserSettingsPanel.java and 1 other location - About 1 hr to fix
solitare/SettingsPanel.java on lines 515..529

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

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 itemStateChanged (ItemEvent e)
     {
          Object source = e.getItemSelectable();
          boolean change = true;
          
Severity: Major
Found in solitare/SettingsPanel.java and 1 other location - About 1 hr to fix
solitare/NewUserSettingsPanel.java on lines 328..342

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

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 login has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void login(String user, String pass)
     {
          //if user and pass is admin open control window
          try
          {
Severity: Minor
Found in solitare/Login.java - About 1 hr to fix

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

     public void windowClosed(WindowEvent e)
     {
          board.play = true;
          Window[] win = getWindows();
          
Severity: Major
Found in solitare/AboutFrame.java and 2 other locations - About 1 hr to fix
solitare/HighScoreFrame.java on lines 101..110
solitare/SettingsFrame.java on lines 45..54

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

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

     public void windowClosed(WindowEvent e)
     {
          board.play = true;
          Window[] win = getWindows();
          for (int i = 0; i < win.length; i++)
Severity: Major
Found in solitare/SettingsFrame.java and 2 other locations - About 1 hr to fix
solitare/AboutFrame.java on lines 46..57
solitare/HighScoreFrame.java on lines 101..110

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

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

     public void windowClosed(WindowEvent e)
     {
          board.play = true;
          Window[] win = getWindows();
          for (int i = 0; i < win.length; i++)
Severity: Major
Found in solitare/HighScoreFrame.java and 2 other locations - About 1 hr to fix
solitare/AboutFrame.java on lines 46..57
solitare/SettingsFrame.java on lines 45..54

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

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

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

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
Severity
Category
Status
Source
Language