wordnik/swagger-editor

View on GitHub

Showing 206 of 206 total issues

Function getCompletions has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

export default function getCompletions(editor, session, pos, prefix, cb, ctx, system) {
Severity: Major
Found in src/plugins/editor-autosuggest-refs/get-completions.js - About 50 mins to fix

    Function getCompletions has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export default function getCompletions(editor, session, pos, prefix, cb, ctx, system) {
    Severity: Major
    Found in src/plugins/editor-autosuggest-snippets/get-completions.js - About 50 mins to fix

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

      ConvertModalStepErrored.propTypes = {
        getComponent: PropTypes.func.isRequired,
        onClose: PropTypes.func.isRequired,
        error: PropTypes.any.isRequired,
      }
      src/plugins/ast/ast.js on lines 159..163
      src/standalone/topbar-insert/forms/components/InsertFormInput.jsx on lines 99..103

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      InsertFormInput.propTypes = {
        formData: PropTypes.object.isRequired,
        index: PropTypes.number.isRequired,
        getComponent: PropTypes.func.isRequired
      }
      src/plugins/ast/ast.js on lines 159..163
      src/standalone/topbar-menu-edit-convert/components/convert-modal.jsx on lines 184..188

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

            range.key_end = {
              line: astKeyValue.end_mark.line,
              column: astKeyValue.end_mark.column,
              pointer: astKeyValue.end_mark.pointer,
            }
      Severity: Major
      Found in src/plugins/ast/ast.js and 2 other locations - About 50 mins to fix
      src/standalone/topbar-insert/forms/components/InsertFormInput.jsx on lines 99..103
      src/standalone/topbar-menu-edit-convert/components/convert-modal.jsx on lines 184..188

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if(refPath && refPath[0] !== "/") {
                errors.push({
                  path: [...node.path.slice(0, -1), "$ref"],
                  message: "$ref paths must begin with `#/`",
                  level: "error"
      Severity: Major
      Found in src/plugins/validate-semantic/validators/2and3/refs.js and 2 other locations - About 50 mins to fix
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 96..102
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 131..137

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if(hasReservedChars) {
                errors.push({
                  path: [...node.path.slice(0, -1), "$ref"],
                  message: "$ref values must be RFC3986-compliant percent-encoded URIs",
                  level: "error"
      Severity: Major
      Found in src/plugins/validate-semantic/validators/2and3/refs.js and 2 other locations - About 50 mins to fix
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 69..75
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 96..102

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                if(json.getIn(path) === undefined) {
                  errors.push({
                    path: [...node.path.slice(0, -1), "$ref"],
                    message: "$refs must reference a valid location in the document",
                    level: "error"
      Severity: Major
      Found in src/plugins/validate-semantic/validators/2and3/refs.js and 2 other locations - About 50 mins to fix
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 69..75
      src/plugins/validate-semantic/validators/2and3/refs.js on lines 131..137

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                    if (!effectiveConsumes.includes("application/x-www-form-urlencoded") && !effectiveConsumes.includes("multipart/form-data")) {
                      acc.push({
                        message: `Operations with parameters of "in: formData" must include "application/x-www-form-urlencoded" or "multipart/form-data" in their "consumes" property`,
                        path: [...node.path, method],
                        level: "error",
      Severity: Minor
      Found in src/plugins/validate-semantic/validators/form-data.js and 1 other location - About 45 mins to fix
      src/plugins/validate-semantic/validators/form-data.js on lines 72..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 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

      Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        render() { 
          return (
            <div>
              {this.props.bigTextBox ? 
                <textarea
      Severity: Minor
      Found in src/standalone/topbar-insert/forms/components/FormInput.jsx - About 45 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 getPathForPosition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getPathForPosition({ pos: originalPos, prefix, editorValue, AST }) {
        var pos = Object.assign({}, originalPos)
        var lines = editorValue.split(/\r\n|\r|\n/)
        var previousLine = lines[pos.row - 1] || ""
        var currentLine = lines[pos.row]
      Severity: Minor
      Found in src/plugins/editor-autosuggest/fn.js - About 45 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

          summary: { 
            value: "", 
            name: "Summary",          
            description: "Enter a summary of the path.",
            updateForm: event => updateForm(event, path.concat(["summary"])),
      Severity: Minor
      Found in src/standalone/topbar-insert/forms/form-objects/path-object.js and 1 other location - About 45 mins to fix
      src/standalone/topbar-insert/forms/form-objects/operation-object.js on lines 36..42

      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

      Avoid deeply nested control flow statements.
      Open

                    if (!effectiveConsumes.includes("application/x-www-form-urlencoded") && !effectiveConsumes.includes("multipart/form-data")) {
                      acc.push({
                        message: `Operations with parameters of "in: formData" must include "application/x-www-form-urlencoded" or "multipart/form-data" in their "consumes" property`,
                        path: [...node.path, method],
                        level: "error",
      Severity: Major
      Found in src/plugins/validate-semantic/validators/form-data.js - About 45 mins to fix

        Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          render() { 
            let addedOption = <span />
            const addButton = <a role="button" className="d-inline-block float-right" onClick={this.showAddField} onKeyDown={this.onEnterKeyPress} tabIndex={0}>Add</a>
            if (this.props.isValidAddition) {
              if (this.state.showAddOption) {
        Severity: Minor
        Found in src/standalone/topbar-insert/forms/components/FormDropdown.jsx - About 45 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

            summary: {
              value: "",
              name: "Summary",
              description: "Add a short summary of what the operation does.",
              updateForm: event => updateForm(event, path.concat(["summary"])),
        src/standalone/topbar-insert/forms/form-objects/path-object.js on lines 14..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 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

                      if (!effectiveConsumes.includes("multipart/form-data")) {
                        acc.push({
                          message: `Operations with parameters of "type: file" must include "multipart/form-data" in their "consumes" property`,
                          path: [...node.path, method],
                          level: "error",
        Severity: Minor
        Found in src/plugins/validate-semantic/validators/form-data.js and 1 other location - About 45 mins to fix
        src/plugins/validate-semantic/validators/form-data.js on lines 81..88

        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

                if(value.type === "file" && value.in !== "formData") {
                  acc.push({
                    message: `Parameters with "type: file" must have "in: formData"`,
                    path: [...node.path],
                    level: "error",
        Severity: Minor
        Found in src/plugins/validate-semantic/validators/form-data.js and 1 other location - About 40 mins to fix
        src/plugins/validate-semantic/validators/form-data.js on lines 106..113

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

        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

                if(bodyParams.length && formDataParams.length) {
                  acc.push({
                    message: `Parameters cannot have both a "in: body" and "in: formData", as "formData" _will_ be the body`,
                    path: [...node.path],
                    level: "error",
        Severity: Minor
        Found in src/plugins/validate-semantic/validators/form-data.js and 1 other location - About 40 mins to fix
        src/plugins/validate-semantic/validators/form-data.js on lines 37..44

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

        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 getCompletions has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            completer.getCompletions = function(editor, session, pos, prefix, callback) {
        Severity: Minor
        Found in src/plugins/editor-autosuggest/helpers.js - About 35 mins to fix

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

          const InsertFormInput = ({ getComponent, index, formData }) => {
            const FormMap = getComponent("FormMap")
            const FormChild = getComponent("FormChild")
            const FormInputWrapper = getComponent("FormInputWrapper")
            const FormDropdown = getComponent("FormDropdown")
          Severity: Minor
          Found in src/standalone/topbar-insert/forms/components/InsertFormInput.jsx - 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

          Severity
          Category
          Status
          Source
          Language