Showing 24 of 42 total issues
Method onProgressUpdate
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void onProgressUpdate(String... progress) {
if (progress == null) {
Toast toast = Toast.makeText(getApplicationContext(), "Set completed!", Toast.LENGTH_SHORT);
toast.show();
- Read upRead up
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
File GhostingActivity.java
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.markusborg.ui;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.drawable.Drawable;
Method doInBackground
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected String doInBackground(Setting... params) {
Setting theSetting = params[0];
GhostPlayer theGhost = new GhostPlayer(theSetting.isSixPoints());
- Read upRead up
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 onProgressUpdate
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onProgressUpdate(String... progress) {
if (progress == null) {
Toast toast = Toast.makeText(getApplicationContext(), "Set completed!", Toast.LENGTH_SHORT);
toast.show();
Method onCreate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ghosting);
Bundle extras = getIntent().getExtras();
Consider simplifying this complex logical expression. Open
if (!Character.isDigit(date.charAt(0)) ||
!Character.isDigit(date.charAt(1)) ||
!Character.isDigit(date.charAt(2)) ||
!Character.isDigit(date.charAt(3)) ||
date.charAt(4) != '-' ||
Method onCreate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Method doInBackground
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected String doInBackground(Setting... params) {
Setting theSetting = params[0];
GhostPlayer theGhost = new GhostPlayer(theSetting.isSixPoints());
Method serve
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public CourtPosition serve()
{
CourtPosition servePos = null;
if (sixPoint) {
switch (rand.nextInt(6)) {
Method nextStrike
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public CourtPosition nextStrike()
{
CourtPosition strikePos = null;
if (sixPoint) {
switch (rand.nextInt(6)) {
Method setSettingFromString
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean setSettingFromString(String input) {
// Example of valid string
// 2015-11-24 (SQ): 1; 1; 1; 1
// shortest possible string is 27 characters
Method getView
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- Read upRead up
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 setSettingFromString
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private boolean setSettingFromString(String input) {
// Example of valid string
// 2015-11-24 (SQ): 1; 1; 1; 1
// shortest possible string is 27 characters
- Read upRead up
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 displayCountdown
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void displayCountdown() {
publishProgress("5");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Method getView
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Method addSessionToLog
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void addSessionToLog(Setting theSetting) {
// move all history items one position
if (n == 1) {
history[1] = history[0];
}
Method addSessionToLog
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void addSessionToLog(Setting theSetting) {
// move all history items one position
if (n == 1) {
history[1] = history[0];
}
- Read upRead up
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 onCreate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ghosting);
Bundle extras = getIntent().getExtras();
- Read upRead up
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 too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;