lancetw/react-isomorphic-bundle

View on GitHub

Showing 154 of 3,120 total issues

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

exports.fetchWithCount = function *(offset=0, limit=20, start, end, status=0) {
  let _start = start
  let _end = end

  if (!_start) {
Severity: Minor
Found in src/server/db/dao/posts/postsProvider.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 componentWillMount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  componentWillMount () {
    const { dispatch, location } = this.props
    const { store: { resolver, query } } = this.context

    if (query) {
Severity: Minor
Found in src/shared/components/CalHandler.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 componentDidUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidUpdate () {
    if (this.props.auth.isAuthenticated) {
      let path
      const { location } = this.context.history
      if (typeof location !== 'undefined') {
Severity: Minor
Found in src/shared/components/LoginComponent.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  render () {
    const Translate = require('react-translate-component')

    const LoadingClass = classNames(
      'ui',
Severity: Minor
Found in src/shared/components/ManageComponent.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 componentDidUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidUpdate () {
    if (this.props.auth.isAuthenticated) {
      let path
      const { location } = this.context.history
      if (typeof location !== 'undefined') {
Severity: Minor
Found in src/shared/components/TWBLoginComponent.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 map(result, (item) => mapKeys(item, (value, key) => camelCase(key)))
Severity: Major
Found in src/server/db/dao/locations/locationsProvider.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return null
    Severity: Major
    Found in src/server/db/dao/admins/adminsProvider.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return yield Post.findAll({
          offset: offset,
          limit: limit,
          order: [[ 'id', 'DESC' ]],
          where: {
      Severity: Major
      Found in src/server/db/dao/posts/postsProvider.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return fallBackLocale(locale)
        Severity: Major
        Found in src/shared/utils/locale-utils.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return obj
          Severity: Major
          Found in src/shared/utils/tongwen.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return dispatch({
                    type: LIST_CPROP_POST_FAILED,
                    errors: err.message,
                    cprop: cprop,
                    nocontent: nocontent
            Severity: Major
            Found in src/shared/actions/PostActions.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return obj
              Severity: Major
              Found in src/shared/utils/tongwen.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  if (!isFinite(parseFloat(pattern.dist))) return {}
                Severity: Major
                Found in src/server/db/dao/locations/locationsProvider.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return null
                  Severity: Major
                  Found in src/server/db/dao/users/usersProvider.js - About 30 mins to fix

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

                      handleChange (id, e) {
                        let checked = this.state.checked
                        if (e.target.checked) {
                          if (!includes(checked, id)) {
                            checked.push(id)
                    Severity: Minor
                    Found in src/client/admin/components/widget/TableWidget.js - 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

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

                      clearFormErrors () {
                        const options = clone(this.state.options)
                        options.fields = clone(options.fields)
                    
                        for (const key in options.fields) {
                    Severity: Minor
                    Found in src/shared/components/PostComponent.js - 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

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

                      componentWillReceiveProps (nextProps) {
                        checkUnauthorized(nextProps.post.errors, this.context.history.replaceState)
                    
                        if (!this.state.formInited) {
                          const { id } = this.props.params
                    Severity: Minor
                    Found in src/shared/components/PostComponent.js - 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

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

                      renderCounter (index) {
                        if (index === 0) {
                          const count = isFinite(this.props.collect.count) ? this.props.collect.count : '-'
                          return (
                            <div className="ui teal label">{count}</div>
                    Severity: Minor
                    Found in src/client/admin/components/widget/NavWidget.js - 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

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

                    module.exports = (imagePath) => {
                      if (process.env.BROWSER) {
                        throw new Error('image-resolver called on browser')
                      } else {
                        let images
                    Severity: Minor
                    Found in src/shared/utils/image-resolver.js - 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

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

                      clearFormErrors () {
                        const options = clone(this.state.options)
                        options.fields = clone(options.fields)
                    
                        for (const key in options.fields) {
                    Severity: Minor
                    Found in src/shared/components/SignupComponent.js - 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