MarshallAsch/solitaire

View on GitHub

Showing 66 of 119 total issues

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

     private void initCardBack()
     {
          buttonGroup1 = new ButtonGroup();
          
          title1 = new JLabel("Choose a card back");
Severity: Minor
Found in solitare/NewUserSettingsPanel.java - About 1 hr to fix

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

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

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

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

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

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

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

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

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