Showing 15 of 28 total issues
Method filterSignal
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static double[] filterSignal(ArrayList<Float> signal, double sampleRate , double cutoffFreq, double filterOrder, int filterType, double ripplePercent) {
double[][] recursionCoefficients = new double[22][2];
// Generate double array for ease of coding
double[] unfilteredSignal = new double[signal.size()];
for (int i=0; i<signal.size(); i++) {
- 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 check
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private void check(int code, int value){
long now = System.currentTimeMillis();
int buttonEventKey;
switch (code) {
case KEY_DOWN: {
- 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 filterSignal
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static double[] filterSignal(ArrayList<Float> signal, double sampleRate , double cutoffFreq, double filterOrder, int filterType, double ripplePercent) {
double[][] recursionCoefficients = new double[22][2];
// Generate double array for ease of coding
double[] unfilteredSignal = new double[signal.size()];
for (int i=0; i<signal.size(); i++) {
Method MakeFilterParameters
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static double[] MakeFilterParameters(double cutoffFraction, int filterType, double rippleP, double numberOfPoles, int iteration) {
double rp = -Math.cos(Math.PI/(numberOfPoles*2)+(iteration-1)*(Math.PI/numberOfPoles));
double ip = Math.sin(Math.PI/(numberOfPoles*2)+(iteration-1)*Math.PI/numberOfPoles);
System.out.println("MakeFilterParameters: ripplP:");
System.out.println("cutoffFraction filterType rippleP numberOfPoles iteration");
Method check
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void check(int code, int value){
long now = System.currentTimeMillis();
int buttonEventKey;
switch (code) {
case KEY_DOWN: {
Method setClickListeners
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setClickListeners(){
for(Button btn : plusMinusBtns){
btn.setOnClickListener(plusMinusBtnListener);
btn.setOnLongClickListener(plusMinusBtnLongListener);
}
Method filterSignal
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static double[] filterSignal(ArrayList<Float> signal, double sampleRate , double cutoffFreq, double filterOrder, int filterType, double ripplePercent) {
Method MakeFilterParameters
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static double[] MakeFilterParameters(double cutoffFraction, int filterType, double rippleP, double numberOfPoles, int iteration) {
Method getInverted
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private int getInverted(int key){
if(isSingleKey())
key = key == KEY_UP ? KEY_SELECT : KEY_UP;
else if (isInverted && key != KEY_SELECT)
key = key == KEY_UP ? KEY_DOWN : KEY_UP;
- 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 vibrate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static void vibrate(int time, Context context, boolean sound){
if(sound && soundEnabled(context)) {
MediaPlayer player = MediaPlayer.create(context, R.raw.beep);
player.start();
player.setOnCompletionListener(mediaPlayer -> {
- 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 getKey
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public int getKey(){
int finalKey = -5; //If nothing changed return -5 to not trigger anything
if(isSingleKey()){
if(isLongPress())
finalKey = KEY_UP;
- 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 registerListener
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public void registerListener(Context context) {
if(Prefs.getBoolean(Constants.KEY_HRTOGGLE, true)) {
SaveWorkout.startWorkout();
//Register listener taking into account experimental sensor
if (!prevListening) {
- 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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public void run(){
try {
FileInputStream fileInputStream = new FileInputStream(new File(FILE_PATH));
while (true) {
- 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 onSensorChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onSensorChanged(SensorEvent event) {
float thisValue = event.values[0] / 100;
if(!(thisValue >= 220 || thisValue <= 40))
allHr.add(thisValue); //Add just great values for a more accurate result
- 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 getValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static int[] getValues(int[] data, boolean longClick, Context context){
int sets = data[0]; //data -> 0 = sets, 1 = work, 2 = rest, 3 = res
int workTime = data[1];
int restTime = data[2];
if (data[3] == R.id.plus1) {
- 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"