freddi301/flow-validator

View on GitHub

Showing 30 of 207 total issues

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

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

    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

      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

        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

            Function toDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              toDate(): Type<Date> {
                const dt = new Type("date", v => {
                  const s = string.parse(v);
                  const date: Date = new Date(s);
                  if (Object.prototype.toString.call(date) === "[object Date]") {
            Severity: Minor
            Found in src/sync/string.js - About 35 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 isValidDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              isValidDate(): StringType {
                const dt = new StringType(v => {
                  const s = string.parse(v);
                  const date: Date = new Date(s);
                  if (Object.prototype.toString.call(date) === "[object Date]") {
            Severity: Minor
            Found in src/sync/string.js - About 35 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 match has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function match(...patterns) {
              const v: mixed = patterns[0];
              for (let i = 1; i < patterns.length; i += 2) {
                const t: Type<mixed> = patterns[i];
                const f: Function = patterns[i + 1];
            Severity: Minor
            Found in src/sync/match.js - 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