rob729 / Quiet_Hours

No more trouble to make silent mode ON/OFF manually every time.
3 stars 9 forks source link

Code Refactored #75

Closed coder2699 closed 4 years ago

coder2699 commented 4 years ago

Fixes #73

Changes (24 Issues Fixed): 1) Method onChildDraw has 29 lines of code (exceeds 25 allowed). Consider refactoring. FIXED 2) Method doWork has 32 lines of code (exceeds 25 allowed). Consider refactoring. FIXED 3) Method setStartAlarm has 35 lines of code (exceeds 25 allowed). Consider refactoring. FIXED 4) Method onOptionsItemSelected has 39 lines of code (exceeds 25 allowed). Consider refactoring. FIXED 5) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 6) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 7) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 8) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 9) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 10) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 11) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 12) Similar blocks of code found in 6 locations. Consider refactoring. FIXED 13) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 14) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 15) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 16) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 17) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 18) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 19) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 20) Identical blocks of code found in 2 locations. Consider refactoring. FIXED 21) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 22) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 23) Similar blocks of code found in 2 locations. Consider refactoring. FIXED 24) Similar blocks of code found in 2 locations. Consider refactoring. FIXED

coder2699 commented 4 years ago

@rob729 Please review my PR, before the Deadline Ends (12 noon)

rob729 commented 4 years ago

@coder2699 Where it is mentioned that 12PM is the deadline today?

coder2699 commented 4 years ago

@rob729 I have tried my best to fix all this. But still if any small modification is left, I will do it. Please allot the points since after noon they won't be considered

coder2699 commented 4 years ago

@coder2699 Where it is mentioned that 12PM is the deadline today?

@rob729 In the mail they sent

rob729 commented 4 years ago

@coder2699 According to the leaderboard the 75 points won't make any difference in your position. Do you still want me to assign the points now?

coder2699 commented 4 years ago

@coder2699 According to the leaderboard the 75 points won't make any difference in your position. Do you still want me to assign the points now?

@rob729 Yeah right now it won't. But if possible you please give Maybe in re evaluation some points could get changed of other participants

rob729 commented 4 years ago

give @coder2699 75 points

coder2699 commented 4 years ago

give @coder2699 75 points

@rob729 Thanks, if any modification is still required I will do it. Please let me know

rob729 commented 4 years ago

@coder2699 Do formatting in every file where changes are made using Ctrl+atl+L and push the changes.

coder2699 commented 4 years ago

@coder2699 Do formatting in every file where changes are made using Ctrl+atl+L and push the changes.

@rob729 I will make the changes and push the code after resolving the merge conflicts

rob729 commented 4 years ago

@coder2699 Just want to inform you that this PR has to be merged by 11:59 PM IST today for the points assigned for this PR to be counted.

coder2699 commented 4 years ago

@coder2699 Just want to inform you that this PR has to be merged by 11:59 PM IST today for the points assigned for this PR to be counted.

@rob729 On it. Thanks that you informed.

coder2699 commented 4 years ago

@rob729 codeclimate is considering setStringFormat() as an issue. But it is a function that is used at 4 places. Shall I leave it as it is or remove it? On removing it codeclimate will show other code repetitions that were overcome using setStringFormat

coder2699 commented 4 years ago

@rob729 Kindly have a look at the PR

rob729 commented 4 years ago

@coder2699 The current implementation is fine.

rob729 commented 4 years ago

Have you tested if the app is working fine after code refactoring?

coder2699 commented 4 years ago

Have you tested if the app is working fine after code refactoring?

@rob729 Yes I ran the app on my emulator. It was working fine without any crashing/error. CI Travis is taking really long, although the same code passed the CI travis in the morning in lesser time

coder2699 commented 4 years ago

Shall I push again?

rob729 commented 4 years ago

No need to push again. Can you once check on your device if the profiles are working as expected? On my device, the profiles are not working.

rob729 commented 4 years ago

@coder2699 For the codeclimate issue you can try this approach: You can make an extension function of EditText. Like fun EditText.setTimeText() in Utils.kt. This function will already have the reference of the EditText. So you can directly call functions like setText() and in the newProfileFragment you call function like binding.EndTime.setTimeText(). This approach should fix 2 of the issues highlighted in the codeclimate.

coder2699 commented 4 years ago

@coder2699 For the codeclimate issue you can try this approach: You can make an extension function of EditText. Like fun EditText.setTimeText() in Utils.kt. This function will already have the reference of the EditText. So you can directly call functions like setText() and in the newProfileFragment you call function like binding.EndTime.setTimeText(). This approach should fix 2 of the issues highlighted in the codeclimate.

Implemented, but seems even this does not fixed it

coder2699 commented 4 years ago

@rob729 Utils.kt approach tested & applied.

rob729 commented 4 years ago

@coder2699 For the codeclimate issue you can try this approach: You can make an extension function of EditText. Like fun EditText.setTimeText() in Utils.kt. This function will already have the reference of the EditText. So you can directly call functions like setText() and in the newProfileFragment you call function like binding.EndTime.setTimeText(). This approach should fix 2 of the issues highlighted in the codeclimate.

Implemented, but seems even this does not fixed it

It's Okay. Don't worry about this.

rob729 commented 4 years ago

@coder2699 Is the profile feature working properly now?

coder2699 commented 4 years ago

@coder2699 Is the profile feature working properly now?

@rob729 I have tested that on set time, audio profile is changing and notification is also coming and on ending it goes

rob729 commented 4 years ago

Okay.