glitch-soc/mastodon

View on GitHub

Showing 1,294 of 4,908 total issues

Method rewrite has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def rewrite
if @tree.nil?
src = text.gsub(Sanitize::REGEX_UNSUITABLE_CHARS, '')
@tree = Nokogiri::HTML5.fragment(src)
document = @tree.document
Severity: Minor
Found in app/lib/advanced_text_formatter.rb - About 1 hr to fix

    Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def initialize(path, max_frames = 2)
    @path = path
    @nb_frames = 0
     
    File.open(path, 'rb') do |s|
    Severity: Minor
    Found in lib/paperclip/gif_transcoder.rb - About 1 hr to fix

      Method remove has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def remove
      fail_with_message '--prune-profiles and --remove-headers should not be specified simultaneously' if options[:prune_profiles] && options[:remove_headers]
       
      fail_with_message '--include-follows can only be used with --prune-profiles or --remove-headers' if options[:include_follows] && !(options[:prune_profiles] || options[:remove_headers])
      time_ago = options[:days].days.ago
      Severity: Minor
      Found in lib/mastodon/cli/media.rb - About 1 hr to fix

        Function withOptionalRouter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function withOptionalRouter<
        ComponentType extends React.ComponentType<OptionalRouterProps>,
        >(Component: ComponentType) {
        const displayName = `withRouter(${Component.displayName ?? Component.name})`;
        const C = (props: React.ComponentProps<ComponentType>) => {
        Severity: Minor
        Found in app/javascript/flavours/glitch/utils/react_router.tsx - About 1 hr to fix

          Function useTimeout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const useTimeout = () => {
          const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
          const callbackRef = useRef<() => void>();
           
          const set = useCallback((callback: () => void, delay: number) => {
          Severity: Minor
          Found in app/javascript/flavours/glitch/hooks/useTimeout.ts - About 1 hr to fix

            Function withOptionalRouter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function withOptionalRouter<
            ComponentType extends React.ComponentType<OptionalRouterProps>,
            >(Component: ComponentType) {
            const displayName = `withRouter(${Component.displayName ?? Component.name})`;
            const C = (props: React.ComponentProps<ComponentType>) => {
            Severity: Minor
            Found in app/javascript/mastodon/utils/react_router.tsx - About 1 hr to fix

              Function useTimeout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useTimeout = () => {
              const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
              const callbackRef = useRef<() => void>();
               
              const set = useCallback((callback: () => void, delay: number) => {
              Severity: Minor
              Found in app/javascript/mastodon/hooks/useTimeout.ts - About 1 hr to fix

                Function buildSearch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                const buildSearch = (data) => {
                const search = [];
                 
                let addToSearch = (strings, split) => {
                if (!strings) {
                Severity: Minor
                Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js - About 1 hr to fix

                Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                render () {
                const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
                 
                if (isLoading && statusIds.isEmpty()) {
                return (
                Severity: Minor
                Found in app/javascript/flavours/glitch/features/account_timeline/index.jsx - About 1 hr to fix

                Function ColumnLink has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                const ColumnLink = ({ icon, activeIcon, iconComponent, activeIconComponent, text, to, href, method, badge, transparent, optional, ...other }) => {
                const match = useRouteMatch(to);
                const className = classNames('column-link', { 'column-link--transparent': transparent, 'column-link--optional': optional });
                const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null;
                const iconElement = (typeof icon === 'string' || iconComponent) ? <Icon id={icon} icon={iconComponent} className='column-link__icon' /> : icon;
                Severity: Minor
                Found in app/javascript/mastodon/features/ui/components/column_link.jsx - About 1 hr to fix

                Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                render () {
                let ancestors, descendants, remoteHint;
                const { isLoading, status, ancestorsIds, descendantsIds, intl, domain, multiColumn, pictureInPicture } = this.props;
                const { fullscreen } = this.state;
                 
                 
                Severity: Minor
                Found in app/javascript/mastodon/features/status/index.jsx - About 1 hr to fix

                Function _updateStatusLinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                _updateStatusLinks () {
                const node = this.node;
                 
                if (!node) {
                return;
                Severity: Minor
                Found in app/javascript/mastodon/components/status_content.jsx - About 1 hr to fix

                Function buildSearch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                const buildSearch = (data) => {
                const search = [];
                 
                let addToSearch = (strings, split) => {
                if (!strings) {
                Severity: Minor
                Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 1 hr to fix

                Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                render () {
                const { intl, myAccount, multiColumn, unreadFollowRequests } = this.props;
                const { signedIn, permissions } = this.props.identity;
                 
                const navItems = [];
                Severity: Minor
                Found in app/javascript/mastodon/features/getting_started/index.jsx - About 1 hr to fix

                Function render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                render () {
                const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;
                 
                if (isLoading && statusIds.isEmpty()) {
                return (
                Severity: Minor
                Found in app/javascript/mastodon/features/account_timeline/index.jsx - About 1 hr to fix

                Method request_review has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def request_review
                PreviewCardTrend.locales.flat_map do |language|
                score_at_threshold = PreviewCardTrend.where(language: language).allowed.by_rank.ranked_below(options[:review_threshold]).first&.score || 0
                preview_card_trends = PreviewCardTrend.where(language: language).not_allowed.joins(:preview_card)
                 
                 
                Severity: Minor
                Found in app/models/trends/links.rb - About 1 hr to fix

                Method apply_cached_filters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def self.apply_cached_filters(cached_filters, status)
                cached_filters.filter_map do |filter, rules|
                match = rules[:keywords].match(status.proper.searchable_text) if rules[:keywords].present?
                keyword_matches = [match.to_s] unless match.nil?
                 
                 
                Severity: Minor
                Found in app/models/custom_filter.rb - About 1 hr to fix

                Method get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def get(limit, max_id = nil, since_id = nil, min_id = nil)
                scope = public_scope
                 
                scope.merge!(without_local_only_scope) unless allow_local_only?
                scope.merge!(without_replies_scope) unless with_replies?
                Severity: Minor
                Found in app/models/public_feed.rb - About 1 hr to fix

                Method load_groups_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def load_groups_data(account_id, group_keys, pagination_range: nil)
                return {} if group_keys.empty?
                 
                if pagination_range.present?
                binds = [
                Severity: Minor
                Found in app/models/notification_group.rb - About 1 hr to fix

                Method authenticate_with_two_factor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                def authenticate_with_two_factor
                if user_params[:email].present?
                user = self.resource = find_user_from_params
                prompt_for_two_factor(user) if user&.external_or_valid_password?(user_params[:password])
                elsif session[:attempt_user_id]
                Severity: Minor
                Found in app/controllers/concerns/auth/two_factor_authentication_concern.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language