wbyoung/maguey

View on GitHub

Showing 14 of 52 total issues

Function alterTable has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  alterTable: function(data) {
    /* jscs:disable jsDoc */

    // we know the phrasing is capable of handling one index creation or index
    // drop. we need to create a procedure if there are more operations
Severity: Major
Found in lib/adapters/sqlite3/procedures.js - About 6 hrs to fix

    `` has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Translator.reopen(/** @lends Translator# */ {
    
      /**
       * Translate a predicate and the corresponding args into a format string and
       * arguments that can be used while creating expressions.
    Severity: Minor
    Found in lib/dialect/translator.js - About 3 hrs to fix

      File condition.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      var _ = require('lodash');
      var Class = require('corazon/class');
      var FieldString = require('../types/field');
      Severity: Minor
      Found in lib/condition/condition.js - About 2 hrs to fix

        Function alterTable has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          alterTable: function(data) {
            /* jscs:disable jsDoc */
        
            // we know the phrasing is capable of handling everything other than index
            // renaming. we need to create a procedure if any index renames occur.
        Severity: Major
        Found in lib/adapters/mysql/procedures.js - About 2 hrs to fix

          Function alterTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            alterTable: function(data) {
              // create a base statement that does not include renames, addition of
              // indexes, dropped indexes, or renamed indexes.
              var statement = this._phrasing.alterTable(_.extend({}, data, {
                renamed: [],
          Severity: Major
          Found in lib/adapters/pg/procedures.js - About 2 hrs to fix

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

              alterTable: function(data) {
                var statement;
                var alterations =
                  data.added.length +
                  data.addedIndexes.length +
            Severity: Minor
            Found in lib/dialect/phrasing_table.js - About 1 hr to fix

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

                insert: function(data) {
                  var table = data.table;
                  var returning = data.returning;
                  var quoteField = this._grammar.field.bind(this._grammar);
                  var quoteValue = this._grammar.value.bind(this._grammar);
              Severity: Minor
              Found in lib/dialect/phrasing_insert.js - About 1 hr to fix

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

                        var createTable = function() {
                          var dbcols = this.dbcols.filter(notDroppedColumn);
                          var dbfks = this.dbfks.filter(notDroppedForeignKey);
                          var phrasing = self._phrasing;
                          var columnFragment = phrasing.columnFragment.bind(phrasing);
                Severity: Minor
                Found in lib/adapters/sqlite3/procedures.js - About 1 hr to fix

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

                  module.exports.parseWeekdayToInt = function(weekday) {
                    var result;
                    if (weekday.match(/^sun(?:day)?$/i)) { result = 0; }
                    else if (weekday.match(/^mon(?:day)?$/i)) { result = 1; }
                    else if (weekday.match(/^tues(?:day)?$/i)) { result = 2; }
                  Severity: Minor
                  Found in lib/util/date.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 _validateBinaryOperations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _validateBinaryOperations: function() {
                      this._parts.forEach(function(part, index) {
                        if (!(part instanceof Operation.Binary.__class__)) { return; }
                  
                        var previous = this._parts[index - 1];
                  Severity: Minor
                  Found in lib/condition/condition.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 foreignKeyFragment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    foreignKeyFragment: function(column) {
                      var quoteField = this._grammar.field.bind(this._grammar);
                      var action = this.foreignKeyActionFragment.bind(this);
                      var reference = column.options.references;
                      var parts = reference.split('.');
                  Severity: Minor
                  Found in lib/dialect/phrasing_table.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 fetchOne has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    fetchOne: function() {
                      return this.fetch().then(function(results) {
                        var error;
                        if (results.length === 0) {
                          error = _.extend(new Error('No results found.'), {
                  Severity: Minor
                  Found in lib/query/mixins/fetch.js - About 25 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 _initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _initialize: function(parts) {
                      parts.forEach(function(part) {
                        if (Array.isArray(part)) {
                          this._parts.push(Condition.create.apply(Condition, part));
                        }
                  Severity: Minor
                  Found in lib/condition/condition.js - About 25 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 alterTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    alterTable: function(data) {
                      var statement;
                      var alterations =
                        data.added.length +
                        data.addedIndexes.length +
                  Severity: Minor
                  Found in lib/dialect/phrasing_table.js - About 25 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