glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

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

  render () {
    const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
    const pinned = !!columnId;

    const emptyMessage = <FormattedMessage id='empty_column.favourited_statuses' defaultMessage="You don't have any favorite posts yet. When you favorite one, it will show up here." />;

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

      render () {
        const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
    
        const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
        const unlockedPrependMessage = !locked && accountIds.size > 0 && (
    Severity: Minor
    Found in app/javascript/flavours/glitch/features/follow_requests/index.jsx - About 1 hr to fix

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

        render () {
          const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
          const pinned = !!columnId;
      
          const emptyMessage = <FormattedMessage id='empty_column.bookmarked_statuses' defaultMessage="You don't have any bookmarked posts yet. When you bookmark one, it will show up here." />;

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

          _toggleZoom () {
            const { scale, zoomMatrix } = this.state;
        
            if ( scale >= zoomMatrix.rate ) {
              this.setState({

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

            render () {
              const { category, startedFrom, rules, intl } = this.props;
          
              const options = rules.size > 0 ? [
                'spam',
          Severity: Minor
          Found in app/javascript/flavours/glitch/features/report/category.jsx - About 1 hr to fix

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

              renderAdminReport (notification, account, link) {
                const { intl, unread, report } = this.props;
            
                if (!report) {
                  return null;

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

                render () {
                  const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
              
                  const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
                  const unlockedPrependMessage = !locked && accountIds.size > 0 && (
              Severity: Minor
              Found in app/javascript/mastodon/features/follow_requests/index.jsx - About 1 hr to fix

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

                  render () {
                    const { intl, columnId, hasUnread, multiColumn, onlyMedia, onlyRemote } = this.props;
                    const pinned = !!columnId;
                
                    return (
                Severity: Minor
                Found in app/javascript/mastodon/features/public_timeline/index.jsx - About 1 hr to fix

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

                    _toggleZoom () {
                      const { scale, zoomMatrix } = this.state;
                  
                      if ( scale >= zoomMatrix.rate ) {
                        this.setState({
                  Severity: Minor
                  Found in app/javascript/mastodon/features/ui/components/zoomable_image.jsx - About 1 hr to fix

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

                      render () {
                        const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props;
                        const pinned = !!columnId;
                    
                        return (
                    Severity: Minor
                    Found in app/javascript/mastodon/features/community_timeline/index.jsx - About 1 hr to fix

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

                        def call(statuses, **options)
                          ActiveRecord::Associations::Preloader.new(
                            records: statuses,
                            associations: options[:skip_side_effects] ? :reblogs : [:account, :tags, reblogs: :account]
                          ).call
                      Severity: Minor
                      Found in app/services/batched_remove_status_service.rb - About 1 hr to fix

                        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 call has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def call(uri, prefetched_body: nil, on_behalf_of: nil, expected_actor_uri: nil, request_id: nil)
                              return if domain_not_allowed?(uri)
                          
                              @request_id = request_id || "#{Time.now.utc.to_i}-status-#{uri}"
                              @json = if prefetched_body.nil?
                          Severity: Minor
                          Found in app/services/activitypub/fetch_remote_status_service.rb - 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/hooks/useTimeout.ts - 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/flavours/glitch/utils/react_router.tsx - 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

                                    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

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

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language