MarshallAsch/solitaire

View on GitHub

Showing 66 of 119 total issues

Method addToHighScore has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void addToHighScore(String name)
     {
          lineInNames = new ArrayList<String>();
          lineInScore = new ArrayList<Integer>();
          lineInTime = new ArrayList<Integer>();
Severity: Major
Found in solitare/NewWindowPanel.java - About 2 hrs to fix

Method rebuild has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void rebuild(String user, String pass)
     {
          Document dom;
          Element sub, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9;
          int pileNum = 0, pileIndex = 0;
Severity: Major
Found in solitare/Login.java - About 2 hrs to fix

Method mergeParts has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

     private  void mergeParts(int lower, int middle, int higher)
     {
          for (int i = lower; i <= higher; i++) {
               for (int j = 0; j < 5; j++)
               {
Severity: Minor
Found in solitare/Sort.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 saveSettings2 has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void saveSettings2()
     {
          Element sub, sub1, sub2, sub3, sub4, sub5, sub6, sub7, sub8, sub9;
          
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Severity: Major
Found in solitare/SettingsPanel.java - About 2 hrs to fix

File NewUserSettingsPanel.java has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Panel to select all of the setings for the new user when it is created
 * 
 */

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

Method saveSettings has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Method addToHighScore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

     private void addToHighScore(String name)
     {
          lineInNames = new ArrayList<String>();
          lineInScore = new ArrayList<Integer>();
          lineInTime = new ArrayList<Integer>();
Severity: Minor
Found in solitare/NewWindowPanel.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

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

     public void paint(Graphics g)
     {
          int up;
          
          //paint the titles
Severity: Minor
Found in solitare/HighScorePanel2.java - About 1 hr to fix

Method mergeParts has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private  void mergeParts(int lower, int middle, int higher)
     {
          for (int i = lower; i <= higher; i++) {
               for (int j = 0; j < 5; j++)
               {
Severity: Minor
Found in solitare/Sort.java - About 1 hr to fix

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

     private void createNewUser()
     {
          try
          {
               File inputFile = new File("UserSetings.dtd");  //open file to get all old users
Severity: Minor
Found in solitare/Login.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 initColorSelection has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void initColorSelection()
     {
          labels = new JPanel(new GridLayout(0, 1));
          boxes = new JPanel(new GridLayout(0, 1));
          sliders = new JPanel(new GridLayout(0, 1));
Severity: Minor
Found in solitare/NewUserSettingsPanel.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 initColorSelection has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     private void initColorSelection()
     {
          labels = new JPanel(new GridLayout(0, 1));
          boxes = new JPanel(new GridLayout(0, 1));
          sliders = new JPanel(new GridLayout(0, 1));
Severity: Minor
Found in solitare/SettingsPanel.java - About 1 hr to fix

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

     public void paint(Graphics g)
     {
          int up;
          
          //paint the titles
Severity: Minor
Found in solitare/HighScorePanel2.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 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 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/SettingsPanel.java - About 1 hr to fix
Severity
Category
Status
Source
Language