thepracticaldev/dev.to

View on GitHub

Showing 151 of 151 total issues

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

Help.propTypes = {
  previewShowing: PropTypes.bool.isRequired,
  helpFor: PropTypes.string.isRequired,
  helpPosition: PropTypes.string.isRequired,
  version: PropTypes.string.isRequired,
Severity: Major
Found in app/javascript/article-form/components/Help.jsx and 7 other locations - About 1 hr to fix
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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

SingleRepo.propTypes = {
  name: PropTypes.string.isRequired,
  githubIdCode: PropTypes.number.isRequired,
  fork: PropTypes.bool.isRequired,
  featured: PropTypes.bool.isRequired,
Severity: Major
Found in app/javascript/githubRepos/singleRepo.jsx and 7 other locations - About 1 hr to fix
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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

EmailPreferencesForm.propTypes = {
  prev: PropTypes.func.isRequired,
  next: PropTypes.string.isRequired,
  slidesCount: PropTypes.number.isRequired,
  currentSlideIndex: PropTypes.func.isRequired,
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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

SearchForm.propTypes = {
  searchTerm: PropTypes.string.isRequired,
  searchBoxId: PropTypes.string.isRequired,
  onSearch: PropTypes.func.isRequired,
  onSubmitSearch: PropTypes.func.isRequired,
Severity: Major
Found in app/javascript/Search/SearchForm.jsx and 7 other locations - About 1 hr to fix
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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

ListingForm.propTypes = {
  listing: PropTypes.string.isRequired,
  categoriesForDetails: PropTypes.string.isRequired,
  categoriesForSelect: PropTypes.string.isRequired,
  organizations: PropTypes.string.isRequired,
Severity: Major
Found in app/javascript/listings/listingForm.jsx and 7 other locations - About 1 hr to fix
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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

FollowUsers.propTypes = {
  prev: PropTypes.func.isRequired,
  next: PropTypes.string.isRequired,
  slidesCount: PropTypes.number.isRequired,
  currentSlideIndex: PropTypes.func.isRequired,
Severity: Major
Found in app/javascript/onboarding/components/FollowUsers.jsx and 7 other locations - About 1 hr to fix
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/EditorBody.jsx on lines 35..40
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..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 64.

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

EditorBody.propTypes = {
  onChange: PropTypes.func.isRequired,
  defaultValue: PropTypes.string.isRequired,
  switchHelpContext: PropTypes.func.isRequired,
  version: PropTypes.string.isRequired,
Severity: Major
Found in app/javascript/article-form/components/EditorBody.jsx and 7 other locations - About 1 hr to fix
app/javascript/Search/SearchForm.jsx on lines 32..37
app/javascript/article-form/components/Help.jsx on lines 308..313
app/javascript/githubRepos/singleRepo.jsx on lines 88..93
app/javascript/listings/listingForm.jsx on lines 137..142
app/javascript/onboarding/components/EmailPreferencesForm.jsx on lines 114..119
app/javascript/onboarding/components/FollowTags.jsx on lines 185..190
app/javascript/onboarding/components/FollowUsers.jsx on lines 213..218

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

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 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      chatChannel,
      currentMembership,
      activeMemberships,
Severity: Major
Found in app/javascript/chat/ChatChannelSettings/ChatChannelSettings.jsx - About 1 hr to fix

    Function Button has 61 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    export const Button = (props) => {
      const {
        children,
        variant = 'primary',
        tagName = 'button',
    Severity: Major
    Found in app/javascript/crayons/Button/Button.jsx - About 1 hr to fix

      Function callInitializers has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      function callInitializers() {
        initializeLocalStorageRender();
        initializeBodyData();
      
        var waitingForDataLoad = setInterval(function wait() {
      Severity: Major
      Found in app/assets/javascripts/initializePage.js - About 1 hr to fix

        Function render has 58 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

          render() {
            const {
              listings,
              query,
              tags,
        Severity: Major
        Found in app/javascript/listings/listings.jsx - About 1 hr to fix

          Function render has 57 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

            render() {
              const { email_newsletter, email_digest_periodic } = this.state;
              const { prev, slidesCount, currentSlideIndex } = this.props;
              return (
                <div
          Severity: Major
          Found in app/javascript/onboarding/components/EmailPreferencesForm.jsx - About 1 hr to fix

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

                if (document.getElementById('moderation-page')) {
                  moderationLink.blur();
                  moderationLink.classList.add('top-bar__link--current');
                } else {
                  moderationLink.classList.remove('top-bar__link--current');
            app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 7..12
            app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 13..18

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

            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 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

              render() {
                const {
                  next,
                  prev,
                  hideNext,
            Severity: Major
            Found in app/javascript/onboarding/components/Navigation.jsx - About 1 hr to fix

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

                  if (document.getElementById('chat')) {
                    connectLink.blur();
                    connectLink.classList.add('top-bar__link--current');
                  } else {
                    connectLink.classList.remove('top-bar__link--current');
              app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 7..12
              app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 19..24

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

              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

                  if (document.getElementById('notifications-container')) {
                    notificationsLink.blur();
                    notificationsLink.classList.add('top-bar__link--current');
                  } else {
                    notificationsLink.classList.remove('top-bar__link--current');
              app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 13..18
              app/assets/javascripts/initializers/initializeSpecialNavigationFunctionality.js on lines 19..24

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

              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 paginate has 52 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              function paginate(tag, params, requiresApproval) {
                const searchHash = {
                  ...{ per_page: 15, page: nextPage },
                  ...JSON.parse(params),
                };
              Severity: Major
              Found in app/assets/javascripts/initializers/initScrolling.js - About 1 hr to fix

                Function render has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                  render() {
                    const { visible, unopenedChannels } = this.state;
                    if (visible && unopenedChannels.some((channel) => !channel.notified)) {
                      const message = unopenedChannels.map((channel) => {
                        if (channel.notified) return null;
                Severity: Major
                Found in app/javascript/utilities/connect/getUnopenedChannels.jsx - About 1 hr to fix

                  Function slideContent has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  function slideContent(d) {
                    var ce = function (e, n) {
                        var a = document.createEvent('CustomEvent');
                        a.initCustomEvent(n, true, true, e.target);
                        e.target.dispatchEvent(a);
                  Severity: Major
                  Found in app/assets/javascripts/initializers/initializeSwipeGestures.js - About 1 hr to fix

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

                                      <tr>
                                        <td className="ff-monospace">`inline code`</td>
                                        <td>
                                          <code>inline code</code>
                                        </td>
                    Severity: Major
                    Found in app/javascript/article-form/components/Help.jsx and 2 other locations - About 1 hr to fix
                    app/javascript/article-form/components/Help.jsx on lines 158..163
                    app/javascript/article-form/components/Help.jsx on lines 164..169

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language