shakacode/react-webpack-rails-tutorial

View on GitHub

Showing 41 of 41 total issues

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

          <div className="flex flex-col gap-0">
            <label htmlFor="stackedAuthorNode" className="w-full">
              {formatMessage(defaultMessages.inputNameLabel)}
            </label>
            <input
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 105..119
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 121..135
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 176..190

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

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

          <div className="flex flex-col gap-0 items-center lg:gap-4 lg:flex-row">
            <label htmlFor="horizontalAuthorNode" className="w-full lg:w-2/12 lg:text-end shrink-0">
              {formatMessage(defaultMessages.inputNameLabel)}
            </label>
            <input
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 121..135
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 160..174
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 176..190

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

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

          <div className="flex flex-col gap-0 items-center lg:gap-4 lg:flex-row">
            <label htmlFor="horizontalTextNode" className="w-full lg:w-2/12 lg:text-end shrink-0">
              {formatMessage(defaultMessages.inputTextLabel)}
            </label>
            <input
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 105..119
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 160..174
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 176..190

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

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

          <div className="flex flex-col gap-0">
            <label htmlFor="stackedTextNode" className="w-full">
              {formatMessage(defaultMessages.inputTextLabel)}
            </label>
            <input
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 105..119
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 121..135
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 160..174

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

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="flex gap-2 items-center">
            <label htmlFor="inlineAuthorNode">{formatMessage(defaultMessages.inputNameLabel)}</label>
            <input
              type="text"
              id="inlineAuthorNode"
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 229..241

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

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="flex gap-2 items-center">
            <label htmlFor="inlineTextNode">{formatMessage(defaultMessages.inputTextLabel)}</label>
            <input
              type="textarea"
              id="inlineTextNode"
client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 215..227

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

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 NavigationBar has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function NavigationBar(props) {
  const { commentsCount, pathname } = props;

  const [isOpen, setIsOpen] = useState(false);

    File CommentForm.jsx has 316 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable react/no-find-dom-node, react/no-string-refs */
    import React from 'react';
    import PropTypes from 'prop-types';
    import ReactDOM from 'react-dom';
    import { CSSTransition, TransitionGroup } from 'react-transition-group';

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

                <div className="flex flex-col gap-0">
                  <button
                    type="submit"
                    className="self-start px-3 py-1 font-semibold border-0 rounded text-sky-50 bg-sky-600 hover:bg-sky-800"
                    disabled={this.props.isSaving}
      client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 243..253

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

      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="flex gap-2">
                  <button
                    type="submit"
                    className="self-start px-3 py-1 font-semibold border-0 rounded text-sky-50 bg-sky-600 hover:bg-sky-800"
                    disabled={this.props.isSaving}
      client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 192..202

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

      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 commentsReducer has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function commentsReducer($$state = $$initialState, action = null) {
        const { type, comment, comments, error, locale } = action;
      
        switch (type) {
          case actionTypes.FETCH_COMMENTS_SUCCESS: {
      Severity: Major
      Found in client/app/bundles/comments/reducers/commentsReducer.js - About 2 hrs to fix

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

                  <button
                    type="button"
                    className={`px-6 py-2 font-semibold border-0 rounded ${
                      this.state.formMode === 1 ? 'text-sky-50 bg-sky-600' : 'text-sky-600 hover:bg-gray-100'
                    }`}
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 324..332
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 342..350

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

        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

                  <button
                    type="button"
                    className={`px-6 py-2 font-semibold border-0 rounded ${
                      this.state.formMode === 0 ? 'text-sky-50 bg-sky-600' : 'text-sky-600 hover:bg-gray-100'
                    }`}
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 333..341
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 342..350

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

        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

                  <button
                    type="button"
                    className={`px-6 py-2 font-semibold border-0 rounded ${
                      this.state.formMode === 2 ? 'text-sky-50 bg-sky-600' : 'text-sky-600 hover:bg-gray-100'
                    }`}
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 324..332
        client/app/bundles/comments/components/CommentBox/CommentForm/CommentForm.jsx on lines 333..341

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

        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 render has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            let inputForm;
            switch (this.state.formMode) {
              case 0:
                inputForm = this.formHorizontal();

          Function formHorizontal has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            formHorizontal() {
              const { formatMessage } = this.props.intl;
              return (
                <div>
                  <hr />

            Function formStacked has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              formStacked() {
                const { formatMessage } = this.props.intl;
                return (
                  <div>
                    <hr />

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

                render() {
                  const { actions, data, intl } = this.props;
                  const { formatMessage } = intl;
                  const cssTransitionGroupClassNames = {
                    enter: css.elementEnter,
              Severity: Minor
              Found in client/app/bundles/comments/components/CommentBox/CommentBox.jsx - About 1 hr to fix

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

                  it('shows the author', () => {
                    const component = renderIntoDocument(<Comment author="Frank" text="Hi!" />);
                
                    const author = findRenderedDOMComponentWithClass(component, 'js-comment-author');
                    expect(author.textContent).toEqual('Frank');
                client/app/bundles/comments/components/CommentBox/CommentList/Comment/Comment.spec.jsx on lines 26..31

                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 formInline has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  formInline() {
                    const { formatMessage } = this.props.intl;
                    return (
                      <div>
                        <hr />
                  Severity
                  Category
                  Status
                  Source
                  Language