glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

    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

        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

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

                  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

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

                      render () {
                        const { children, singleColumn } = this.props;
                        const { signedIn } = this.props.identity;
                        const pathName = this.props.location.pathname;
                    
                    
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/features/ui/index.jsx - 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

                    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

                    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

                    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

                    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

                    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

                    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

                    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

                    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

                    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

                    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

                    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, ...other }) => {
                      const match = useRouteMatch(to);
                      const className = classNames('column-link', { 'column-link--transparent': transparent });
                      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

                    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

                    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

                    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

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

                      def follow!(other_account, reblogs: nil, notify: nil, languages: nil, uri: nil, rate_limit: false, bypass_limit: false)
                        rel = active_relationships.create_with(show_reblogs: reblogs.nil? ? true : reblogs, notify: notify.nil? ? false : notify, languages: languages, uri: uri, rate_limit: rate_limit, bypass_follow_limit: bypass_limit)
                                                  .find_or_create_by!(target_account: other_account)
                    
                        rel.show_reblogs = reblogs   unless reblogs.nil?
                    Severity: Minor
                    Found in app/models/concerns/account/interactions.rb - 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

                    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

                    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