maoni/src/main/java/org/rm3l/maoni/Maoni.java

Summary

Maintainability
D
3 days
Test Coverage

File Maoni.java has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2016-2022 Armel Soro
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
Severity: Major
Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 1 day to fix

    Builder has 37 methods (exceeds 20 allowed). Consider refactoring.
    Open

        public static class Builder {
    
            @Nullable
            private final Context context;
    
    
    Severity: Minor
    Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

      Method start has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          private void start(Activity callerActivity, Window window) {
              if (mUsed.getAndSet(true)) {
                  this.clear();
                  throw new UnsupportedOperationException(
                          "Maoni instance cannot be reused to start a new activity. " +
      Severity: Minor
      Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs 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

      Method start has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void start(Activity callerActivity, Window window) {
              if (mUsed.getAndSet(true)) {
                  this.clear();
                  throw new UnsupportedOperationException(
                          "Maoni instance cannot be reused to start a new activity. " +
      Severity: Major
      Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 4 hrs to fix

        Method withSharedPreferences has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                public Builder withSharedPreferences(@Nullable final Map<String, Integer> sharedPreferencesModeMap) {
                    if (sharedPreferencesModeMap == null || sharedPreferencesModeMap.isEmpty()) {
                        return this;
                    }
                    if (this.context == null) {
        Severity: Minor
        Found in maoni/src/main/java/org/rm3l/maoni/Maoni.java - About 55 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

        There are no issues that match your filters.

        Category
        Status