FireZenk/Naviganto

View on GitHub

Showing 15 of 19 total issues

Method addRouteMethod has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private MethodSpec addRouteMethod(TypeElement typeElement) {
        messager.printMessage(Diagnostic.Kind.NOTE, "Generating route method");

        boolean isActivity;
        int requestCode;

    Naviganto has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Naviganto<C> implements INaviganto<C> {
    
        private static Consumer<String> LOGGING_READER = null;
        private static Naviganto INSTANCE;
        private static Boolean DEBUG = Boolean.FALSE;
    Severity: Minor
    Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 2 hrs to fix

      Method backTo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override public <C> boolean backTo(@Nonnull C context, @Nonnull Route route) {
              if (history.isEmpty()) {
                  print("Is not possible to go back, history is empty");
                  return false;
              } else if (history.get(getHistoryLast()).viewHistory.isEmpty()) {
      Severity: Minor
      Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 2 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 parametersToBundle has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private String parametersToBundle(List<TypeMirror> params) {
              final StringBuilder sb = new StringBuilder();
      
              int i = 0;
              for (TypeMirror tm : params) {

        Method onCreate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.detail_activity);
        
                final ViewGroup placeholder = (ViewGroup) findViewById(R.id.placeholder);

          Method routeTo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override @SuppressWarnings("unchecked") public <C> void routeTo(@Nonnull C context, @Nonnull Route route) {
                  final Route prev = history.isEmpty() ? null : history.get(history.size() - 1).viewHistory.peek();
                  try {
                      if (prev == null || route.viewParent == null || !areRoutesEqual(prev, route)) {
          
          
          Severity: Minor
          Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 1 hr 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 backTo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override public <C> boolean backTo(@Nonnull C context, @Nonnull Route route) {
                  if (history.isEmpty()) {
                      print("Is not possible to go back, history is empty");
                      return false;
                  } else if (history.get(getHistoryLast()).viewHistory.isEmpty()) {
          Severity: Minor
          Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 1 hr to fix

            Method addRouteMethod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                private MethodSpec addRouteMethod(TypeElement typeElement) {
                    messager.printMessage(Diagnostic.Kind.NOTE, "Generating route method");
            
                    boolean isActivity;
                    int requestCode;

            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 routeTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override @SuppressWarnings("unchecked") public <C> void routeTo(@Nonnull C context, @Nonnull Route route) {
                    final Route prev = history.isEmpty() ? null : history.get(history.size() - 1).viewHistory.peek();
                    try {
                        if (prev == null || route.viewParent == null || !areRoutesEqual(prev, route)) {
            
            
            Severity: Minor
            Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 1 hr to fix

              Method log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private ArrayList<ComplexRoute> log(String actionDesc, ArrayList<ComplexRoute> history) {
                      if (DEBUG) {
                          if (history.size() > 0 && history.get(getHistoryLast()) != null) {
                              print(actionDesc + "size: " + history.size());
                              print(actionDesc + "last: " + history.get(getHistoryLast()));
              Severity: Minor
              Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 45 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

              Avoid too many return statements within this method.
              Open

                          return backTo(context, route);
              Severity: Major
              Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.java - About 30 mins to fix

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

                      @Override public <C> boolean back(@Nonnull C context) {
                          log(" <<--- Back");
                          log(" History: ", history);
                  
                          if (history.isEmpty()) {
                  Severity: Minor
                  Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.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

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

                      @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
                          for (Element element :  env.getElementsAnnotatedWith(RoutableActivity.class)) {
                              JavaFile javaFile = this.generateRoute((TypeElement) element);
                              try {
                                  javaFile.writeTo(filer);

                  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 backTimes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override public <C> boolean backTimes(@Nonnull C context, @Nonnull Integer times) {
                          try {
                              for (int i = 0; i < times; i++) {
                                  if (!back(context)) {
                                      return false;
                  Severity: Minor
                  Found in library/src/main/java/org/firezenk/naviganto/library/Naviganto.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