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;
- Create a ticketCreate a ticket
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");
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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>();
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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
{
- Create a ticketCreate a ticket
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())
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
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';
- Read upRead up
- Create a ticketCreate a ticket
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
- Create a ticketCreate a ticket
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)
{
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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
{
- Read upRead up
- Create a ticketCreate a ticket
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);
}
- Create a ticketCreate a ticket
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));
}
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (deck.get(i).equals(top.get(p)))
{
topIndex.set(i, p);
}
- Create a ticketCreate a ticket