thepracticaldev/dev.to

View on GitHub

Showing 105 of 282 total issues

File chat.jsx has 1711 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 */
import { h, Component } from 'preact';
import PropTypes from 'prop-types';
import ConfigImage from '../../assets/images/three-dots.svg';
import {
Severity: Major
Found in app/javascript/chat/chat.jsx - About 4 days to fix

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

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

      Class User has 80 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

        Chat has 77 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

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

          function buildArticleHTML(article) {
            if (article && article.class_name === 'PodcastEpisode') {
              return (
                '<div class="single-article single-article-small-pic single-article-single-podcast">\
                <div class="small-pic">\
          Severity: Major
          Found in app/assets/javascripts/utilities/buildArticleHTML.js - About 1 day to fix

            Class Article has 64 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Article < ApplicationRecord
              include CloudinaryHelper
              include ActionView::Helpers
              include Storext.model
              include Reactable
            Severity: Major
            Found in app/models/article.rb - About 1 day to fix

              File user.rb has 517 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 511 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

                  File article.rb has 505 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class Article < ApplicationRecord
                    include CloudinaryHelper
                    include ActionView::Helpers
                    include Storext.model
                    include Reactable
                  Severity: Major
                  Found in app/models/article.rb - About 1 day to fix

                    Function render has 180 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 initScrolling.js has 414 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 stories_controller.rb has 403 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 5 hrs to fix

                          File tags.jsx has 401 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

                            Class Comment has 39 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

                              Class StoriesController has 38 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

                                Class UsersController has 37 methods (exceeds 20 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

                                  Class Feed has 37 methods (exceeds 20 allowed). Consider refactoring.
                                  Open

                                    class Feed
                                      RANDOM_OFFSET_VALUES = [0, 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
                                  
                                      def initialize(user: nil, number_of_articles: 35, page: 1, tag: nil)
                                        @user = user
                                  Severity: Minor
                                  Found in app/services/articles/feed.rb - About 4 hrs to fix

                                    Function render has 138 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 users_controller.rb has 324 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 3 hrs to fix

                                        Function initializeCommentDropdown has 115 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 3 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language