theBenForce/openapi-markdown

View on GitHub

Showing 19 of 19 total issues

Function exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = info => {
  const res = [];
  if (info !== null && typeof info === 'object') {
    if ('title' in info) {
      res.push(`# ${info.title}`);
Severity: Minor
Found in app/transformers/info.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 dataTypeResolver has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const dataTypeResolver = schema => {
  if (schema.getAllOf()) {
    return schema.getAllOf()
      .map(subSchema => dataTypeResolver(subSchema))
      .filter(type => type !== '')
Severity: Minor
Found in app/transformers/dataTypes.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 exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (parameters, pathParameters, globalParameters = {}) => {
  const res = [];
  res.push('##### Parameters\n');
  res.push('| Name | Located in | Description | Required | Schema |');
  res.push('| ---- | ---------- | ----------- | -------- | ---- |');
Severity: Minor
Found in app/transformers/pathParameters.js - About 1 hr to fix

    Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = security => {
      const res = [];
      let maxLength = 0;
      security.map(rules => {
        Object.keys(rules).map(key => {
    Severity: Minor
    Found in app/transformers/security.js - About 1 hr to fix

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

        constructor(schema = null) {
          if (schema !== null) {
            if ('type' in schema) {
              this.setType(schema.type);
            }
      Severity: Minor
      Found in app/models/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 exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (path, data, parameters) => {
        const res = [];
        let pathParameters = null;
      
        if (path && data) {
      Severity: Minor
      Found in app/transformers/path.js - About 1 hr to fix

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

        const dataTypeResolver = schema => {
          if (schema.getAllOf()) {
            return schema.getAllOf()
              .map(subSchema => dataTypeResolver(subSchema))
              .filter(type => type !== '')
        Severity: Minor
        Found in app/transformers/dataTypes.js - About 1 hr to fix

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

          module.exports = securityDefinitions => {
            // Base block
            const res = [];
            Object.keys(securityDefinitions).map(type => {
              res.push(`**${type}**  \n`);
          Severity: Minor
          Found in app/transformers/securityDefinitions.js - About 1 hr to fix

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

            module.exports = responses => {
              const res = [];
              // Check if schema somewhere
              const schemas = Object.keys(responses).reduce(
                (acc, response) => acc || 'schema' in responses[response],
            Severity: Minor
            Found in app/transformers/pathResponses.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  res.push(`|${line.map(el => ` ${el} `).join('|')}|`);
              Severity: Minor
              Found in app/transformers/pathResponses.js and 1 other location - About 50 mins to fix
              app/transformers/pathParameters.js on lines 46..46

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    res.push(`|${line.map(el => ` ${el} `).join('|')}|`);
              Severity: Minor
              Found in app/transformers/pathParameters.js and 1 other location - About 50 mins to fix
              app/transformers/pathResponses.js on lines 36..36

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 51.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

              module.exports = (needle, haystack) => {
                if (haystack === undefined || haystack === null) return false;
                if (haystack.length) {
                  for (let i = 0; i < haystack.length; i++) {
                    if (needle === haystack[i]) {
              Severity: Minor
              Found in app/lib/inArray.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = license => {
                const res = [];
                if ('url' in license || 'name' in license) {
                  res.push('**License:** ');
                  if ('url' in license && 'name' in license) {
              Severity: Minor
              Found in app/transformers/license.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if ('definitions' in inputDoc) {
                    document.push(transformDefinition(inputDoc.definitions));
                  } else if (inputDoc.components && inputDoc.components.schemas) {
                    document.push(transformDefinition(inputDoc.components.schemas));
                  }
              Severity: Minor
              Found in app/index.js and 1 other location - About 35 mins to fix
              app/index.js on lines 59..63

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if ('securityDefinitions' in inputDoc) {
                    document.push(transformSecurityDefinitions(inputDoc.securityDefinitions));
                  } else if (inputDoc.components && inputDoc.components.securitySchemas) {
                    document.push(transformSecurityDefinitions(inputDoc.components.securityDefinitions));
                  }
              Severity: Minor
              Found in app/index.js and 1 other location - About 35 mins to fix
              app/index.js on lines 75..79

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Avoid too many return statements within this function.
              Open

                  return `[ ${subType} ]`;
              Severity: Major
              Found in app/transformers/dataTypes.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return '';
                Severity: Major
                Found in app/transformers/dataTypes.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return `${schema.getType()} (${schema.getFormat()})`;
                  Severity: Major
                  Found in app/transformers/dataTypes.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return schema.getType();
                    Severity: Major
                    Found in app/transformers/dataTypes.js - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language