swagger-api/swagger-editor

View on GitHub

Showing 112 of 206 total issues

Function validate2And3PathParameterDeclarationHasMatchingDefiniton has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const validate2And3PathParameterDeclarationHasMatchingDefiniton = () => async system => {
  const nodes = await system.validateSelectors.allPathItems()

  return nodes.reduce(async (prev, node) => {
    const acc = await prev
Severity: Minor
Found in src/plugins/validate-semantic/validators/2and3/paths.js - About 1 hr to fix

    Function validate2And3PathParameterIsDefinedInPath has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const validate2And3PathParameterIsDefinedInPath = () => (system) => {
      const refArray = []
      return system.validateSelectors
        .allParameters()
        .then(nodes => {
    Severity: Minor
    Found in src/plugins/validate-semantic/validators/2and3/parameters.js - About 1 hr to fix

      Function validate2And3MinAndMax has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const validate2And3MinAndMax = () => (system) => {
        return system.validateSelectors
          .allSchemas()
          .then(nodes => {
            return nodes.reduce((acc, node) => {
      Severity: Minor
      Found in src/plugins/validate-semantic/validators/2and3/schemas.js - About 1 hr to fix

        Function validateOAS3RefsForRequestBodiesReferenceRequestBodyPositions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const validateOAS3RefsForRequestBodiesReferenceRequestBodyPositions = () => sys => {
          return sys.validateSelectors
            .allOAS3RequestBodies()
            .then(nodes => {
              return nodes.reduce((acc, node) => {
        Severity: Minor
        Found in src/plugins/validate-semantic/validators/oas3/refs.js - About 1 hr to fix

          Function spec has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function spec() {
            return {
              statePlugins: {
                spec: {
                  selectors: {
          Severity: Minor
          Found in src/plugins/jump-to-path/spec.js - About 1 hr to fix

            Function validateOAS3HeaderParameterNames has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            export const validateOAS3HeaderParameterNames = () => (system) => {
              return system.validateSelectors
                .allParameters()
                .then(nodes => {
                  return nodes.reduce((acc, node) => {
            Severity: Minor
            Found in src/plugins/validate-semantic/validators/oas3/parameters.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 getChild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function getChild(object, key) {
              var keys = Object.keys(object)
              var regex
              var isArrayAccess = /^\d+$/.test(key)
            
            
            Severity: Minor
            Found in src/plugins/editor-autosuggest-keywords/get-keywords-for-path.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 getChild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function getChild(object, key) {
              var keys = Object.keys(object)
              var regex
              var isArrayAccess = /^\d+$/.test(key)
            
            

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

            function mergeParams(objA = {}, objB = {}) {
              if (!objA && !objB) {
                return undefined
              }
            
            
            Severity: Minor
            Found in src/plugins/json-schema-validator/validator/condense-errors.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 find has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function find(current, path, last) {
                if(!current) {
                  // something has gone quite wrong
                  // return the last start_mark as a best-effort
                  if(last && last.start_mark)
            Severity: Minor
            Found in src/plugins/ast/ast.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if(!res.found && operationsInPathItem.length) {
                  operationsInPathItem
                    .forEach(op => {
                      const inThisOperation = (op.parameters || [])
                        .some(param => param.name === paramName && param.in === "path")
              Severity: Critical
              Found in src/plugins/validate-semantic/validators/helpers.js - About 1 hr to fix

                Function default has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function() {
                  return {
                    afterLoad: system => system.jsonSchemaValidatorActions.setup(),
                    statePlugins: {
                      jsonSchemaValidator: {
                Severity: Minor
                Found in src/plugins/json-schema-validator/index.js - About 1 hr to fix

                  Function getSchemaBasePath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const getSchemaBasePath = () => ({ specSelectors }) => {
                    // Eg: [openapi-3.0] or [openapi-2-0]
                    // later on... ["openapi-2.0", "paths", "get"]
                    const isOAS3 = specSelectors.isOAS3 ? specSelectors.isOAS3() : false
                    const isSwagger2 = specSelectors.isSwagger2
                  Severity: Minor
                  Found in src/plugins/json-schema-validator/index.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 default has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function () {
                    return {
                      statePlugins: {
                        topbar: {
                          actions: {
                  Severity: Minor
                  Found in src/standalone/topbar/index.js - About 1 hr to fix

                    Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const { menuAlign, align, inverse, size, className } = this.props
                    
                        const menuClassName = classnames(
                          "dd-menu",
                    Severity: Minor
                    Found in src/standalone/topbar/components/DropdownMenu.jsx - About 1 hr to fix

                      Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        render() {
                          let { specSelectors, getComponent, errSelectors, fn, editorSelectors, configsSelectors } = this.props
                      
                          let Editor = getComponent("Editor")
                      
                      
                      Severity: Minor
                      Found in src/plugins/editor/components/editor-container.jsx - About 1 hr to fix

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

                        export const validateOAS3HeaderParameterNames = () => (system) => {
                          return system.validateSelectors
                            .allParameters()
                            .then(nodes => {
                              return nodes.reduce((acc, node) => {
                        Severity: Minor
                        Found in src/plugins/validate-semantic/validators/oas3/parameters.js - About 1 hr to fix

                          Function EditorSpecPlugin has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function EditorSpecPlugin() {
                            return {
                              statePlugins: {
                                spec: {
                                  wrapActions: {
                          Severity: Minor
                          Found in src/plugins/editor/spec.js - About 1 hr to fix

                            Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const { onClose, getComponent, converterUrl } = this.props
                            
                                if(this.state.status === "new") {
                                  return <ConvertModalStepNew

                              Function validateOAS3RequestBodyRefsReferenceAllowableSchemaPositions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

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

                              Severity
                              Category
                              Status
                              Source
                              Language