bsalex/angular-loading-overlay

View on GitHub

Showing 37 of 37 total issues

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

            it('should emit rootScope event on start with referenceId in options', (done) => {
                dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', (event, options) => {
                    expect(options.referenceId).toEqual(referenceId);
                    done();
                });
Severity: Major
Found in source/BsLoadingOverlayService.spec.ts and 1 other location - About 1 hr to fix
source/BsLoadingOverlayService.spec.ts on lines 42..49

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

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

Function BsLoadingOverlayService has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var BsLoadingOverlayService = (function () {
        function BsLoadingOverlayService($rootScope, $q) {
            var _this = this;
            this.$rootScope = $rootScope;
            this.$q = $q;
Severity: Minor
Found in dist/angular-loading-overlay.js - About 1 hr to fix

    Function BsLoadingOverlayInstance has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var BsLoadingOverlayInstance = (function () {
            function BsLoadingOverlayInstance(referenceId, delay, activeClass, $element, overlayElement, $timeout, $q) {
                this.referenceId = referenceId;
                this.delay = delay;
                this.activeClass = activeClass;
    Severity: Minor
    Found in dist/angular-loading-overlay.js - About 1 hr to fix

      Function BsLoadingOverlayDirective has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function BsLoadingOverlayDirective($compile, $rootScope, $templateRequest, $q, $timeout, bsLoadingOverlayService) {
                  var _this = this;
                  this.$compile = $compile;
                  this.$rootScope = $rootScope;
                  this.$templateRequest = $templateRequest;
      Severity: Minor
      Found in dist/angular-loading-overlay.js - About 1 hr to fix

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

            constructor($compile: angular.ICompileService, $rootScope: angular.IRootScopeService, $templateRequest: angular.ITemplateRequestService, $q: angular.IQService, $timeout: angular.ITimeoutService, bsLoadingOverlayService: BsLoadingOverlayService);
        Severity: Major
        Found in dist/BsLoadingOverlayDirective.d.ts and 1 other location - About 1 hr to fix
        source/BsLoadingOverlayDirective.ts on lines 87..103

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

        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

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

        export const BsLoadingOverlayDirectiveFactory: angular.IDirectiveFactory = (
            $compile: angular.ICompileService,
            $rootScope: angular.IRootScopeService,
            $templateRequest: angular.ITemplateRequestService,
            $q: angular.IQService,
        Severity: Major
        Found in source/BsLoadingOverlayDirective.ts and 1 other location - About 1 hr to fix
        dist/BsLoadingOverlayDirective.d.ts on lines 12..12

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

        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

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

                    it('should emit rootScope event on start', (done) => {
                        dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', () => {
                            done();
                        });
        
        
        Severity: Major
        Found in source/BsLoadingOverlayService.spec.ts and 1 other location - About 1 hr to fix
        source/BsLoadingOverlayService.spec.ts on lines 285..293

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

        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

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

                    it('should emit rootScope event on stop', (done) => {
                        dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', () => {
                            done();
                        });
        
        
        Severity: Major
        Found in source/BsLoadingOverlayService.spec.ts and 1 other location - About 1 hr to fix
        source/BsLoadingOverlayService.spec.ts on lines 275..283

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

        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

        Function link has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    this.link = function (scope, $element, $attributes) {
                        var templatePromise;
                        var overlayElementScope;
                        var globalConfig = _this.bsLoadingOverlayService.getGlobalConfig();
                        var templateUrl = $attributes.bsLoadingOverlayTemplateUrl || globalConfig.templateUrl;
        Severity: Minor
        Found in dist/angular-loading-overlay.js - About 1 hr to fix

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

                      it('should emit rootScope event on stop', (done) => {
                          dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', () => {
                              done();
                          });
          
          
          Severity: Major
          Found in source/BsLoadingOverlayService.spec.ts and 1 other location - About 1 hr to fix
          source/BsLoadingOverlayService.spec.ts on lines 235..241

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

          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

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

                      it('should emit rootScope event on start', (done) => {
                          dependencies.$rootScope.$on('bsLoadingOverlayUpdateEvent', () => {
                              done();
                          });
          
          
          Severity: Major
          Found in source/BsLoadingOverlayService.spec.ts and 1 other location - About 1 hr to fix
          source/BsLoadingOverlayService.spec.ts on lines 260..266

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

          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

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

                  function BsLoadingOverlayInstance(referenceId, delay, activeClass, $element, overlayElement, $timeout, $q) {
          Severity: Major
          Found in dist/angular-loading-overlay.js - About 50 mins to fix

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

                    function BsLoadingOverlayDirective($compile, $rootScope, $templateRequest, $q, $timeout, bsLoadingOverlayService) {
            Severity: Minor
            Found in dist/angular-loading-overlay.js - About 45 mins to fix

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

                  exports.BsLoadingOverlayDirectiveFactory = function ($compile, $rootScope, $templateRequest, $q, $timeout, bsLoadingOverlayService) { return (new BsLoadingOverlayDirective($compile, $rootScope, $templateRequest, $q, $timeout, bsLoadingOverlayService)); };
              Severity: Minor
              Found in dist/angular-loading-overlay.js - About 45 mins to fix

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

                    wrap(options: IBsLoadingOverlayOptions, promiseFunction: angular.IPromise<any> | (() => (angular.IPromise<any> | {}))): angular.IPromise<any> {
                        let promise: () => (angular.IPromise<any> | {});
                
                        if (typeof promiseFunction === 'function') {
                            promise = <() => angular.IPromise<any>>promiseFunction;
                Severity: Minor
                Found in source/BsLoadingOverlayService.ts and 1 other location - About 40 mins to fix
                dist/BsLoadingOverlayService.d.ts on lines 14..14

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

                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

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

                    wrap(options: IBsLoadingOverlayOptions, promiseFunction: angular.IPromise<any> | (() => (angular.IPromise<any> | {}))): angular.IPromise<any>;
                Severity: Minor
                Found in dist/BsLoadingOverlayService.d.ts and 1 other location - About 40 mins to fix
                source/BsLoadingOverlayService.ts on lines 19..31

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

                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

                Function add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public add() {
                        if (this.delay) {
                            if (this.delayPromise) {
                                this.$timeout.cancel(this.delayPromise);
                            }
                Severity: Minor
                Found in source/BsLoadingOverlayInstance.ts - 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