dustin-H/bauhaus-ui

View on GitHub

Showing 60 of 123 total issues

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

export function load() {
  return (dispatch, getState) => {
    var state = getState().config
    if (state.config.length > 0 && state.loaded === false) {
      var configUrl = state.config[0]
Severity: Minor
Found in src/actions/config.js - About 1 hr to fix

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

      getContent(state, actions) {
        if (state.search.error === true) {
          return (
            <div className={ styles.center }>
              <br/>
    Severity: Minor
    Found in src/components/Search/index.js - About 1 hr to fix

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

      module.exports = function(){
        var app = express()
      
        var theData = {};
      
      
      Severity: Minor
      Found in example/api/jsondata.js - About 1 hr to fix

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

        export function $(id) {
          if (typeof id !== 'string' || id[0] !== '$') {
            return id
          } else {
            id = id.substr(1)
        Severity: Minor
        Found in src/utils/i18n/index.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 loadModuleIfNecessary has a Cognitive Complexity of 10 (exceeds 5 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

        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 _compilePattern has a Cognitive Complexity of 10 (exceeds 5 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

        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 $ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function $(id) {
          if (typeof id !== 'string' || id[0] !== '$') {
            return id
          } else {
            id = id.substr(1)
        Severity: Minor
        Found in src/utils/i18n/index.js - About 1 hr to fix

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

              request.end = function(fn) {
                if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
                  request = request.set(state.auth.header, state.auth.token)
                }
                request._end(function(err, res) { // TODO: REFACTOR THIS
          Severity: Minor
          Found in src/utils/helpers/superagentPlugin.js - About 1 hr to fix

            Function parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            var parse = function(data, packurl) {
              var arr = data.split('\n')
              var list = []
              for (var i in arr) {
                var temp = null
            Severity: Minor
            Found in src/utils/i18n/loader.js - About 55 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 deeply nested control flow statements.
            Open

                      if (i === 'en') {
                        break
                      }
            Severity: Major
            Found in src/utils/i18n/index.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (newState.store[ln] == null) {
                            newState.store[ln] = {}
                          }
              Severity: Major
              Found in src/reducers/i18n.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if (id == null) {
                              console.warn('> Missing id!')
                            }
                Severity: Major
                Found in src/reducers/i18n.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (ln == null) {
                                console.warn('> Missing language!')
                              }
                  Severity: Major
                  Found in src/reducers/i18n.js - About 45 mins to fix

                    Function findModules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function findModules(obj) {
                      var arr = []
                      if (obj.name != null && typeof obj.name === 'string') {
                        arr.push(obj.name)
                        if (obj.components != null && typeof obj.components === 'object') {
                    Severity: Minor
                    Found in src/utils/moduleLoader/index.js - About 45 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 deeply nested control flow statements.
                    Open

                              if (pack[state.languages[i]].complete === true) {
                                isComplete = true
                                fallbacks.push(pack[state.languages[i]].url)
                                break
                              }
                    Severity: Major
                    Found in src/utils/i18n/index.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (i === 'en') {
                                  break
                                }
                      Severity: Major
                      Found in src/utils/i18n/index.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (pack[state.languages[i]].complete === true) {
                                    isComplete = true
                                    break
                                  }
                        Severity: Major
                        Found in src/utils/i18n/index.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (i === 'en') {
                                      break
                                    }
                          Severity: Major
                          Found in src/utils/i18n/index.js - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                  if (config.auth === true && state.auth.token != null && state.auth.token !== '' && state.auth.error === false && state.auth.header != null && state.auth.header !== '') {
                                    request = request.set(state.auth.header, state.auth.token)
                                  }
                            Severity: Major
                            Found in src/utils/helpers/superagentPlugin.js - About 40 mins to fix

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

                              var matchRoutes = function(routes, location) {
                                for (var i in routes) {
                                  var route = routes[i]
                                  var match = pathMatcher(route.route, location.pathname)
                                  if (match.paramValues != null && match.paramNames != null && match.paramValues.length === match.paramNames.length) {
                              Severity: Minor
                              Found in src/utils/router/routesMatcher.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

                              Severity
                              Category
                              Status
                              Source
                              Language