swagger-api/swagger-editor

View on GitHub

Showing 112 of 206 total issues

Function validateOAS3SchemaPropertiesReadOnlyWriteNotBothTrue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const validateOAS3SchemaPropertiesReadOnlyWriteNotBothTrue = () => (system) => {
  return system.validateSelectors
    .allSchemas()
    .then(nodes => {
      return nodes.reduce((acc, node) => {
Severity: Minor
Found in src/plugins/validate-semantic/validators/oas3/schemas.js - About 2 hrs 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 makeEditor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export default function makeEditor({ editorPluginsToRun }) {

  class Editor extends React.Component {

    constructor(props, context) {
Severity: Minor
Found in src/plugins/editor/components/editor.jsx - 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 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 find has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function find(astValue, astKeyValue) {
    if (astValue.tag === MAP_TAG) {
      for (i = 0; i < astValue.value.length; i++) {
        var pair = astValue.value[i]
        var key = pair[0]
Severity: Minor
Found in src/plugins/ast/ast.js - About 1 hr to fix

    Function checkForDefinition has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function checkForDefinition(paramName, pathItem) {
      const pathItemParameters = pathItem.parameters
      const operationsInPathItem = (Object.keys(pathItem) || [])
        .filter(key => operationKeys.indexOf(key) > -1)
        .map(key => {
    Severity: Minor
    Found in src/plugins/validate-semantic/validators/helpers.js - About 1 hr to fix

      Function getLineNumberForPath has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getLineNumberForPath(yaml, path) {
      
        // Type check
        if (typeof yaml !== "string") {
          throw new TypeError("yaml should be a string")
      Severity: Minor
      Found in src/plugins/ast/ast.js - About 1 hr to fix

        Function updatedFormData has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const updatedFormData = formData.map((formItem) => {
            const value = formItem.get("value")
            const isRequired = formItem.get("isRequired")
        
            // The form field represents a mapping (keyValue => value).
        Severity: Minor
        Found in src/standalone/topbar-insert/forms/helpers/validation-helpers.js - About 1 hr to fix

          Function getKeywordsForPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function getKeywordsForPath({ system, path, keywordMap }) {
            keywordMap = Object.assign({}, keywordMap)
          
            // is getting path was not successful stop here and return no candidates
            if (!isArray(path)) {
          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 getRefType has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export const getRefType = (state, path) => (sys) => createSelector(
            () => {
            for( var i=path.length-1; i>-1; i-- ) {
              let tag = path[i]
              if(sys.specSelectors.isOAS3 && sys.specSelectors.isOAS3()) {
          Severity: Minor
          Found in src/plugins/editor-autosuggest/spec-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 getKeywordsForPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function getKeywordsForPath({ system, path, keywordMap}) {
            keywordMap = Object.assign({}, keywordMap)
          
            // is getting path was not successful stop here and return no candidates
            if (!isArray(path)) {

          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 transformPathToArray has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function transformPathToArray(property, jsSpec) {
            if (property.slice(0, 9) === "instance.") {
              var str = property.slice(9)
            } else {
              // eslint-disable-next-line no-redeclare
          Severity: Minor
          Found in src/plugins/json-schema-validator/validator/path-translator.js - About 1 hr to fix

            Function find has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function find(current) {
            
                // algorythm:
                // is current a promitive?
                //   // finish recursion without modifying the path
            Severity: Minor
            Found in src/plugins/ast/ast.js - About 1 hr to fix

              Function validate2And3TypesInDefaultValuesMatchesWithEnum has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const validate2And3TypesInDefaultValuesMatchesWithEnum = () => (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 validateParameterFormDataConsumesType has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function validateOAS3ParameterRefsReferenceParameterPositions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const validateOAS3ParameterRefsReferenceParameterPositions = () => sys => {
                    return sys.validateSelectors
                      .allParameters()
                      .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

                  Function validateOAS3RefsForHeadersReferenceHeadersPositions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const validateOAS3RefsForHeadersReferenceHeadersPositions = () => sys => {
                    return sys.validateSelectors
                      .allHeaders()
                      .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

                  Function validate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    validate({ jsSpec, specStr, schemaPath, source }) {
                      this.ajv.validate(normalizeKey(schemaPath), jsSpec)
                  
                      if (!this.ajv.errors || !this.ajv.errors.length) {
                        return null
                  Severity: Minor
                  Found in src/plugins/json-schema-validator/validator/index.js - About 1 hr to fix

                    Function default has 39 lines of code (exceeds 25 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 1 hr to fix

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

                      function makeTraverseOnce(getSystem) {
                        let traversers = {}
                        let results = {}
                        let deferred = null
                      
                      
                      Severity: Minor
                      Found in src/plugins/validate-semantic/index.js - About 1 hr to fix

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

                        export function wrapCompleters(completers, cutoff = 100) {
                          let isLiveCompletionDisabled = false
                          let lastSpeeds = []
                          let isPerformant = () => lastSpeeds.every(speed => speed < cutoff)
                        
                        
                        Severity: Minor
                        Found in src/plugins/editor-autosuggest/helpers.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language