FireZenk/Naviganto

View on GitHub

Showing 19 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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      for (Element element :  env.getElementsAnnotatedWith(RoutableView.class)) {
                          JavaFile javaFile = this.generateRoute((TypeElement) element);
                          try {
                              javaFile.writeTo(filer);
                          } catch (Exception e) {
              processor/src/main/java/org/firezenk/naviganto/processor/RouteProcessor.java on lines 66..74

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 66.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      for (Element element :  env.getElementsAnnotatedWith(RoutableActivity.class)) {
                          JavaFile javaFile = this.generateRoute((TypeElement) element);
                          try {
                              javaFile.writeTo(filer);
                          } catch (Exception e) {
              processor/src/main/java/org/firezenk/naviganto/processor/RouteProcessor.java on lines 76..84

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 66.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              package org.firezenk.naviganto.sample.profile;
              
              import android.content.Context;
              import android.os.Bundle;
              import android.support.annotation.NonNull;
              sample/src/main/java/org/firezenk/naviganto/sample/info/InfoRoute.java on lines 1..31

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 48.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              package org.firezenk.naviganto.sample.info;
              
              import android.content.Context;
              import android.os.Bundle;
              import android.support.annotation.NonNull;
              sample/src/main/java/org/firezenk/naviganto/sample/profile/ProfileRoute.java on lines 1..31

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 48.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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 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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language