Showing 29 of 72 total issues
File FileStorageDatabase.java
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.steroidteam.todolist.database;
import static com.github.steroidteam.todolist.util.Utils.checkNonNullArgs;
import androidx.annotation.NonNull;
FileStorageDatabase
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class FileStorageDatabase implements Database {
private static final String TODO_LIST_PATH = "/todo-lists/";
private static final String NOTES_PATH = "/notes/";
private static final String AUDIO_MEMOS_PATH = "/audio-memos/";
private static final String TAGS_PATH = "/tags/";
Database
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public interface Database {
/**
* Returns the unique to-do list collection of the current user
*
File NoteDisplayFragment.java
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.steroidteam.todolist.view;
import static com.github.steroidteam.todolist.util.Utils.getRoundedBitmap;
import static com.github.steroidteam.todolist.view.NoteSelectionFragment.NOTE_ID_KEY;
File ItemViewFragment.java
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.steroidteam.todolist.view;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
File TodoListRepository.java
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.steroidteam.todolist.database;
import android.content.Context;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
TodoListRepository
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class TodoListRepository {
private final Database localDatabase;
private final Database remoteDatabase;
Method isInCategory
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
private boolean isInCategory(Task task, int category) {
Date dueDate = task.getDueDate();
if (task.isDone() && category == TASK_DONE) {
return 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 onCreateView
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public View onCreateView(
@NonNull @NotNull LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
Method onChildDraw
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public void onChildDraw(
Canvas c,
RecyclerView recyclerView,
RecyclerView.ViewHolder holder,
Method syncData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void syncData() {
this.remoteDatabase
.getNotesList()
.thenCombine(
this.localDatabase.getNotesList(),
Method onCreateView
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Method updateHeader
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void updateHeader(Optional<UUID> optionalUUID) {
ConstraintLayout header = getView().findViewById(R.id.note_header);
if (optionalUUID.isPresent()) {
Method isInCategory
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private boolean isInCategory(Task task, int category) {
Date dueDate = task.getDueDate();
if (task.isDone() && category == TASK_DONE) {
return true;
Method init
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void init() {
localTags = viewModel.getTagsFromList();
if (localTags == null) {
localTags = new ArrayList<>();
}
Method setButtonFocus
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setButtonFocus(int indexButtonFocus) {
setButtonBackground();
switch (indexButtonFocus) {
Method onCreateDialog
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = this.getLayoutInflater();
View dialogLayout = inflater.inflate(R.layout.auth_dialog, null);
Method setHeaderNote
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public CompletableFuture<Void> setHeaderNote(UUID noteID, String imagePath, UUID imageID)
throws FileNotFoundException {
Objects.requireNonNull(noteID);
Objects.requireNonNull(imagePath);
Method storeDrawing
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void storeDrawing() {
String tmpFileName = "bitmap_tmp_" + UUID.randomUUID().toString() + ".png";
File tmpFile =
new File(
Environment.getExternalStoragePublicDirectory(
Method setRequestPermissionLauncher
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setRequestPermissionLauncher() {
this.requestPermissionLauncher =
registerForActivityResult(
new ActivityResultContracts.RequestMultiplePermissions(),
result -> {