thepracticaldev/dev.to

View on GitHub

Showing 156 of 156 total issues

Function initializeCommentDropdown has 127 lines of code (exceeds 50 allowed). Consider refactoring.
Open

function initializeCommentDropdown() {
  const announcer = document.getElementById('article-copy-link-announcer');

  function isClipboardSupported() {
    return (
Severity: Major
Found in app/assets/javascripts/initializers/initializeCommentDropdown.js - About 4 hrs to fix

    File users_controller.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class UsersController < ApplicationController
      before_action :set_no_cache_header
      before_action :raise_suspended, only: %i[update]
      before_action :set_user, only: %i[
        update update_twitch_username update_language_settings confirm_destroy request_destroy full_delete remove_identity
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 4 hrs to fix

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

        render() {
          const {
            slidesCount,
            currentSlideIndex,
            prev,
      Severity: Major
      Found in app/javascript/onboarding/components/IntroSlide.jsx - About 3 hrs to fix

        File articleForm.jsx has 319 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { h, Component } from 'preact';
        import PropTypes from 'prop-types';
        import linkState from 'linkstate';
        import postscribe from 'postscribe';
        import { submitArticle, previewArticle } from './actions';
        Severity: Minor
        Found in app/javascript/article-form/articleForm.jsx - About 3 hrs to fix

          File actionsPanel.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { request } from '@utilities/http';
          
          export function addCloseListener() {
            const button = document.querySelector('.close-actions-panel');
            button.addEventListener('click', () => {
          Severity: Minor
          Found in app/javascript/actionsPanel/actionsPanel.js - About 3 hrs to fix

            File buildArticleHTML.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* global timeAgo, filterXSS */
            
            /* eslint-disable no-multi-str */
            
            function buildArticleHTML(article) {
            Severity: Minor
            Found in app/assets/javascripts/utilities/buildArticleHTML.js - About 3 hrs to fix

              Function ImageUploader has 108 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              export const ImageUploader = () => {
                const [state, dispatch] = useReducer(imageUploaderReducer, {
                  insertionImageUrls: [],
                  uploadError: false,
                  uploadErrorMessage: null,
              Severity: Major
              Found in app/javascript/article-form/components/ImageUploader.jsx - About 3 hrs to fix

                Class Reaction has 27 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Reaction < ApplicationRecord
                  include Searchable
                  BASE_POINTS = {
                    "vomit" => -50.0,
                    "thumbsup" => 5.0,
                Severity: Minor
                Found in app/models/reaction.rb - About 3 hrs to fix

                  File Help.jsx has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { h, Component } from 'preact';
                  import PropTypes from 'prop-types';
                  import { Modal } from '@crayons';
                  
                  export class Help extends Component {
                  Severity: Minor
                  Found in app/javascript/article-form/components/Help.jsx - About 3 hrs to fix

                    Function initBlock has 97 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    export default function initBlock() {
                      const blockButton = document.getElementById(
                        'user-profile-dropdownmenu-block-button',
                      );
                      if (!blockButton) {
                    Severity: Major
                    Found in app/javascript/profileDropdown/blockButton.js - About 2 hrs to fix

                      Class MarkdownParser has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class MarkdownParser
                        include ApplicationHelper
                        include CloudinaryHelper
                      
                        BAD_XSS_REGEX = [
                      Severity: Minor
                      Found in app/labor/markdown_parser.rb - About 2 hrs to fix

                        File listings.jsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { h, Component } from 'preact';
                        import debounceAction from '../utilities/debounceAction';
                        import { fetchSearch } from '../utilities/search';
                        import ModalBackground from './components/ModalBackground';
                        import Modal from './components/Modal';
                        Severity: Minor
                        Found in app/javascript/listings/listings.jsx - About 2 hrs to fix

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

                            render() {
                              const {
                                prev,
                                slidesCount,
                                currentSlideIndex,
                          Severity: Major
                          Found in app/javascript/onboarding/components/ProfileForm.jsx - About 2 hrs to fix

                            Class Generator has 24 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                class Generator
                                  def initialize(receiver_id)
                                    @user = User.find(receiver_id)
                                    @notification_enqueued = false
                                  end
                            Severity: Minor
                            Found in app/services/broadcasts/welcome_notification/generator.rb - About 2 hrs to fix

                              File user_subscription_tag.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              class UserSubscriptionTag < LiquidTagBase
                                PARTIAL = "liquids/user_subscription".freeze
                                VALID_CONTEXTS = %w[Article].freeze
                                VALID_ROLES = [
                                  :admin,
                              Severity: Minor
                              Found in app/liquid_tags/user_subscription_tag.rb - About 2 hrs to fix

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

                                const CopyIcon = () => (
                                  <svg
                                    width="24"
                                    height="24"
                                    viewBox="0 0 24 24"
                                app/javascript/article-form/components/ClipboardButton.jsx on lines 9..22
                                app/javascript/article-form/components/Close.jsx on lines 5..18
                                app/javascript/article-form/components/EditorActions.jsx on lines 6..19
                                app/javascript/article-form/components/ImageUploader.jsx on lines 22..35
                                app/javascript/crayons/Modal/Modal.jsx on lines 20..33

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

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

                                const CopyIcon = () => (
                                  <svg
                                    width="24"
                                    height="24"
                                    viewBox="0 0 24 24"
                                Severity: Major
                                Found in app/javascript/article-form/components/ClipboardButton.jsx and 5 other locations - About 2 hrs to fix
                                app/javascript/chat/ChatChannelSettings/MembershipManager/InvitationLinkManager.jsx on lines 13..26
                                app/javascript/article-form/components/Close.jsx on lines 5..18
                                app/javascript/article-form/components/EditorActions.jsx on lines 6..19
                                app/javascript/article-form/components/ImageUploader.jsx on lines 22..35
                                app/javascript/crayons/Modal/Modal.jsx on lines 20..33

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

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

                                const CloseIcon = () => (
                                  <svg
                                    width="24"
                                    height="24"
                                    viewBox="0 0 24 24"
                                Severity: Major
                                Found in app/javascript/crayons/Modal/Modal.jsx and 5 other locations - About 2 hrs to fix
                                app/javascript/chat/ChatChannelSettings/MembershipManager/InvitationLinkManager.jsx on lines 13..26
                                app/javascript/article-form/components/ClipboardButton.jsx on lines 9..22
                                app/javascript/article-form/components/Close.jsx on lines 5..18
                                app/javascript/article-form/components/EditorActions.jsx on lines 6..19
                                app/javascript/article-form/components/ImageUploader.jsx on lines 22..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 87.

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

                                  const Icon = () => (
                                    <svg
                                      width="24"
                                      height="24"
                                      viewBox="0 0 24 24"
                                Severity: Major
                                Found in app/javascript/article-form/components/Close.jsx and 5 other locations - About 2 hrs to fix
                                app/javascript/chat/ChatChannelSettings/MembershipManager/InvitationLinkManager.jsx on lines 13..26
                                app/javascript/article-form/components/ClipboardButton.jsx on lines 9..22
                                app/javascript/article-form/components/EditorActions.jsx on lines 6..19
                                app/javascript/article-form/components/ImageUploader.jsx on lines 22..35
                                app/javascript/crayons/Modal/Modal.jsx on lines 20..33

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

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

                                const Icon = () => (
                                  <svg
                                    width="24"
                                    className="crayons-icon"
                                    height="24"
                                Severity: Major
                                Found in app/javascript/article-form/components/EditorActions.jsx and 5 other locations - About 2 hrs to fix
                                app/javascript/chat/ChatChannelSettings/MembershipManager/InvitationLinkManager.jsx on lines 13..26
                                app/javascript/article-form/components/ClipboardButton.jsx on lines 9..22
                                app/javascript/article-form/components/Close.jsx on lines 5..18
                                app/javascript/article-form/components/ImageUploader.jsx on lines 22..35
                                app/javascript/crayons/Modal/Modal.jsx on lines 20..33

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

                                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