Codibre/fluent-iterable

View on GitHub

Showing 35 of 90 total issues

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

export interface AsyncFlatJoinFunction<T> {
  /**
   * This operation flattens the whole informed path into a flat object.
   * Each informed param must be the name of a field in the path, the field being an iterable or not
   * If the name of a property appears twice in the path, the resulting object will have only the value of the first one
Severity: Major
Found in src/types/function-types/flat-join-function.ts and 1 other location - About 6 days to fix
src/types/function-types/flat-join-function.ts on lines 69..177

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

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

export interface FlatJoinFunction<T> {
  /**
   * This operation flattens the whole informed path into a flat object.
   * Each informed param must be the name of a field in the path, the field being an iterable or not
   * If the name of a property appears twice in the path, the resulting object will have only the value of the first one
Severity: Major
Found in src/types/function-types/flat-join-function.ts and 1 other location - About 6 days to fix
src/types/function-types/flat-join-function.ts on lines 179..287

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

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

File flat-join-function.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  tail,
  head,
  AsyncItemOrSelfType,
  FluentAsyncIterable,
Severity: Minor
Found in src/types/function-types/flat-join-function.ts - About 2 hrs to fix

    Function getStatsStepper has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getStatsStepper() {
      const avgStepper = getAverageStepper();
      const minMaxStepper = getMinMaxStepper();
      let variance: number | undefined;
      let lastVarianceCount = 0;
    Severity: Minor
    Found in src/utils/get-stats-stepper.ts - About 1 hr to fix

      Function getGroupingTopHit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getGroupingTopHit<K, T, NewT = T>(
        distinct: AnyMapper<T> | Choose<NewT>,
        choose?: Choose<NewT>,
        mapper: Mapper<T, NewT> | keyof T = identity as any,
      ): KVGroupTransform<K, T, NewT> {
      Severity: Minor
      Found in src/utils/get-grouping-top-hit.ts - About 1 hr to fix

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

        export interface DistinctByFunction<T> {
          /**
           * Returns distinct elements from the iterable from a certain list of projections<br>
           *   Examples:<br>
           *     * `fluent([{ a: 1, b: 2, c: 1}, { a: 1, b: 2, c: 2}]).distinct()` yields *{ a: 1, b: 2, c: 1 }*<br>
        Severity: Major
        Found in src/types/function-types/distinct-by-function.ts and 1 other location - About 1 hr to fix
        src/types/function-types/distinct-by-function.ts on lines 15..25

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

        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

        export interface AsyncDistinctByFunction<T> {
          /**
           * Returns distinct elements from the iterable from a certain list of projections<br>
           *   Examples:<br>
           *     * `fluent([{ a: 1, b: 2, c: 1}, { a: 1, b: 2, c: 2}]).distinct()` yields *{ a: 1, b: 2, c: 1 }*<br>
        Severity: Major
        Found in src/types/function-types/distinct-by-function.ts and 1 other location - About 1 hr to fix
        src/types/function-types/distinct-by-function.ts on lines 4..14

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

        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

        Function distinctRecipe has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function distinctRecipe(ingredients: DistinctIngredients) {
          const ordered = orderedDistinctRecipe(ingredients);
          const choose = chooseDistinctRecipe(ingredients);
          const { filterOrAll, resolver } = ingredients;
        
        
        Severity: Minor
        Found in src/recipes/distinct-recipe.ts - About 1 hr to fix

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

          export interface KVGroupTransform<K, V, NewV = V> {
            (key: K, value: V, previous: NewV[]): Iterable<NewV> | undefined;
          }
          Severity: Major
          Found in src/types/base.ts and 1 other location - About 1 hr to fix
          src/types/base.ts on lines 267..269

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

          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

          export interface AsyncKVGroupTransform<K, V, NewV = V> {
            (key: K, value: V, previous: NewV[]): AnyIterable<NewV> | undefined;
          }
          Severity: Major
          Found in src/types/base.ts and 1 other location - About 1 hr to fix
          src/types/base.ts on lines 263..265

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

          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

          Function groupRecipe has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function groupRecipe(ingredients: GroupIngredients) {
            const orderedGroup = orderedGroupRecipe(ingredients);
            const { reduceAndMap, resolver, iterate, forEach } = ingredients;
            return function <T>(
              this: AnyIterable<T>,
          Severity: Minor
          Found in src/recipes/group-recipe.ts - About 1 hr to fix

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

            export type AsyncItemOrSelfType<T> = T extends string
              ? T
              : T extends AnyIterable<infer R>
                ? AsyncItemOrSelfType<R>
                : T;
            Severity: Major
            Found in src/types/base.ts and 1 other location - About 1 hr to fix
            src/types/base.ts on lines 30..34

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

            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

            export type ItemOrSelfType<T> = T extends string
              ? T
              : T extends Iterable<infer R>
                ? ItemOrSelfType<R>
                : T;
            Severity: Major
            Found in src/types/base.ts and 1 other location - About 1 hr to fix
            src/types/base.ts on lines 44..48

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

            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

            Function distinct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              return function distinct<T>(
                this: AnyIterable<T>,
                mappers: FunctionAnyMapper<any>[],
              ) {
                const { length } = mappers;
            Severity: Minor
            Found in src/recipes/distinct-by-recipe.ts - About 1 hr to fix

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

              async function* iterateAllAsync<T>(a: AsyncIterable<AnyIterable<T>>) {
                for await (const it of a) {
                  yield* it;
                }
              }
              Severity: Minor
              Found in src/utils/utils.ts and 1 other location - About 55 mins to fix
              src/utils/utils.ts on lines 102..106

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

              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

              function* iterateAll<T>(a: Iterable<Iterable<T>>) {
                for (const it of a) {
                  yield* it;
                }
              }
              Severity: Minor
              Found in src/utils/utils.ts and 1 other location - About 55 mins to fix
              src/utils/utils.ts on lines 74..78

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

              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

              export function desc<F>(f: F): F {
                return assureOrderDescending(
                  (isValueType(f) ? { [valueTypeWrapper]: f } : f) as any,
                );
              }
              Severity: Minor
              Found in src/utils/utils.ts and 1 other location - About 55 mins to fix
              src/utils/utils.ts on lines 312..314

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

              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

              export function asc<F>(f: F): F {
                return assureOrder((isValueType(f) ? { [valueTypeWrapper]: f } : f) as any);
              }
              Severity: Minor
              Found in src/utils/utils.ts and 1 other location - About 55 mins to fix
              src/utils/utils.ts on lines 320..324

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

              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 4 locations. Consider refactoring.
              Open

              function distinctSyncRecipe(filterOrAll: Ingredient | ResolverIngredient) {
                return distinctRecipe({
                  ...basic,
                  partition,
                  filterOrAll,
              Severity: Major
              Found in src/sync/distinct.ts and 3 other locations - About 50 mins to fix
              src/async/distinct-async.ts on lines 10..18
              src/async/distinct-by-async.ts on lines 9..17
              src/sync/distinct-by.ts on lines 9..17

              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 4 locations. Consider refactoring.
              Open

              function distinctAsyncRecipe(filterOrAll: Ingredient | ResolverIngredient) {
                return distinctRecipe({
                  ...basicAsync,
                  partition: partitionAsync,
                  filterOrAll,
              Severity: Major
              Found in src/async/distinct-async.ts and 3 other locations - About 50 mins to fix
              src/async/distinct-by-async.ts on lines 9..17
              src/sync/distinct-by.ts on lines 9..17
              src/sync/distinct.ts on lines 10..18

              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

              Severity
              Category
              Status
              Source
              Language