swagger-api/swagger-editor

View on GitHub

Showing 112 of 206 total issues

Function validate2And3ParametersHaveUniqueNameAndInCombinations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Function validateOAS3RequestBodyRefsReferenceAllowableSchemaPositions has 27 lines of code (exceeds 25 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

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

      export default function(system) {
        // setTimeout runs on the next tick
        setTimeout(() => {
          if(localStorage.getItem(CONTENT_KEY)) {
            system.specActions.updateSpec(localStorage.getItem(CONTENT_KEY), "local-storage")
      Severity: Minor
      Found in src/plugins/local-storage/index.js - About 1 hr to fix

        Function getCompletions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            completer.getCompletions = function(editor, session, pos, prefix, callback) {
              let startTime = Date.now()
              try {
                ori(editor, session, pos, prefix, (...args) => {
                  let msElapsed = Date.now() - startTime
        Severity: Minor
        Found in src/plugins/editor-autosuggest/helpers.js - About 1 hr to fix

          Function validateSecurityRequirementReferenceExistingScopes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const validateSecurityRequirementReferenceExistingScopes = () => (system) => {
            const { allSecurityRequirements, allSecurityDefinitions } = system.validateSelectors
          
            return Promise.all([allSecurityRequirements(), allSecurityDefinitions()])
              .then(([requirementNodes, definitionNodes]) => {
          Severity: Minor
          Found in src/plugins/validate-semantic/validators/security.js - About 1 hr to fix

            Function onChange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export const onChange = (event, formData ) => {
              let updatedField
              const updateForm = formData.get("updateForm")
              const isRequired = formData.get("isRequired")
            
            
            Severity: Minor
            Found in src/standalone/topbar-insert/forms/helpers/form-data-helpers.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 validate2And3SchemasDefaultsMatchAnEnum has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export const validate2And3SchemasDefaultsMatchAnEnum = () => (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 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 componentDidUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              componentDidUpdate(prevProps) {
                if(this.props.isOpen === prevProps.isOpen) {
                  return
                }
            
            
            Severity: Minor
            Found in src/standalone/topbar/components/DropdownMenu.jsx - 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 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 validate2And3TypeArrayRequiresItems has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export const validate2And3TypeArrayRequiresItems = () => (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 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 SemanticValidatorsPlugin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function SemanticValidatorsPlugin({getSystem}) {
            
              const debAll = debounce((system) => system.validateActions.all(), 300)
              const traverseOnce = makeTraverseOnce(getSystem)
            
            
            Severity: Minor
            Found in src/plugins/validate-semantic/index.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 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-oas3-keywords/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

                  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-keywords/get-completions.js - About 50 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

                    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

                    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 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
                        Severity
                        Category
                        Status
                        Source
                        Language