swagger-api/swagger-editor

View on GitHub

Showing 112 of 206 total issues

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 default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function () {
  const ADD_TO_SPEC = "add_to_spec"

  return {
    components: {
Severity: Minor
Found in src/standalone/topbar-insert/index.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 validateOAS3GetAndDeleteOpsHaveNoRequestBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const validateOAS3GetAndDeleteOpsHaveNoRequestBody = () => sys => {
  return sys.validateSelectors
    .allOperations()
    .then(nodes => {
      return nodes.reduce((acc, node) => {
Severity: Minor
Found in src/plugins/validate-semantic/validators/oas3/operations.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 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

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

export default function buildConfig(
  {
    minimize = true,
    mangle = true,
    sourcemaps = true,
Severity: Minor
Found in webpack/_config-builder.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 Dropzone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Dropzone = ({ children, onDrop }) => {
  const handleDrop = useCallback((acceptedFiles, rejectedFiles) => {
    const someFilesWereRejected = rejectedFiles && rejectedFiles.length > 0
    const thereIsExactlyOneAcceptedFile = acceptedFiles && acceptedFiles.length === 1

Severity: Minor
Found in src/layout.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

Avoid too many return statements within this function.
Open

      return keywordMap[0].map(item => {
        return {
          name: "array",
          value: "- " + item,
          score: 300,
Severity: Major
Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return []
    Severity: Major
    Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return path
      Severity: Major
      Found in src/plugins/ast/ast.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return keywordMap.map(constructAceCompletion.bind(null, "value"))
        Severity: Major
        Found in src/plugins/editor-autosuggest-oas3-keywords/get-keywords-for-path.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return specPath
          Severity: Major
          Found in src/plugins/jump-to-path/spec.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return suggestionFromSchema(keywordMap)
            Severity: Major
            Found in src/plugins/editor-autosuggest-oas3-keywords/get-keywords-for-path.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return []
              Severity: Major
              Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return keywordMap.map(constructAceCompletion.bind(null, "value"))
                Severity: Major
                Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return []
                  Severity: Major
                  Found in src/plugins/editor-autosuggest-oas3-keywords/get-keywords-for-path.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return keywordMap[0].map(item => {
                            return {
                              name: "array",
                              value: "- " + item,
                              score: 300,
                    Severity: Major
                    Found in src/plugins/editor-autosuggest-oas3-keywords/get-keywords-for-path.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return current.start_mark.line
                      Severity: Major
                      Found in src/plugins/ast/ast.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return find(item, path.slice(1), current.value)
                        Severity: Major
                        Found in src/plugins/ast/ast.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return true
                          Severity: Major
                          Found in src/plugins/editor/components/editor.jsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              return suggestionFromSchema(keywordMap)
                            Severity: Major
                            Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language