f96q/kptboard

View on GitHub

Showing 9 of 13 total issues

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

export const LabelModal = (props) => {
  const { labelModal } = useSelector(state => ({
    labelModal: state.label.labelModal
  }))

Severity: Major
Found in app/javascripts/components/LabelModal.js - About 2 hrs to fix

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

    export const ActionCable = (props) => {
      const dispatch = useDispatch()
    
      useEffect(() => {
        const cable = actioncable.createConsumer()
    Severity: Minor
    Found in app/javascripts/components/ActionCable.js - About 1 hr to fix

      Function UserList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const UserList = (props) => {
        const { users, email } = useSelector(state => ({
          users: state.user.users,
          email: state.user.email
        }))
      Severity: Minor
      Found in app/javascripts/components/UserList.js - About 1 hr to fix

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

            const received = (data) => {
              const result = humps.camelizeKeys(data)
              switch (result.type) {
                case 'SET_RETROSPECTIVE':
                  dispatch(actions.global.setRetrospective({ retrospective: result.retrospective }))
        Severity: Minor
        Found in app/javascripts/components/ActionCable.js - About 1 hr to fix

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

            render() {
              return (
                <div className="Retrospective">
                  <div className="Retrospective-content">
                    <div className="Retrospective-boards">
          Severity: Minor
          Found in app/javascripts/components/Retrospective.js - About 1 hr to fix

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

              closestLabelIndex(kind, target) {
                for (let i in this.props.labels[kind]) {
                  const label = this.props.labels[kind][i]
                  const node = findDOMNode(this.refs[`label_${label.id}`])
                  if (node == null) continue
            Severity: Minor
            Found in app/javascripts/components/Retrospective.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 findLabelPosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function findLabelPosition(labels, id) {
              for (let kind of ['keep', 'problem', 'try']) {
                for (let i = 0;  i < labels[kind].length; i++) {
                  const label = labels[kind][i]
                  if (label.id == id) {
            Severity: Minor
            Found in app/javascripts/reducers/label.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

            Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def create(data)
                return unless authenticate_retrospective?
                @user = User.find_by(email: data['email'])
                unless @user
                  broadcast_to(type: 'SET_ALERT', alert: { type: 'error', messages: [I18n.t('channels.retrospectives.not_found_user')] })
            Severity: Minor
            Found in app/channels/retrospectives_users_channel.rb - 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 LabelModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const LabelModal = (props) => {
              const { labelModal } = useSelector(state => ({
                labelModal: state.label.labelModal
              }))
            
            
            Severity: Minor
            Found in app/javascripts/components/LabelModal.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