Futsch1/medTimer

View on GitHub

Showing 6 of 37 total issues

Method generateTestMedicine has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void generateTestMedicine() {
        TestMedicine[] testMedicines = new TestMedicine[]{
                new TestMedicine("Omega 3 (EPA/DHA 500mg)", null, new TestReminder[]{
                        new TestReminder("1", 9 * 60, 1, 0, ""),
                        new TestReminder("1", 18 * 60, 2, 2, "after meals")
Severity: Minor
Found in app/src/main/java/com/futsch1/medtimer/GenerateTestData.java - About 1 hr to fix

    Method bind has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void bind(MedicineWithReminders medicineWithReminders, DeleteCallback deleteCallback) {
            medicineNameView.setText(medicineWithReminders.medicine.name);
            if (medicineWithReminders.reminders.isEmpty()) {
                remindersSummaryView.setText(R.string.no_reminders);
            } else {

      Method onChildDrawOver has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public void onChildDrawOver(@NonNull Canvas c, @NonNull RecyclerView recyclerView,
                                      RecyclerView.ViewHolder viewHolder, float dX, float dY,
                                      int actionState, boolean isCurrentlyActive) {
      Severity: Major
      Found in app/src/main/java/com/futsch1/medtimer/helpers/SwipeHelper.java - About 50 mins to fix

        Method clearCanvas has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private void clearCanvas(Canvas c, float left, float top, float right, float bottom) {
        Severity: Minor
        Found in app/src/main/java/com/futsch1/medtimer/helpers/SwipeHelper.java - About 35 mins to fix

          Method schedule has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected void schedule(Instant timestamp, int reminderId, String medicineName, int requestCode, int reminderEventId) {
          Severity: Minor
          Found in app/src/main/java/com/futsch1/medtimer/reminders/RescheduleWork.java - About 35 mins to fix

            Method doWork has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                @NonNull
                @Override
                public Result doWork() {
                    Result r = Result.failure();
                    Log.i(LogTags.REMINDER, "Do reminder work");
            Severity: Minor
            Found in app/src/main/java/com/futsch1/medtimer/reminders/ReminderWork.java - About 25 mins 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

            Severity
            Category
            Status
            Source
            Language