lancetw/react-isomorphic-bundle

View on GitHub

Showing 154 of 3,120 total issues

Function listByYearMonth has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.listByYearMonth = function *(year, month) {
  let _year = year
  let _month = month
  let totalDays

Severity: Major
Found in src/server/db/dao/statistics/statisticsProvider.js - About 3 hrs to fix

    File posts.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Resource from 'koa-resource-router'
    import validate from 'parameter'
    import parse from 'co-body'
    import hashids from 'src/shared/utils/hashids-plus'
    import RestAuth from 'src/server/passport/auth/rest-auth'
    Severity: Minor
    Found in src/server/services/v1/posts.js - About 3 hrs to fix

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

        render () {
          const Translate = require('react-translate-component')
      
          const Message = this.state.pleaseLogin
            ? (
      Severity: Major
      Found in src/shared/components/LoginComponent.js - About 3 hrs to fix

        Function handleCreateClick has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          handleCreateClick () {
            swal({
              title: '新增管理者',
              text: '請輸入 Email',
              type: 'input',
        Severity: Major
        Found in src/client/admin/components/widget/PermissionsTableWidget.js - About 3 hrs to fix

          Function update has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            update: [ RestAuth, function *(next) {
              const body = yield parse(this)
          
              const rule = {
                uid: { type: 'string' },
          Severity: Minor
          Found in src/server/services/v1/posts.js - About 3 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 render has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render () {
              const Translate = require('react-translate-component')
          
              const DegreeMenu = (
                <div className="ui compact small menu">
          Severity: Major
          Found in src/shared/components/addon/maps/search-menu.js - About 3 hrs to fix

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

              render () {
                const Translate = require('react-translate-component')
            
                const pinClasses = classNames(
                  'pin',
            Severity: Major
            Found in src/shared/components/addon/maps/marker.js - About 3 hrs to fix

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

                render () {
                  const { items, countPosts, countUsers, year, month } = this.props.collect
              
                  return (
                    <main className="ui column page grid container">
              Severity: Major
              Found in src/client/admin/components/StatisticsComponent.js - About 3 hrs to fix

                File PermissionsTableWidget.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { Component, PropTypes } from 'react'
                import { isEmpty, includes, without } from 'lodash'
                import classNames from 'classnames'
                import { toDate } from 'shared/utils/date-utils'
                import {
                Severity: Minor
                Found in src/client/admin/components/widget/PermissionsTableWidget.js - About 2 hrs to fix

                  Function update has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    update: [ RestAuth, function *(next) {
                      const body = this.request.body
                      const rule = {
                        uid: { type: 'string' },
                        type: { type: 'string' },
                  Severity: Major
                  Found in src/server/services/admin/v1/posts.js - About 2 hrs to fix

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

                      render () {
                        const { items } = this.props.collect
                        const handleChange = ::this.handleChange
                        const isChecked = ::this.isChecked
                        const handleChangePasswordClick = ::this.handleChangePasswordClick
                    Severity: Major
                    Found in src/client/admin/components/widget/PermissionsTableWidget.js - About 2 hrs to fix

                      Function create has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                        create: [ RestAuth, function *(next) {
                          const body = yield parse(this)
                          const rule = {
                            uid: { type: 'string' },
                            type: { type: 'string' },
                      Severity: Minor
                      Found in src/server/services/v1/posts.js - About 2 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 ManageFormOptionsI18n has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const ManageFormOptionsI18n = function (locale) {
                        return {
                          auto: 'none',
                          fields: {
                            ocname: {
                      Severity: Major
                      Found in src/shared/utils/forms.js - About 2 hrs to fix

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

                          render () {
                            const Translate = require('react-translate-component')
                            const { posts } = this.props.post
                            const loading = this.props.post.isFetching
                        
                        
                        Severity: Major
                        Found in src/shared/components/HomeComponent.js - About 2 hrs to fix

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

                            render () {
                              const LoadingClass = classNames(
                                'ui',
                                'form',
                                'segment',
                          Severity: Major
                          Found in src/shared/components/SignupComponent.js - About 2 hrs to fix

                            Function update has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              update: [ RestAuth, function *(next) {
                                const body = yield parse(this)
                            
                                const rule = {
                                  ocname: { type: 'string', required: true },
                            Severity: Major
                            Found in src/server/services/v1/usersInfo.js - About 2 hrs to fix

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

                                render () {
                                  const Translate = require('react-translate-component')
                                  const { post } = this.props
                                  const loading = post.isFetching || false
                                  const { selectedDay } = this.state
                              Severity: Major
                              Found in src/shared/components/CalComponent.js - About 2 hrs to fix

                                Post has 23 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                export default class Post extends Component {
                                
                                  static propTypes = {
                                    submit: PropTypes.func.isRequired,
                                    modify: PropTypes.func.isRequired,
                                Severity: Minor
                                Found in src/shared/components/PostComponent.js - About 2 hrs to fix

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

                                    render () {
                                      const { detail } = this.props.collect
                                  
                                      if (isEmpty(detail)) {
                                        return (
                                  Severity: Major
                                  Found in src/client/admin/components/widget/DetailWidget.js - About 2 hrs to fix

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

                                      render () {
                                        const card = this.props.data
                                    
                                        const eventDate = (card.startDate === card.endDate)
                                        ? toShortDate(card.endDate)
                                    Severity: Major
                                    Found in src/shared/components/wall/PostCard.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language