Showing 58 of 124 total issues
Player
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
public class Player implements SpecialQuestObservable {
private static final String TAG = Player.class.getSimpleName();
private static Player instance = null;
File DisplayQuestionActivity.java
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.questions;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.PendingIntent;
File Player.java
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.player;
import android.app.Activity;
import android.util.Log;
File HomeActivity.java
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.player;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.job.JobInfo;
HomeActivity
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class HomeActivity extends NavigationStudent {
private final int MY_PERMISSION_REQUEST_FINE_LOCATION = 202;
private ImageView image_view;
// Text that will be displayed in the
DisplayQuestionActivity
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
public class DisplayQuestionActivity extends RefreshContext {
@SuppressWarnings("HardCodedStringLiteral")
private final String TAG = "DisplayQuestionActivity";
@SuppressWarnings("HardCodedStringLiteral")
File Firestore.java
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.firebase;
import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
Firestore
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
public class Firestore {
private static FirebaseFirestore db = FirebaseFirestore.getInstance();
private static final String TAG = Firestore.class.getSimpleName();
private static Firestore instance = null;
EditQuestionActivityTest
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
@SuppressWarnings("HardCodedStringLiteral")
@RunWith(AndroidJUnit4.class)
public class EditQuestionActivityTest {
private final String questionUUID = "Temporary fake uuid";
private Question q;
File ManageCourseActivity.java
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.teacher;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
File AddOrEditQuestionActivity.java
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ch.epfl.sweng.studyup.questions;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
Method addQuestion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public void addQuestion(View current) {
RadioGroup imageTextRadioGroup = findViewById(R.id.text_or_image_radio_group), trueFalseRadioGroup = findViewById(R.id.true_false_or_mcq_radio_group);
if (!(imageURI != null || bitmap != null || imageTextRadioGroup.getCheckedRadioButtonId() == R.id.text_radio_button)) return;
RadioGroup answerGroup = findViewById(R.id.question_radio_group);
RadioButton checkedButton = findViewById(answerGroup.getCheckedRadioButtonId());
- 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 loadInterface
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void loadInterface(String lang) {
viewPager = findViewById(R.id.viewPager);
sliderDotsLayout = findViewById(R.id.SliderDots);
Method addQuestion
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void addQuestion(View current) {
RadioGroup imageTextRadioGroup = findViewById(R.id.text_or_image_radio_group), trueFalseRadioGroup = findViewById(R.id.true_false_or_mcq_radio_group);
if (!(imageURI != null || bitmap != null || imageTextRadioGroup.getCheckedRadioButtonId() == R.id.text_radio_button)) return;
RadioGroup answerGroup = findViewById(R.id.question_radio_group);
RadioButton checkedButton = findViewById(answerGroup.getCheckedRadioButtonId());
Method setAndAddQuestion
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setAndAddQuestion() throws Throwable {
//Select Course
onView(withId(R.id.choice_course_button)).perform(scrollTo()).perform(click());
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
UiObject button = uiDevice.findObject(new UiSelector().text(SWENG.toString()));
Method getView
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
if(convertView==null){
convertView=View.inflate(act, idLayout, null);
}
Method setupListViewQ
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected void setupListViewQ(final List<String> questions_course) {
ListView listView = findViewById(R.id.listViewQuestionForStats);
ArrayList<Integer> rates = new ArrayList<>();
ArrayList<Integer> nb_answer = new ArrayList<>();
- 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 setupListViewP
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected void setupListViewP(final List<UserData> userList) {
ListView listView = findViewById(R.id.listViewPlayer);
ArrayList<Integer> rates = new ArrayList<>();
ArrayList<Integer> nb_answer = new ArrayList<>();
- 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 addPlayerToTeachingStaff
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void addPlayerToTeachingStaff(final Course c, final String sciper) {
final DocumentReference courseRef = db.collection(FB_COURSES).document(c.name());
courseRef.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
Method consume
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void consume() {
switch (this) {
case XP_POTION:
Player.get().addExperience(XP_STEP, MOST_RECENT_ACTIVITY);