tomi77/node-bookshelf-django

View on GitHub

Showing 7 of 13 total issues

Function up has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.up = async (knex, Promise) => {
  if (!await knex.schema.hasTable('django_content_type')) {
    await knex.schema.createTable('django_content_type', function(table) {
      table.increments().primary();
      table.string('app_label', 100).notNullable();
Severity: Major
Found in migrations/00_initial.js - About 4 hrs to fix

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

    module.exports = function(bookshelf) {
      if (bookshelf.model('Django.Auth.User') == null) {
        require('./auth_permission')(bookshelf);
        require('./auth_group')(bookshelf);
    
    
    Severity: Minor
    Found in models/auth_user.js - About 1 hr to fix

      Function up has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      exports.up = async (knex, Promise) => {
        if (!await knex.schema.hasTable('django_content_type')) {
          await knex.schema.createTable('django_content_type', function(table) {
            table.increments().primary();
            table.string('app_label', 100).notNullable();
      Severity: Minor
      Found in migrations/00_initial.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(bookshelf) {
        if (bookshelf.model('Django.Auth.Group') == null) {
          require('./auth_permission')(bookshelf);
      
          bookshelf.model('Django.Auth.Group', {
      Severity: Minor
      Found in models/auth_group.js - About 1 hr to fix

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

        module.exports = function(bookshelf) {
          if (bookshelf.model('Django.Auth.Permission') == null) {
            require('./django_content_type')(bookshelf);
        
            bookshelf.model('Django.Auth.Permission', {
        Severity: Minor
        Found in models/auth_permission.js - About 1 hr to fix

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

          module.exports = function(bookshelf) {
            require('./models/django_session')(bookshelf);
            require('./models/django_site')(bookshelf);
            require('./models/django_flatpage')(bookshelf);
            require('./models/django_redirect')(bookshelf);
          Severity: Minor
          Found in index.js - About 1 hr to fix

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

            module.exports = function(bookshelf) {
              if (bookshelf.model('Django.Auth.User') == null) {
                require('./auth_permission')(bookshelf);
                require('./auth_group')(bookshelf);
            
            
            Severity: Minor
            Found in models/auth_user.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

            Severity
            Category
            Status
            Source
            Language