themouette/fossil-core

View on GitHub
samples/fossil-core.js

Summary

Maintainability
F
3 mos
Test Coverage

Function Fossil has a Cognitive Complexity of 305 (exceeds 5 allowed). Consider refactoring.
Open

var Fossil = (function () {
var deferred = function ($) {
        return $.Deferred;
    }(jquery);
var utils = function (_) {
Severity: Minor
Found in samples/fossil-core.js - About 6 days 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 Fossil has 1140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Fossil = (function () {
var deferred = function ($) {
        return $.Deferred;
    }(jquery);
var utils = function (_) {
Severity: Major
Found in samples/fossil-core.js - About 5 days to fix

    File fossil-core.js has 1141 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var Fossil = (function () {
    var deferred = function ($) {
            return $.Deferred;
        }(jquery);
    var utils = function (_) {
    Severity: Major
    Found in samples/fossil-core.js - About 2 days to fix

      Function mixins_deferrable has 195 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var mixins_deferrable = function (_, Deferred) {
              
              var messages = {
                      timeout: 'async process timed out',
                      rejected: 'some asynchronous process failed',
      Severity: Major
      Found in samples/fossil-core.js - About 7 hrs to fix

        Function mixins_observable has 128 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var mixins_observable = function (_, Backbone) {
                
                var exposedPubsubProperties = [
                        '_listenerId',
                        'createPubSub'
        Severity: Major
        Found in samples/fossil-core.js - About 5 hrs to fix

          Function services_routing has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var services_routing = function (_, Backbone, utils, Service) {
                  
                  var Routing = Service.extend({
                          prefix: '',
                          router: null,
          Severity: Major
          Found in samples/fossil-core.js - About 5 hrs to fix

            Function service has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var service = function (_, utils, Mixin, Observable) {
                    
                    var Service = Mixin.extend({
                            expose: null,
                            link: null,
            Severity: Major
            Found in samples/fossil-core.js - About 3 hrs to fix

              Function services_canvas has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var services_canvas = function ($, Service, utils, Region) {
                      var Canvas = Service.extend({
                              selector: 'body',
                              canvas: null,
                              useDeep: true,
              Severity: Major
              Found in samples/fossil-core.js - About 3 hrs to fix

                Function mixin has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var mixin = function (_, utils) {
                        
                        var specials = ['initialize'];
                        function isSpecialFunction(name) {
                            return -1 !== specials.indexOf(name);
                Severity: Major
                Found in samples/fossil-core.js - About 2 hrs to fix

                  Function utils has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var utils = function (_) {
                          
                          var messages = { invalid_src: 'Invalid source object.' };
                          function scalarOrArray(method) {
                              return function () {
                  Severity: Major
                  Found in samples/fossil-core.js - About 2 hrs to fix

                    Function fossil has 17 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    var fossil = function (deferred, utils, Mixin, Module, Service, ObservableBuffer, ViewStore, Observable, Startable, Deferrable, Session, Canvas, Routing, Events, Template, Underscore, Handlebars) {
                    Severity: Major
                    Found in samples/fossil-core.js - About 2 hrs to fix

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

                      var viewStore = function (_, utils, Mixin) {
                              var ViewStore = Mixin.extend({
                                      factories: null,
                                      views: null,
                                      constructor: function () {
                      Severity: Major
                      Found in samples/fossil-core.js - About 2 hrs to fix

                        Function observableBuffer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var observableBuffer = function (Mixin) {
                                var ObservableBuffer = Mixin.extend({
                                        constructor: function () {
                                            this.store = [];
                                            Mixin.apply(this, arguments);
                        Severity: Minor
                        Found in samples/fossil-core.js - About 1 hr to fix

                          Function mixins_startable has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var mixins_startable = function () {
                                  
                                  var Startable = {
                                          run: false,
                                          start: function () {
                          Severity: Minor
                          Found in samples/fossil-core.js - About 1 hr to fix

                            Function services_template has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var services_template = function (_, utils, Service) {
                                    var Template = Service.extend({
                                            engine: null,
                                            useDeep: true,
                                            constructor: function (options) {
                            Severity: Minor
                            Found in samples/fossil-core.js - About 1 hr to fix

                              Function engines_underscore has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var engines_underscore = function (_, Backbone, Mixin, Observable, Deferrable, Startable) {
                                      var ViewExtension = {
                                              precompile: function (template) {
                                                  if (typeof template === 'string') {
                                                      return _.template(template);
                              Severity: Minor
                              Found in samples/fossil-core.js - About 1 hr to fix

                                Function engines_handlebars has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var engines_handlebars = function (_, Backbone, Handlebars, Mixin, Observable, Deferrable, Startable) {
                                        var ViewExtension = {
                                                precompile: function (template) {
                                                    if (typeof template === 'string') {
                                                        return Handlebars.compile(template);
                                Severity: Minor
                                Found in samples/fossil-core.js - About 1 hr to fix

                                  Function services_session has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  var services_session = function (_, Backbone, utils, Service) {
                                          
                                          var expose = [
                                                  'get',
                                                  'set',
                                  Severity: Minor
                                  Found in samples/fossil-core.js - About 1 hr to fix

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

                                                    route: function (module, path, name, callback) {
                                                        var original;
                                                        path = url(module.url, path);
                                                        if (typeof name === 'function' || !callback) {
                                                            callback = name;
                                    Severity: Minor
                                    Found in samples/fossil-core.js - About 1 hr to fix

                                      Function engines_handlebars has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      var engines_handlebars = function (_, Backbone, Handlebars, Mixin, Observable, Deferrable, Startable) {
                                      Severity: Major
                                      Found in samples/fossil-core.js - About 50 mins to fix

                                        Function engines_underscore has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        var engines_underscore = function (_, Backbone, Mixin, Observable, Deferrable, Startable) {
                                        Severity: Minor
                                        Found in samples/fossil-core.js - About 45 mins to fix

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

                                          var Fossil = (function () {
                                          var deferred = function ($) {
                                                  return $.Deferred;
                                              }(jquery);
                                          var utils = function (_) {
                                          Severity: Major
                                          Found in samples/fossil-core.js and 1 other location - About 2 mos to fix
                                          fossil-core.js on lines 1..1149

                                          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 10205.

                                          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

                                          There are no issues that match your filters.

                                          Category
                                          Status