thepracticaldev/dev.to

View on GitHub

Showing 134 of 163 total issues

File chat.jsx has 1848 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
  eslint-disable
  consistent-return, no-unused-vars, react/destructuring-assignment,
  react/no-access-state-in-setstate, react/button-has-type
*/
Severity: Major
Found in app/javascript/chat/chat.jsx - About 5 days to fix

    Function initializePodcastPlayback has 498 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    function initializePodcastPlayback() {
      var deviceType = 'web';
    
      function getById(name) {
        return document.getElementById(name);
    Severity: Major
    Found in app/assets/javascripts/initializers/initializePodcastPlayback.js - About 2 days to fix

      Chat has 86 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class Chat extends Component {
        static propTypes = {
          pusherKey: PropTypes.number.isRequired,
          chatChannels: PropTypes.string.isRequired,
          chatOptions: PropTypes.string.isRequired,
      Severity: Major
      Found in app/javascript/chat/chat.jsx - About 1 day to fix

        Class User has 78 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class User < ApplicationRecord
          resourcify
        
          include CloudinaryHelper
          include Searchable
        Severity: Major
        Found in app/models/user.rb - About 1 day to fix

          Function buildArticleHTML has 292 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          function buildArticleHTML(article) {
            if (article && article.class_name === 'PodcastEpisode') {
              return `<article class="crayons-story crayons-podcast-episode mb-2">
                  <div class="crayons-story__body flex flex-start">
                    <a href="${article.podcast.slug}" class="crayons-podcast-episode__cover">
          Severity: Major
          Found in app/assets/javascripts/utilities/buildArticleHTML.js - About 1 day to fix

            File user.rb has 523 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class User < ApplicationRecord
              resourcify
            
              include CloudinaryHelper
              include Searchable
            Severity: Major
            Found in app/models/user.rb - About 1 day to fix

              File initializePodcastPlayback.js has 501 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * This script hunts for podcast's "Record" for both the podcast_episde's
               * show page and an article page containing podcast liquid tag. It handles
               * playback and makes sure the record will spin when the podcast is currently
               * playing.
              Severity: Major
              Found in app/assets/javascripts/initializers/initializePodcastPlayback.js - About 1 day to fix

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

                  render() {
                    const {
                      listings,
                      orgListings,
                      userCredits,
                Severity: Major
                Found in app/javascript/listings/listingDashboard.jsx - About 6 hrs to fix

                  File stories_controller.rb has 416 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class StoriesController < ApplicationController
                    DEFAULT_HOME_FEED_ATTRIBUTES_FOR_SERIALIZATION = {
                      only: %i[
                        title path id user_id comments_count public_reactions_count organization_id
                        reading_time video_thumbnail_url video video_duration_in_minutes language
                  Severity: Minor
                  Found in app/controllers/stories_controller.rb - About 6 hrs to fix

                    File initScrolling.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* global insertAfter, insertArticles, buildArticleHTML, nextPage:writable, fetching:writable, done:writable, InstantClick */
                    
                    var client;
                    
                    function fetchNext(el, endpoint, insertCallback) {
                    Severity: Minor
                    Found in app/assets/javascripts/initializers/initScrolling.js - About 5 hrs to fix

                      File tags.jsx has 409 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { h, Component } from 'preact';
                      import PropTypes from 'prop-types';
                      import { fetchSearch } from '../../utilities/search';
                      
                      const KEYS = {
                      Severity: Minor
                      Found in app/javascript/shared/components/tags.jsx - About 5 hrs to fix

                        File ChatChannelSettings.jsx has 403 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { h, Component } from 'preact';
                        import PropTypes from 'prop-types';
                        
                        import {
                          getChannelDetails,
                        Severity: Minor
                        Found in app/javascript/chat/ChatChannelSettings/ChatChannelSettings.jsx - About 5 hrs to fix

                          Class Comment has 42 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Comment < ApplicationRecord
                            has_ancestry
                            resourcify
                          
                            include Reactable
                          Severity: Minor
                          Found in app/models/comment.rb - About 5 hrs to fix

                            Function initializeVideoPlayback has 164 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            function initializeVideoPlayback() {
                              var currentTime = '0';
                              var deviceType = 'web';
                              var lastEvent = '';
                            
                            
                            Severity: Major
                            Found in app/assets/javascripts/initializers/initializeVideoPlayback.js - About 5 hrs to fix

                              Class StoriesController has 39 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class StoriesController < ApplicationController
                                DEFAULT_HOME_FEED_ATTRIBUTES_FOR_SERIALIZATION = {
                                  only: %i[
                                    title path id user_id comments_count public_reactions_count organization_id
                                    reading_time video_thumbnail_url video video_duration_in_minutes language
                              Severity: Minor
                              Found in app/controllers/stories_controller.rb - About 5 hrs to fix

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

                                  render() {
                                    const { showOptions, subscriptionType, subscribed } = this.state;
                                    const {
                                      onSubscribe,
                                      onUnsubscribe,
                                Severity: Major
                                Found in app/javascript/CommentSubscription/CommentSubscription.jsx - About 4 hrs to fix

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

                                  import { toggleFlagUserModal } from '../packs/flagUserModal';
                                  import { request } from '@utilities/http';
                                  
                                  export function addCloseListener() {
                                    const button = document.getElementsByClassName('close-actions-panel')[0];
                                  Severity: Minor
                                  Found in app/javascript/actionsPanel/actionsPanel.js - About 4 hrs to fix

                                    File site_config.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    module Constants
                                      module SiteConfig
                                        IMAGE_PLACEHOLDER = "https://url/image.png".freeze
                                        SVG_PLACEHOLDER = "<svg ...></svg>".freeze
                                    
                                    
                                    Severity: Minor
                                    Found in app/lib/constants/site_config.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

                                        Class LargeForemExperimental has 31 methods (exceeds 20 allowed). Consider refactoring.
                                        Open

                                            class LargeForemExperimental
                                              RANDOM_OFFSET_VALUES = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13].freeze
                                              MINIMUM_SCORE_LATEST_FEED = -20
                                        
                                              def initialize(user: nil, number_of_articles: 35, page: 1, tag: nil)
                                        Severity: Minor
                                        Found in app/services/articles/feeds/large_forem_experimental.rb - About 3 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language