freddi301/flow-validator

View on GitHub

Showing 207 of 207 total issues

Function Vmapping has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Vmapping<K: string, V>(
  keys: VType<K>,
  values: VType<V>
): VMappingType<K, V> {
  const m = new VMappingType(keys, values, v => {
Severity: Minor
Found in src/sync/Vmapping.js - About 1 hr to fix

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

            try {
              await s[key].validate(o[key]);
            } catch (e) {
              if (e instanceof ValidationError) errors[key] = e;
              else throw e;
    Severity: Major
    Found in src/async/asyncVobject.js and 1 other location - About 1 hr to fix
    src/async/asyncVobjectExact.js on lines 33..38

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

    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

              try {
                await s[key].validate(o[key]);
              } catch (e) {
                if (e instanceof ValidationError) errors[key] = e;
                else throw e;
    Severity: Major
    Found in src/async/asyncVobjectExact.js and 1 other location - About 1 hr to fix
    src/async/asyncVobject.js on lines 27..32

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

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

      const m = new AsyncVMappingType(keys, values, async v => {
        const o = objectType.validate(v);
        const ks = Object.keys(o);
        const errors = {};
        await Promise.all(
    Severity: Minor
    Found in src/async/asyncVmapping.js - About 1 hr to fix

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

              throw: <E>(
                  err: Class<E> | Error | RegExp | string,
                  errMsgMatcher?: RegExp | string,
                  msg?: string) => ExpectChain<T>,
      Severity: Major
      Found in flow-typed/npm/chai_v3.5.x.js and 1 other location - About 1 hr to fix
      flow-typed/npm/chai_v4.x.x.js on lines 61..65

      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

          throw: <E>(
            err?: Class<E> | Error | RegExp | string,
            errMsgMatcher?: RegExp | string,
            msg?: string
          ) => ExpectChain<T>,
      Severity: Major
      Found in flow-typed/npm/chai_v4.x.x.js and 1 other location - About 1 hr to fix
      flow-typed/npm/chai_v3.5.x.js on lines 59..62

      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

              try {
                return await t.parse(item);
              } catch (e) {
                if (e instanceof ValidationError) {
                  errors[String(index)] = (e: ValidationError);
      Severity: Major
      Found in src/async/asyncArrayOf.js and 1 other location - About 1 hr to fix
      src/async/asyncTuple.js on lines 55..62

      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

              try {
                return await t.parse(a[i]);
              } catch (e) {
                if (e instanceof ValidationError) {
                  errors[String(i)] = (e: ValidationError);
      Severity: Major
      Found in src/async/asyncTuple.js and 1 other location - About 1 hr to fix
      src/async/asyncArrayOf.js on lines 22..29

      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

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

              try {
                s[key].validate(o[key]);
              } catch (e) {
                if (e instanceof ValidationError) errors[key] = e;
                else throw e;
      Severity: Major
      Found in src/sync/VobjectExact.js and 1 other location - About 1 hr to fix
      src/sync/Vobject.js on lines 15..20

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

      declare function Vtuple<A, B>(types: [VType<A>, VType<B>]): VTupleType<[A, B]>; // eslint-disable-line no-redeclare
      Severity: Major
      Found in src/sync/tuple.js and 3 other locations - About 1 hr to fix
      src/async/asyncTuple.js on lines 41..43
      src/async/asyncTuple.js on lines 108..110
      src/sync/tuple.js on lines 23..23

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

      declare function asyncVtuple<A, B>(
        types: [AsyncVType<A>, AsyncVType<B>]
      ): AsyncVTupleType<[A, B]>; // eslint-disable-line no-redeclare
      Severity: Major
      Found in src/async/asyncTuple.js and 3 other locations - About 1 hr to fix
      src/async/asyncTuple.js on lines 41..43
      src/sync/tuple.js on lines 23..23
      src/sync/tuple.js on lines 62..62

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

      declare function tuple<A, B>(types: [Type<A>, Type<B>]): TupleType<[A, B]>; // eslint-disable-line no-redeclare
      Severity: Major
      Found in src/sync/tuple.js and 3 other locations - About 1 hr to fix
      src/async/asyncTuple.js on lines 41..43
      src/async/asyncTuple.js on lines 108..110
      src/sync/tuple.js on lines 62..62

      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

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

            try {
              s[key].validate(o[key]);
            } catch (e) {
              if (e instanceof ValidationError) errors[key] = e;
              else throw e;
      Severity: Major
      Found in src/sync/Vobject.js and 1 other location - About 1 hr to fix
      src/sync/VobjectExact.js on lines 21..26

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

      declare function asyncTuple<A, B>(
        types: [AsyncType<A>, AsyncType<B>]
      ): AsyncTupleType<[A, B]>; // eslint-disable-line no-redeclare
      Severity: Major
      Found in src/async/asyncTuple.js and 3 other locations - About 1 hr to fix
      src/async/asyncTuple.js on lines 108..110
      src/sync/tuple.js on lines 23..23
      src/sync/tuple.js on lines 62..62

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

        const m = new VMappingType(keys, values, v => {
          const o = objectType.validate(v);
          const ks = Object.keys(o);
          const errors = {};
          for (const key of ks) {
      Severity: Minor
      Found in src/sync/Vmapping.js - About 1 hr to fix

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

        export function asyncObjectExact<S: { [key: string]: AsyncType<any> }>(
          s: S
        ): AsyncObjectExactType<S, $Exact<$ObjMap<S, <F>(v: AsyncType<F>) => F>>> {
          const oes = new AsyncObjectExactType(s, async v => {
            const o = objectType.validate(await v);
        Severity: Minor
        Found in src/async/asyncObjectExact.js - About 1 hr to fix

          Function asyncTuple has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export function asyncTuple<S: Array<AsyncType<any>>>(
            s: S
          ): AsyncTupleType<$TupleMap<S, <T>(v: AsyncType<T>) => T>> {
            // eslint-disable-line no-redeclare
            const tt = new AsyncTupleType(s, async v => {
          Severity: Minor
          Found in src/async/asyncTuple.js - About 55 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

          Function asyncArrayOf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export function asyncArrayOf<T>(t: AsyncType<T>): AsyncArrayOfType<T> {
            const aof = new AsyncArrayOfType(t, async v => {
              const a = arrayType.validate(v);
              const errors: Errors = {};
              const result: Array<T> = await Promise.all(
          Severity: Minor
          Found in src/async/asyncArrayOf.js - About 55 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 4 locations. Consider refactoring.
          Open

          export function asyncObjectExact<S: { [key: string]: AsyncType<any> }>(
            s: S
          ): AsyncObjectExactType<S, $Exact<$ObjMap<S, <F>(v: AsyncType<F>) => F>>> {
            const oes = new AsyncObjectExactType(s, async v => {
              const o = objectType.validate(await v);
          Severity: Major
          Found in src/async/asyncObjectExact.js and 3 other locations - About 45 mins to fix
          src/async/asyncVobjectExact.js on lines 18..46
          src/sync/VobjectExact.js on lines 7..33
          src/sync/objectExact.js on lines 7..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 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

            constructor(left: (v: T) => T2, right: Type<T>) {
              super("compound", v => left(right.parse(v)));
              this.left = left;
              this.right = right;
            }
          Severity: Minor
          Found in src/sync/Type.js and 1 other location - About 45 mins to fix
          src/sync/Type.js on lines 202..206

          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

          Severity
          Category
          Status
          Source
          Language