mgcrea/angular-strap

View on GitHub

Showing 88 of 611 total issues

File alert.spec.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

describe('alert', function() {

  var bodyEl = $('body'), sandboxEl;
Severity: Minor
Found in src/alert/test/alert.spec.js - About 3 hrs to fix

Function postLink has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      link: function postLink (scope, element, attr, controller) {

        // Fixes firefox bug when using objects in model with typeahead
        // Yes this breaks any other directive using a 'change' event on this input,
        // but if it is using the 'change' event why is it used with typeahead?
Severity: Major
Found in src/typeahead/typeahead.js - About 3 hrs to fix

File tab.spec.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

describe('tab', function () {

  var $compile, $templateCache, scope, sandboxEl;
Severity: Minor
Found in src/tab/test/tab.spec.js - About 3 hrs to fix

Function compile has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  this.compile = function (options) {

    if (options.template && /\.html$/.test(options.template)) {
      console.warn('Deprecated use of `template` option to pass a file. Please use the `templateUrl` option instead.');
      options.templateUrl = options.template;
Severity: Major
Found in src/helpers/compiler.js - About 3 hrs to fix

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

      link: function postLink (scope, element, attr, controller) {

        // Directive options
        var options = {scope: scope, placeholder: defaults.placeholder};
        angular.forEach(['template', 'templateUrl', 'controller', 'controllerAs', 'placement', 'container', 'delay', 'trigger', 'keyboard', 'html', 'animation', 'placeholder', 'allNoneButtons', 'maxLength', 'maxLengthHtml', 'allText', 'noneText', 'iconCheckmark', 'autoClose', 'id', 'sort', 'caretHtml', 'prefixClass', 'prefixEvent', 'toggle'], function (key) {
Severity: Major
Found in src/select/select.js - About 3 hrs to fix

File collapse.spec.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

describe('collapse', function () {

  var $compile, $templateCache, $animate, scope, sandboxEl;
Severity: Minor
Found in src/collapse/test/collapse.spec.js - About 2 hrs to fix

Function show has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        $modal.show = function () {
          if ($modal.$isShown) return;

          var parent;
          var after;
Severity: Major
Found in src/modal/modal.js - About 2 hrs to fix

Function executeDataBindingTests has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function executeDataBindingTests(bindingAttribute) {

      it('should correctly apply model changes to the view', function() {
        var elm = compileDirective('binding-' + bindingAttribute);
        expect(sandboxEl.find('.nav-tabs > li.active').index()).toBe(scope.tab.active);
Severity: Major
Found in src/tab/test/tab.spec.js - About 2 hrs to fix

Function bsCompilerService has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function bsCompilerService ($q, $http, $injector, $compile, $controller, $templateCache) {

  /*
   * @ngdoc service
   * @name $bsCompiler
Severity: Minor
Found in src/helpers/compiler.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 $get has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.$get = function ($window, $rootScope, $tooltip, $timeout) {

      var bodyEl = angular.element($window.document.body);
      var matchesSelector = Element.prototype.matchesSelector || Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector;

Severity: Major
Found in src/dropdown/dropdown.js - About 2 hrs to fix

Function getCalculatedOffset has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function getCalculatedOffset (placement, position, actualWidth, actualHeight) {
          var offset;
          var split = placement.split('-');

          switch (split[0]) {
Severity: Major
Found in src/tooltip/tooltip.js - About 2 hrs to fix

File date-parser.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

angular.module('mgcrea.ngStrap.helpers.dateParser', [])

.provider('$dateParser', function ($localeProvider) {
Severity: Minor
Found in src/helpers/date-parser.js - About 2 hrs to fix

File button.radio.spec.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

describe('bs-radio', function () {

  var $compile, $q, $$rAF, scope, sandboxEl;
Severity: Minor
Found in src/button/test/button.radio.spec.js - About 2 hrs to fix

Function controller has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var controller = this.controller = function ($scope, $element, $attrs) {
      var self = this;

      // Attributes options
      self.$options = angular.copy(defaults);
Severity: Major
Found in src/tab/tab.js - About 2 hrs to fix

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

      function DropdownFactory (element, config) {

        var $dropdown = {};

        // Common vars
Severity: Major
Found in src/dropdown/dropdown.js - About 2 hrs to fix

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

      compile: function (tElement, tAttrs) {

        // Support for inlined template (next sibling)
        // It must be fetched before compilation
        if (!tAttrs.bsDropdown) {
Severity: Major
Found in src/dropdown/dropdown.js - About 2 hrs to fix

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

        $tooltip.show = function () {
          if (!options.bsEnabled || $tooltip.$isShown) return;

          scope.$emit(options.prefixEvent + '.show.before', $tooltip);
          if (angular.isDefined(options.onBeforeShow) && angular.isFunction(options.onBeforeShow)) {
Severity: Major
Found in src/tooltip/tooltip.js - About 2 hrs to fix

Function $get has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.$get = function ($parse, $q) {

      function ParseOptionsFactory (attr, config) {

        var $parseOptions = {};
Severity: Minor
Found in src/helpers/parse-options.js - About 2 hrs to fix

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

        $timepicker.$build = function () {
          // console.warn('$timepicker.$build() viewDate=%o', viewDate);
          var i;
          var midIndex = scope.midIndex = parseInt(options.length / 2, 10);
          var hours = [];
Severity: Minor
Found in src/timepicker/timepicker.js - About 1 hr to fix

Function ParseOptionsFactory has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      function ParseOptionsFactory (attr, config) {

        var $parseOptions = {};

        // Common vars
Severity: Minor
Found in src/helpers/parse-options.js - About 1 hr to fix
Severity
Category
Status
Source
Language