f96q/kptboard

View on GitHub

Showing 13 of 13 total issues

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

            <div className="Retrospective-boards" ref="problem" onClick={this.openLabelForm.bind(this)}>
              <h4 className="Retrospective-boardTitle">Problem</h4>
               <div className="Retrospective-boardLabels" onDrop={this.onDrop.bind(this)} onDragOver={this.onDragOver.bind(this)}>
                {this.props.labels.problem.map(label => <Label key={label.id} label={label} ref={`label_${label.id}`} destroyLabel={this.props.destroyLabel} openEditLabelModal={this.props.openEditLabelModal} dragStartLabel={this.props.dragStartLabel} dragEndLabel={this.props.dragEndLabel} />)}
              </div>
Severity: Major
Found in app/javascripts/components/Retrospective.js and 1 other location - About 1 day to fix
app/javascripts/components/Retrospective.js on lines 70..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 247.

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

            <div className="Retrospective-board" ref="try" onClick={this.openLabelForm.bind(this)}>
              <h4 className="Retrospective-boardTitle">Try</h4>
              <div className="Retrospective-boardLabels" onDrop={this.onDrop.bind(this)} onDragOver={this.onDragOver.bind(this)}>
                {this.props.labels.try.map(label => <Label key={label.id} label={label} ref={`label_${label.id}`} destroyLabel={this.props.destroyLabel} openEditLabelModal={this.props.openEditLabelModal} dragStartLabel={this.props.dragStartLabel} dragEndLabel={this.props.dragEndLabel} />)}
              </div>
Severity: Major
Found in app/javascripts/components/Retrospective.js and 1 other location - About 1 day to fix
app/javascripts/components/Retrospective.js on lines 62..67

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

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

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

            export const reducer = createReducer(initialState)
              .case(setRetrospective, (state, payload) => {
                return {
                  ...state,
                  labels: payload.retrospective.labels
            Severity: Minor
            Found in app/javascripts/reducers/label.js and 1 other location - About 35 mins to fix
            app/javascripts/reducers/user.js on lines 23..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 46.

            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

            export const reducer = createReducer(initialState)
              .case(setRetrospective, (state, payload) => {
                return {
                  ...state,
                  users: payload.retrospective.users
            Severity: Minor
            Found in app/javascripts/reducers/user.js and 1 other location - About 35 mins to fix
            app/javascripts/reducers/label.js on lines 60..82

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

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