alt3/sequelize-to-json-schemas

View on GitHub

Showing 6 of 21 total issues

File schema-manager.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const { capitalize, omit, pick } = require('./utils/lodash-natives');

const StrategyInterface = require('./strategy-interface');
const TypeMapper = require('./type-mapper');
const { checkTypeOptional, checkTypeRequired } = require('./utils/type-checks');
Severity: Minor
Found in lib/schema-manager.js - About 3 hrs to fix

    SchemaManager has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SchemaManager {
      /**
       * @param {object} options User options.
       * @param {string} options.baseUri Base URI prefixed to generated paths, defaults to '/'
       * @param {boolean} options.absolutePaths False to generate relative paths, defaults to true
    Severity: Minor
    Found in lib/schema-manager.js - About 2 hrs to fix

      Function map has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        map(attributeName, properties, strategy) {
          let result;
          let attributeType = properties && properties.type && properties.type.key;
      
          // Aliases
      Severity: Minor
      Found in lib/type-mapper.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 generate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        generate(model, strategy, options) {
          const defaultOptions = {
            title: null,
            description: null,
            include: [],
      Severity: Minor
      Found in lib/schema-manager.js - About 1 hr to fix

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

          _getModelPropertyForAssociation(associationName, association) {
            const options = _modelOptions.get(this);
        
            if (
              options.excludeAssociations.length > 0 &&
        Severity: Minor
        Found in lib/schema-manager.js - About 1 hr to fix

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

            generate(model, strategy, options) {
              const defaultOptions = {
                title: null,
                description: null,
                include: [],
          Severity: Minor
          Found in lib/schema-manager.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

          Severity
          Category
          Status
          Source
          Language