apiaryio/fury-adapter-swagger

View on GitHub

Showing 64 of 64 total issues

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

  oauthScopes(element, items) {
    const {
      Member: MemberElement,
      Array: ArrayElement,
      String: StringElement,
Severity: Minor
Found in src/parser.js - About 1 hr to fix

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

    export function pushHeaderObject(key, header, payload, parser) {
      let value = '';
    
      if (header.type === 'array') {
        // TODO: Support collectionFormat once arrays are supported
    Severity: Minor
    Found in src/headers.js - About 1 hr to fix

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

        typeForSchema(schema) {
          if (schema.$ref) {
            // Peek into the reference, if we're calling typeForSchema from the
            // allOf case below then we will need to know the destination type
            const ref = lookupReference(schema.$ref, this.root);
      Severity: Minor
      Found in src/schema.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 useResourceGroups has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        useResourceGroups() {
          const tags = [];
      
          if (this.swagger.paths) {
            _.forEach(this.swagger.paths, (path) => {
      Severity: Minor
      Found in src/parser.js - About 1 hr to fix

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

          generateValidationDescriptions(schema) {
            const validations = {
              // String
              pattern: value => `Matches regex pattern: \`${value}\``,
              maxLength: value => `Length of string must be less than, or equal to ${value}`,
        Severity: Minor
        Found in src/schema.js - About 1 hr to fix

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

            generateObject(schema) {
              const {
                Object: ObjectElement,
              } = this.minim.elements;
          
          
          Severity: Minor
          Found in src/schema.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

          Avoid deeply nested control flow statements.
          Open

                    if (!newNode && piece > 0 && node.value[piece - 1]) {
                      // Element in sequence does not exist. It could have been empty
                      // Let's provide the end of previous element
                      start = node.value[piece - 1].end_mark;
                      end = start;
          Severity: Major
          Found in src/ast.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (!pieces.length) {
                          // This is the last item!
                          start = subNode[0].start_mark;
                          end = subNode[1].end_mark;
                        }
            Severity: Major
            Found in src/ast.js - About 45 mins to fix

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

                parse(done) {
                  const {
                    Category, ParseResult, SourceMap,
                  } = this.minim.elements;
                  const swaggerParser = new SwaggerParser();
              Severity: Minor
              Found in src/parser.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

              Function pushHeader has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export function pushHeader(key, value, payload, parser, fragment) {
              Severity: Minor
              Found in src/headers.js - About 35 mins to fix

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

                export function pushHeader(key, value, payload, parser, fragment) {
                  const { Member: MemberElement } = parser.minim.elements;
                  let header;
                
                  createHeaders(payload, parser);
                Severity: Minor
                Found in src/headers.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 pushHeaderObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function pushHeaderObject(key, header, payload, parser) {
                  let value = '';
                
                  if (header.type === 'array') {
                    // TODO: Support collectionFormat once arrays are supported
                Severity: Minor
                Found in src/headers.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 generateArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  generateArray(schema) {
                    const { Array: ArrayElement } = this.minim.elements;
                    const element = new ArrayElement();
                
                    if (schema.items) {
                Severity: Minor
                Found in src/schema.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 bodyFromSchema has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function bodyFromSchema(schema, payload, parser, contentType = 'application/json') {
                  const dereferencedSchema = dereference(schema, schema);
                  const { Asset } = parser.minim.elements;
                  let asset = null;
                
                
                Severity: Minor
                Found in src/generator.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 updateResourceGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  updateResourceGroup(name) {
                    const { Category, Copy } = this.minim.elements;
                
                    if (name) {
                      this.group = this.api.find(el => el.element === 'category' && el.classes.contains('resourceGroup') && el.title.toValue() === name).first;
                Severity: Minor
                Found in src/parser.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 lookupReference has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function lookupReference(reference, root, depth) {
                  const parts = reference.split('/').reverse();
                
                  if (parts.pop() !== '#') {
                    throw new Error('Schema reference must start with document root (#)');
                Severity: Minor
                Found in src/json-schema.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

                Avoid too many return statements within this function.
                Open

                    return result;
                Severity: Major
                Found in src/json-schema.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return done(exception, this.result);
                  Severity: Major
                  Found in src/parser.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return _.forEach(paths, (pathValue, href) => {
                              nextTick(() => {
                                this.handleSwaggerPath(pathValue, href);
                                pendingPaths -= 1;
                    
                    
                    Severity: Major
                    Found in src/parser.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return example;
                      Severity: Major
                      Found in src/json-schema.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language