dustin-H/bauhaus-ui

View on GitHub

Showing 123 of 123 total issues

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

          if (res.body.profile.avatarUrl == null || typeof res.body.profile.avatarUrl !== 'string') {
            console.error('Auth profile.avatarUrl is missing or not a string!')
            return dispatch(changePage(pageTypes.LOGIN))
          }
Severity: Major
Found in src/actions/auth.js and 2 other locations - About 1 hr to fix
src/actions/auth.js on lines 76..79
src/actions/auth.js on lines 80..83

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

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

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

                      if (res.body.profile.lastname == null || typeof res.body.profile.lastname !== 'string') {
                        console.error('Auth profile.lastname is missing or not a string!')
                        return dispatch(loginError())
                      }
              Severity: Major
              Found in src/actions/auth.js and 2 other locations - About 1 hr to fix
              src/actions/auth.js on lines 122..125
              src/actions/auth.js on lines 130..133

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

              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 3 locations. Consider refactoring.
              Open

                      if (res.body.profile.avatarUrl == null || typeof res.body.profile.avatarUrl !== 'string') {
                        console.error('Auth profile.avatarUrl is missing or not a string!')
                        return dispatch(loginError())
                      }
              Severity: Major
              Found in src/actions/auth.js and 2 other locations - About 1 hr to fix
              src/actions/auth.js on lines 122..125
              src/actions/auth.js on lines 126..129

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

              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 3 locations. Consider refactoring.
              Open

                      if (res.body.profile.firstname == null || typeof res.body.profile.firstname !== 'string') {
                        console.error('Auth profile.firstname is missing or not a string!')
                        return dispatch(loginError())
                      }
              Severity: Major
              Found in src/actions/auth.js and 2 other locations - About 1 hr to fix
              src/actions/auth.js on lines 126..129
              src/actions/auth.js on lines 130..133

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

              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 _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

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

                        }, {
                          name: 'Label',
                          props: {
                            text: 'Content'
                          },
                Severity: Major
                Found in example/testapi/app.js and 1 other location - About 1 hr to fix
                example/testapi/app.js on lines 249..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 65.

                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

                          components: [{
                            name: 'Label',
                            props: {
                              text: 'Scribe Input'
                            },
                Severity: Major
                Found in example/testapi/app.js and 1 other location - About 1 hr to fix
                example/testapi/app.js on lines 375..392

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

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

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

                            if (res.body.token == null || typeof res.body.token !== 'string') {
                              console.error('Auth token is missing or not a string!')
                              return dispatch(changePage(pageTypes.LOGIN))
                            }
                  Severity: Major
                  Found in src/actions/auth.js and 1 other location - About 1 hr to fix
                  src/actions/auth.js on lines 72..75

                  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

                      if (state.router.loading === true) {
                        return (
                          <div className={ styles.center }>
                            <br/><img src="media/loader.gif" /></div>
                        )
                  Severity: Major
                  Found in src/components/Router/index.js and 1 other location - About 1 hr to fix
                  src/components/Route/index.js on lines 30..35

                  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

                            if (res.body.profile == null || typeof res.body.profile !== 'object') {
                              console.error('Auth profile is missing or not an object!')
                              return dispatch(changePage(pageTypes.LOGIN))
                            }
                  Severity: Major
                  Found in src/actions/auth.js and 1 other location - About 1 hr to fix
                  src/actions/auth.js on lines 68..71

                  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

                      if (state.content.loading === true) {
                        return (
                          <div className={ styles.center }>
                            <br/><img src="media/loader.gif" /></div>
                        )
                  Severity: Major
                  Found in src/components/Route/index.js and 1 other location - About 1 hr to fix
                  src/components/Router/index.js on lines 13..18

                  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

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language