swagger-api/swagger-editor

View on GitHub
src/plugins/validate-semantic/selectors.js

Summary

Maintainability
F
5 days
Test Coverage

File selectors.js has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import flatten from "lodash/flatten"

export const isVendorExt = (state,node) => node.path.some(a => a.indexOf("x-") === 0)
export const isDefinition = (state,node) => node.path[0] == "definitions" && node.path.length == 2
export const isTag = (state, node) => node.path[0] === "tags" && node.path.length === 2
Severity: Minor
Found in src/plugins/validate-semantic/selectors.js - About 5 hrs to fix

    Function isSubSchema has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export const isSubSchema = (state, node) => (sys) => {
      const path = node.path
      if(path.length < 3) {
        return false
      }
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.js - About 1 hr 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 validators has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export const validators = () => (system) => {
      return Object.keys(system.validateActions)
        .filter(name => {
          // The action needs to start with the prefix "validate..."
          if(name.indexOf("validate") !== 0)
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.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 isParameterSchema has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const isParameterSchema = (state, node) => (sys) => {
      if(sys.specSelectors.isOAS3 && sys.specSelectors.isOAS3()) {
        // OAS3
        return node.key === "schema" && sys.validateSelectors.isParameter(node.parent)
      }
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.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 shouldValidate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    export const shouldValidate = () => (system) => {
      // don't run validation if spec is empty
      if(system.specSelectors.specStr().trim().length === 0) {
        return
      }
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.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

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

    export const allDefinitions = () => (system) => {
      return system.fn.traverseOnce({
        name: "allDefinitions",
        fn: (node) => {
          if(
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 2 hrs to fix
    src/plugins/validate-semantic/selectors.js on lines 263..275

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

    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 const allOAS3OperationSchemas = () => (system) => {
      return system.fn.traverseOnce({
        name: "allOAS3OperationSchemas",
        fn: (node) => {
          if(
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 2 hrs to fix
    src/plugins/validate-semantic/selectors.js on lines 238..250

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

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

    export const allSubSchemas = () => (system) => {
      return system.fn.traverseOnce({
        name: "allSubSchemas",
        fn: (node) => {
          if(system.validateSelectors.isSubSchema(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allResponses = () => (system) => {
      return system.fn.traverseOnce({
        name: "allResponses",
        fn: (node) => {
          if(system.validateSelectors.isResponse(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const all$refs = () => (system) => {
      return system.fn.traverseOnce({
        name: "all$refs",
        fn: (node) => {
          if(system.validateSelectors.isRef(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allParameterSchemas = () => (system) => {
      return system.fn.traverseOnce({
        name: "allParameterSchemas",
        fn: (node) => {
          if(system.validateSelectors.isParameterSchema(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allHeaders = () => (system) => {
      return system.fn.traverseOnce({
        name: "allHeader",
        fn: (node) => {
          if(system.validateSelectors.isHeader(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const all$refArtifacts = () => (system) => {
      return system.fn.traverseOnce({
        name: "all$refArtifacts",
        fn: (node) => {
          if(system.validateSelectors.isRefArtifact(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allParameters = () => (system) => {
      return system.fn.traverseOnce({
        name: "allParameters",
        fn: (node) => {
          if(system.validateSelectors.isParameter(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allOAS3RequestBodies = () => (system) => {
      return system.fn.traverseOnce({
        name: "allOAS3RequestBodies",
        fn: (node) => {
          if(system.validateSelectors.isOAS3RequestBody(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allTags = () => (system) => {
      return system.fn.traverseOnce({
        name: "allTags",
        fn: (node) => {
          if(system.validateSelectors.isTag(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allOAS3RequestBodySchemas = () => (system) => {
      return system.fn.traverseOnce({
        name: "allOAS3RequestBodySchemas",
        fn: (node) => {
          if(
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 290..299
    src/plugins/validate-semantic/selectors.js on lines 301..310

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

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

    export const allResponseSchemas = () => (system) => {
      return system.fn.traverseOnce({
        name: "allResponseSchemas",
        fn: (node) => {
          if(system.validateSelectors.isResponseSchema(node)) {
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 10 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 111..120
    src/plugins/validate-semantic/selectors.js on lines 162..171
    src/plugins/validate-semantic/selectors.js on lines 173..182
    src/plugins/validate-semantic/selectors.js on lines 194..203
    src/plugins/validate-semantic/selectors.js on lines 205..214
    src/plugins/validate-semantic/selectors.js on lines 216..225
    src/plugins/validate-semantic/selectors.js on lines 227..236
    src/plugins/validate-semantic/selectors.js on lines 252..261
    src/plugins/validate-semantic/selectors.js on lines 277..288
    src/plugins/validate-semantic/selectors.js on lines 290..299

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

    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 const isOAS3RequestBodySchema = (state, node) => () => {
      const [key,, gpKey, ggpKey] = node.path.slice().reverse()
    
      return key === "schema"
        && gpKey === "content"
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 88..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 72.

    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 const isOAS3ResponseSchema = (state, node) => () => {
      const [key,, gpKey,, gggpKey] = node.path.slice().reverse()
    
      return key === "schema"
        && gpKey === "content"
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 80..86

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

    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

    export const isOAS3RootParameter = (state, node) => node.path[0] === "components" && node.path[1] === "parameters" && node.path.length === 3
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 3 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 19..19
    src/plugins/validate-semantic/selectors.js on lines 20..20
    src/plugins/validate-semantic/selectors.js on lines 21..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 59.

    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

    export const isOAS3RootSchema = (state, node) => node.path[0] === "components" && node.path[1] === "schemas" && node.path.length === 3
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 3 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 18..18
    src/plugins/validate-semantic/selectors.js on lines 19..19
    src/plugins/validate-semantic/selectors.js on lines 21..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 59.

    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

    export const isOAS3RootHeader = (state, node) => node.path[0] === "components" && node.path[1] === "headers" && node.path.length === 3
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 3 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 18..18
    src/plugins/validate-semantic/selectors.js on lines 19..19
    src/plugins/validate-semantic/selectors.js on lines 20..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 59.

    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

    export const isOAS3RootResponse = (state, node) => node.path[0] === "components" && node.path[1] === "responses" && node.path.length === 3
    Severity: Major
    Found in src/plugins/validate-semantic/selectors.js and 3 other locations - About 1 hr to fix
    src/plugins/validate-semantic/selectors.js on lines 18..18
    src/plugins/validate-semantic/selectors.js on lines 20..20
    src/plugins/validate-semantic/selectors.js on lines 21..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 59.

    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

        node.path[0] === "paths"
          && node.path[3] === "responses"
          && node.path.length === 5
          && !sys.validateSelectors.isVendorExt(node)
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 35 mins to fix
    src/plugins/validate-semantic/selectors.js on lines 382..385

    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

            node.path[0] == "paths"
              && node.path[3] == "security"
              && node.path.length === 5
              && !system.validateSelectors.isVendorExt(node.parent) // ignore extension keys in path items
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 35 mins to fix
    src/plugins/validate-semantic/selectors.js on lines 98..101

    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

        sys.validateSelectors.isOAS3RootRequestBody(node)
          || sys.validateSelectors.isOAS3OperationRequestBody(node)
          || sys.validateSelectors.isOAS3OperationCallbackRequestBody(node)
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 30 mins to fix
    src/plugins/validate-semantic/selectors.js on lines 45..47

    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

        sys.validateSelectors.isRootParameter(node)
        || sys.validateSelectors.isOAS3RootParameter(node)
          || sys.validateSelectors.isPathItemParameter(node)
    Severity: Minor
    Found in src/plugins/validate-semantic/selectors.js and 1 other location - About 30 mins to fix
    src/plugins/validate-semantic/selectors.js on lines 59..61

    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

    There are no issues that match your filters.

    Category
    Status