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;
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()) {
- 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 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)) {
- 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 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()) {
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;
- 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 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)) {
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()));
- 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
Avoid too many return
statements within this method. Open
return backTo(context, route);
Avoid too many return
statements within this method. Open
return false;
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);
- 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 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;
- 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 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()) {
- 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"