kschuetz/enhanced-iterables

View on GitHub
src/main/java/software/kes/enhancediterables/EnhancedIterables.java

Summary

Maintainability
D
2 days
Test Coverage

EnhancedIterables has 49 methods (exceeds 20 allowed). Consider refactoring.
Open

final class EnhancedIterables {
    private static final ImmutableFiniteIterable<?> EMPTY = () -> protectedIterator(Collections.emptyIterator());

    private EnhancedIterables() {
    }
Severity: Minor
Found in src/main/java/software/kes/enhancediterables/EnhancedIterables.java - About 6 hrs to fix

    File EnhancedIterables.java has 343 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package software.kes.enhancediterables;
    
    import com.jnape.palatable.lambda.adt.Maybe;
    import com.jnape.palatable.lambda.functions.builtin.fn1.Cycle;
    import com.jnape.palatable.lambda.functions.builtin.fn1.Distinct;
    Severity: Minor
    Found in src/main/java/software/kes/enhancediterables/EnhancedIterables.java - About 4 hrs to fix

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

          static <A> NonEmptyIterable<A> unsafeNonEmptyIterable(Iterable<A> underlying) {
              if (underlying instanceof NonEmptyIterable<?>) {
                  return (NonEmptyIterable<A>) underlying;
              } else if (underlying instanceof Collection<?>) {
                  return NonEmptyCollectionWrapper.wrap((Collection<A>) underlying);
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 152..162

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

      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

          static <A> ImmutableNonEmptyIterable<A> unsafeImmutableNonEmptyIterable(Iterable<A> underlying) {
              if (underlying instanceof ImmutableNonEmptyIterable<?>) {
                  return (ImmutableNonEmptyIterable<A>) underlying;
              } else if (underlying instanceof Collection<?>) {
                  return ImmutableNonEmptyCollectionWrapper.wrap((Collection<A>) underlying);
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 140..150

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

      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

          static <A> Maybe<NonEmptyFiniteIterable<A>> nonEmptyMaybeFinite(A head, Iterable<A> tail) {
              if (tail instanceof FiniteIterable<?>) {
                  return just(nonEmptyFiniteIterable(head, (FiniteIterable<A>) tail));
              } else if (tail instanceof Collection<?>) {
                  return just(nonEmptyFiniteIterable(head, finiteIterable(tail)));
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 106..114

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

      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

          static <A> Maybe<ImmutableNonEmptyFiniteIterable<A>> immutableNonEmptyMaybeFinite(A head, Iterable<A> tail) {
              if (tail instanceof ImmutableFiniteIterable<?>) {
                  return just(immutableNonEmptyFiniteIterable(head, (ImmutableFiniteIterable<A>) tail));
              } else if (tail instanceof Collection<?>) {
                  return just(immutableNonEmptyFiniteIterable(head, immutableFiniteIterable(tail)));
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 86..94

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

      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

          static <A> EnhancedIterable<A> enhance(Iterable<A> underlying) {
              requireNonNull(underlying);
              if (underlying instanceof EnhancedIterable<?>) {
                  return (EnhancedIterable<A>) underlying;
              } else if (underlying instanceof Collection<?>) {
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 55..64

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

      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

          static <A> ImmutableIterable<A> immutableIterable(Iterable<A> underlying) {
              requireNonNull(underlying);
              if (underlying instanceof ImmutableIterable<?>) {
                  return (ImmutableIterable<A>) underlying;
              } else if (underlying instanceof Collection<?>) {
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 33..42

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

      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

          static <A> Maybe<FiniteIterable<A>> maybeFinite(Iterable<A> iterable) {
              if (iterable instanceof FiniteIterable<?>) {
                  return just((FiniteIterable<A>) iterable);
              } else if (iterable instanceof Collection<?>) {
                  return just(finiteIterableFromCollection((Collection<A>) iterable));
      src/main/java/software/kes/enhancediterables/EnhancedIterables.java on lines 96..104

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

      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

          static <A> Maybe<ImmutableFiniteIterable<A>> immutableMaybeFinite(Iterable<A> iterable) {
              if (iterable instanceof ImmutableFiniteIterable<?>) {
                  return just((ImmutableFiniteIterable<A>) iterable);
              } else if (iterable instanceof Collection<?>) {
                  return just(immutableFiniteIterableFromCollection((Collection<A>) iterable));
      src/main/java/software/kes/enhancediterables/EnhancedIterables.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 44.

      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

      There are no issues that match your filters.

      Category
      Status