dustin-H/bauhaus-ui

View on GitHub

Showing 60 of 123 total issues

Function exports has 455 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function() {
  var app = express();

  app.use('/img', express.static(__dirname + '/img'))

Severity: Major
Found in example/testapi/app.js - About 2 days to fix

    Function loadLanguages has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

    export function loadLanguages(pack, cb) {
      if (Object.keys(pack).length > 0) {
        var state = store.getState().i18n
        var loadNow = null
        var fallbacks = []
    Severity: Minor
    Found in src/utils/i18n/index.js - About 1 day 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

    File app.js has 473 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var express = require('express');
    var bodyParser = require('body-parser');
    var jsonParser = bodyParser.json();
    var fs = require('fs');
    
    
    Severity: Minor
    Found in example/testapi/app.js - About 7 hrs to fix

      Function i18n has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function i18n(state = initialState, action) {
        switch (action.type) {
          case types.I18N_PARSE_LANGUAGE:
            var newState = Object.assign({}, state)
            var generals = {
      Severity: Minor
      Found in src/reducers/i18n.js - About 5 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 loadLanguages has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function loadLanguages(pack, cb) {
        if (Object.keys(pack).length > 0) {
          var state = store.getState().i18n
          var loadNow = null
          var fallbacks = []
      Severity: Major
      Found in src/utils/i18n/index.js - About 2 hrs to fix

        Function render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            const {state, actions} = this.props
            var content = (
            <span></span>
            )
        Severity: Major
        Found in src/components/SideBar/index.js - About 2 hrs to fix

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

          export default function i18n(state = initialState, action) {
            switch (action.type) {
              case types.I18N_PARSE_LANGUAGE:
                var newState = Object.assign({}, state)
                var generals = {
          Severity: Major
          Found in src/reducers/i18n.js - About 2 hrs to fix

            Function config has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function config(state = initialState, action) {
              switch (action.type) {
                case types.CONFIG_SET_PAGE:
                  if (pageTypes[action.page] != null) {
                    var newState = Object.assign({}, state)
            Severity: Minor
            Found in src/reducers/config.js - About 1 hr to fix

              Function matchPattern has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function matchPattern(pattern, pathname) {
                // Make leading slashes consistent between pattern and pathname.
                if (pattern.charAt(0) !== '/') {
                  pattern = `/${pattern}`
                }
              Severity: Minor
              Found in src/utils/router/pathMatcher.js - About 1 hr to fix

                Function loginSubmit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function loginSubmit() {
                  return (dispatch, getState) => {
                    dispatch(authLoginSubmit())
                    var state = getState()
                    superagent
                Severity: Minor
                Found in src/actions/auth.js - About 1 hr to fix

                  Function render has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const {state, actions} = this.props
                  
                      var errorOutput = (
                      <span></span>
                  Severity: Minor
                  Found in src/components/Login/index.js - About 1 hr to fix

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

                    export function checkLogin(err) {
                      return (dispatch, getState) => {
                        var state = getState()
                        //var a = state.auth.token !== ''
                        if (state.auth.token !== '' && state.auth.profile != null && state.auth.profile.firstname !== '' && state.auth.profile.lastname !== '' && state.auth.profile.avatarUrl !== '') {
                    Severity: Minor
                    Found in src/actions/auth.js - About 1 hr to fix

                      Function search has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function search(state = initialState, action) {
                        switch (action.type) {
                          case types.SEARCH_ACTIVATE:
                            var newState = Object.assign({}, state)
                            newState.active = true
                      Severity: Minor
                      Found in src/reducers/search.js - About 1 hr to fix

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

                        function _compilePattern(pattern) {
                          let regexpSource = ''
                          const paramNames = []
                          const tokens = []
                        
                        
                        Severity: Minor
                        Found in src/utils/router/pathMatcher.js - About 1 hr to fix

                          Function superagentPlugin has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var superagentPlugin = function(config = {}) {
                            if (config.disable == null) {
                              config.disable = {}
                            }
                            return function(request) {
                          Severity: Minor
                          Found in src/utils/helpers/superagentPlugin.js - About 1 hr to fix

                            Function matchPattern has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function matchPattern(pattern, pathname) {
                              // Make leading slashes consistent between pattern and pathname.
                              if (pattern.charAt(0) !== '/') {
                                pattern = `/${pattern}`
                              }
                            Severity: Minor
                            Found in src/utils/router/pathMatcher.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 auth has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function auth(state = initialState, action) {
                              switch (action.type) {
                                case types.AUTH_LOGIN_SUBMIT:
                                  var newState = Object.assign({}, state)
                                  newState.loginLoading = true
                            Severity: Minor
                            Found in src/reducers/auth.js - About 1 hr to fix

                              Function router has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function router(state = initialState, action) {
                                switch (action.type) {
                                  case types.ROUTER_LOCATION_CHANGED:
                                    var newState = Object.assign({}, state)
                                    newState.location = action.location
                              Severity: Minor
                              Found in src/reducers/router.js - About 1 hr to fix

                                Function loadModuleIfNecessary has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var loadModuleIfNecessary = function(id, cb) {
                                  if (store[id] != null) {
                                    if (store[id].state !== c.LOADING && store[id].state !== c.LOADED && store[id].url != null) {
                                      store[id].state = c.LOADING
                                      store[id].callbacks.push(cb)
                                Severity: Minor
                                Found in src/utils/moduleLoader/loader.js - About 1 hr to fix

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

                                    render() {
                                      const {state, actions} = this.props
                                      if (state.router.error === true) {
                                        return (
                                          <div className={ styles.center }>
                                  Severity: Minor
                                  Found in src/components/Route/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language