epoberezkin/ajv

View on GitHub

Showing 215 of 215 total issues

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

  function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject {
    return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch
  }
Severity: Minor
Found in lib/refs/json-schema-2020-12/index.ts and 1 other location - About 35 mins to fix
lib/refs/json-schema-2019-09/index.ts on lines 25..27

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

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(opts: Options = {}) {
    super({
      ...opts,
      dynamicRef: true,
      next: true,
Severity: Minor
Found in lib/2020.ts and 1 other location - About 35 mins to fix
lib/2019.ts on lines 14..21

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

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

      gen
        .assign(data, _`${data}[0]`)
        .assign(dataType, _`typeof ${data}`)
Severity: Minor
Found in lib/compile/validate/dataType.ts and 1 other location - About 30 mins to fix
lib/vocabularies/format/format.ts on lines 53..53

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

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

Avoid too many return statements within this function.
Open

  return getJsonPointer.call(this, p, schOrRef)
Severity: Major
Found in lib/compile/index.ts - About 30 mins to fix

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

    suite.add("JTD test suite: JSON.parse + validate", () => {
      for (const test of tests) {
        JSON.parse(test.json)
      }
    })
    Severity: Minor
    Found in benchmark/jtd.js and 2 other locations - About 30 mins to fix
    benchmark/jtd.js on lines 69..73
    benchmark/jtd.js on lines 75..79

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

    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

    Avoid too many return statements within this function.
    Open

        return
    Severity: Major
    Found in lib/compile/codegen/code.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return
      Severity: Major
      Found in lib/compile/codegen/code.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return str
        Severity: Major
        Found in lib/runtime/parseJson.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return undefined
          Severity: Major
          Found in lib/compile/index.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return +numStr
            Severity: Major
            Found in lib/runtime/parseJson.ts - About 30 mins to fix

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

                render({_n}: CGOptions): string {
                  return `${this.code};` + _n
                }
              Severity: Minor
              Found in lib/compile/codegen/index.ts and 2 other locations - About 30 mins to fix
              lib/compile/codegen/index.ts on lines 115..117
              lib/compile/codegen/index.ts on lines 137..139

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

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

              suite.add("JTD test suite: JSON.parse", () => {
                for (const test of tests) {
                  JSON.parse(test.json)
                }
              })
              Severity: Minor
              Found in benchmark/jtd.js and 2 other locations - About 30 mins to fix
              benchmark/jtd.js on lines 69..73
              benchmark/jtd.js on lines 81..85

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

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

              suite.add("JTD test suite: compiled JTD parsers", () => {
                for (const test of tests) {
                  test.parse(test.json)
                }
              })
              Severity: Minor
              Found in benchmark/jtd.js and 2 other locations - About 30 mins to fix
              benchmark/jtd.js on lines 75..79
              benchmark/jtd.js on lines 81..85

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

              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

              const def: CodeKeywordDefinition = {
                keyword: "union",
                schemaType: "array",
                trackErrors: true,
                code: validateUnion,
              Severity: Minor
              Found in lib/vocabularies/jtd/union.ts and 1 other location - About 30 mins to fix
              lib/vocabularies/applicator/anyOf.ts on lines 6..12

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

              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

              const def: CodeKeywordDefinition = {
                keyword: "anyOf",
                schemaType: "array",
                trackErrors: true,
                code: validateUnion,
              Severity: Minor
              Found in lib/vocabularies/applicator/anyOf.ts and 1 other location - About 30 mins to fix
              lib/vocabularies/jtd/union.ts on lines 4..10

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

              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

              Avoid too many return statements within this function.
              Open

                if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}`
              Severity: Major
              Found in lib/compile/codegen/code.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return
                Severity: Major
                Found in lib/compile/validate/dataType.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return undefined
                  Severity: Major
                  Found in lib/runtime/parseJson.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        if (cond === false || !this.nodes.length) return undefined
                    Severity: Major
                    Found in lib/compile/codegen/index.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return this
                      Severity: Major
                      Found in lib/compile/codegen/index.ts - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language