MarshallAsch/solitaire

View on GitHub

Showing 119 of 119 total issues

Method resize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

     public static void resize()
     {
          String str, value;
          int num = 1, change = 0;
          char suit = 'h';
Severity: Minor
Found in solitare/Run.java - About 55 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

     public void stateChanged(ChangeEvent e)
     {
          //get new values
          r = r3.getValue();
          g = g3.getValue();
Severity: Minor
Found in solitare/SettingsPanel.java and 1 other location - About 50 mins to fix
solitare/NewUserSettingsPanel.java on lines 158..169

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

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 stateChanged(ChangeEvent e)
     {
          //get values
          r = r3.getValue();
          g = g3.getValue();
Severity: Minor
Found in solitare/NewUserSettingsPanel.java and 1 other location - About 50 mins to fix
solitare/SettingsPanel.java on lines 159..170

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

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 a Cognitive Complexity of 8 (exceeds 5 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 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

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

     private void saveSettings()
     {
          try
          {
               File inputFile = new File("UserSetings.dtd");  //open file
Severity: Minor
Found in solitare/SettingsPanel.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

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

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

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

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

     public void actionPerformed(ActionEvent e)
     {
          //if it was to change the card back
          if (e.getActionCommand().length() == 9)
          {
Severity: Minor
Found in solitare/SettingsPanel.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 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

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

                         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

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

               {
                    for (int x = 0; x < 5; x++)
                    {
                         info.get(x).set(k, temp.get(x).get(i));   
                    }
Severity: Minor
Found in solitare/Sort.java and 1 other location - About 40 mins to fix
solitare/Sort.java on lines 92..99

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

               {
                    for (int x = 0; x < 5; x++)
                    {
                         info.get(x).set(k, temp.get(x).get(j));   
                    }
Severity: Minor
Found in solitare/Sort.java and 1 other location - About 40 mins to fix
solitare/Sort.java on lines 83..90

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/Run.java and 1 other location - About 40 mins to fix
solitare/Board.java on lines 611..616

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

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

Method actionPerformed has a Cognitive Complexity of 7 (exceeds 5 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 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

Severity
Category
Status
Source
Language