RHeactorJS/web-app

View on GitHub

Showing 36 of 38 total issues

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

  link: scope => {
    if (!scope.progress) {
      scope.progress = new HttpProgress()
    }
    if (!scope.clickBindThis) scope.clickBindThis = scope
Severity: Minor
Found in js/directives/app-button.js - About 1 hr to fix

    Function BluebirdController has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const BluebirdController = angular => {
      angular
        .module('mwl.bluebird')
        .run(['$q', '$state', ($q, $state) => {
          $q.onPossiblyUnhandledRejection(error => {
    Severity: Minor
    Found in js/controller/bluebird.js - About 1 hr to fix

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

        list (endpoint, query, token, expectedContext) {
          URIValueType(endpoint, ['GenericAPIService.list', 'endpoint:URIValue'])
          MaybeJsonWebTokenType(token, ['GenericAPIService.get', 'token:?JsonWebToken'])
          MaybeURIValueType(expectedContext, ['GenericAPIService.list', 'expectedContext:?URIValue'])
          expectedContext = expectedContext || this.modelContext
      Severity: Minor
      Found in js/services/generic.js - About 1 hr to fix

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

          handleEvent (name, eventCreatedAt, event) {
            return Promise.map(this.items, (item) => {
              if (
                event[item.$context.toString()] &&
                event[item.$context.toString()].$context.toString() === item.$context.toString() &&
        Severity: Minor
        Found in js/util/live-collection.js - About 1 hr to fix

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

          export function BodyController (app) {
            app
              .run(['$rootScope', ($rootScope) => {
                const bodyClasses = {
                  state: [],
          Severity: Minor
          Found in js/controller/body.js - About 1 hr to fix

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

              create (endpoint, model, token, fetch) {
                URIValueType(endpoint, ['GenericAPIService.create', 'endpoint:URIValue'])
                MaybeJsonWebTokenType(token, ['GenericAPIService.create', 'token:?JsonWebToken'])
                fetch = fetch !== false
            
            
            Severity: Minor
            Found in js/services/generic.js - About 1 hr to fix

              Function AdminUsersController has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              export function AdminUsersController (ClientStorageService, UserService) {
                const self = this
                self.paginatedList = false
                self.p = new HttpProgress()
                self.l = new HttpProgress()
              Severity: Minor
              Found in js/controller/admin-users.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 RegisterController has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function RegisterController (app) {
                app
                  .config(['$stateProvider', ($stateProvider) => {
                    $stateProvider
                      .state('register', {
              Severity: Minor
              Found in js/controller/register.js - About 1 hr to fix

                Function MarkDownToHTMLDirective has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const MarkDownToHTMLDirective = ($location, $sanitize, $sce) => {
                  return {
                    restrict: 'A',
                    link: function (scope, element, attrs) {
                      scope.$watch('model', function (newValue) {
                Severity: Minor
                Found in js/directives/markdown-to-html.js - About 1 hr to fix

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

                  export function GenericController (Model, callbacks, createRelation, genericService) {
                    callbacks = _defaults(callbacks,
                      {
                        success: () => {
                          logger.appNotice('No success handler defined for generic controller for' + Model.$context)
                  Severity: Minor
                  Found in js/controller/generic.js - About 1 hr to fix

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

                      self.updateUserProperty = (property) => {
                        if (self.e.$active) {
                          return
                        }
                        if (self.userCopy[property] === self.user[property]) {
                    Severity: Minor
                    Found in js/controller/account-profile.js - About 1 hr to fix

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

                      export function AdminUserController ($rootScope, $timeout, $stateParams, IDService, ClientStorageService, UserService) {
                      Severity: Minor
                      Found in js/controller/admin-user.js - About 45 mins to fix

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

                        export const AvatarUploadDirective = (Upload, $timeout, imageService, ClientStorageService, TokenService) => ({
                          restrict: 'E',
                          scope: {
                            label: '=',
                            avatar: '=',
                        Severity: Minor
                        Found in js/directives/avatar-upload.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 setErrorStates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const setErrorStates = (element, modelCtrl) => {
                          const parent = element.parents('.form-group')
                          if (modelCtrl.$valid) {
                            element.addClass('form-control-success')
                            element.removeClass('form-control-danger')
                        Severity: Minor
                        Found in js/directives/bootstrap-error-states.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 GoogleAnalyticsService has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function GoogleAnalyticsService ($rootScope, $window, $location) {
                          let lastPath
                        
                          function track () {
                            let path = $location.path()
                        Severity: Minor
                        Found in js/services/google-analytics.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

                        Avoid too many return statements within this function.
                        Open

                                  return
                        Severity: Major
                        Found in js/controller/bluebird.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language