glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Class PostStatusService has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

class PostStatusService < BaseService
  include Redisable
  include LanguagesHelper

  class UnexpectedMentionsError < StandardError
Severity: Minor
Found in app/services/post_status_service.rb - About 2 hrs to fix

    Class BaseMeasure has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Admin::Metrics::Measure::BaseMeasure
      CACHE_TTL = 5.minutes.freeze
    
      def self.with_params?
        false
    Severity: Minor
    Found in app/lib/admin/metrics/measure/base_measure.rb - About 2 hrs to fix

      Class StatusParser has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ActivityPub::Parser::StatusParser
        include JsonLdHelper
      
        NORMALIZED_LOCALE_NAMES = LanguagesHelper::SUPPORTED_LOCALES.keys.index_by(&:downcase).freeze
      
      
      Severity: Minor
      Found in app/lib/activitypub/parser/status_parser.rb - About 2 hrs to fix

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

          render () {
        
            const { index, intl, onClose, onNavigate } = this.props;
        
            return (

          Method deploy has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def deploy
                verify_deploy_options!
          
                indices = if options[:only]
                            options[:only].map { |str| "#{str.camelize}Index".constantize }
          Severity: Major
          Found in lib/mastodon/cli/search.rb - About 2 hrs to fix

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

              render () {
                const { account } = this.props;
            
                if (account.get('suspended')) {
                  return (

              Function getData has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getData(emoji, skin, set) {
                let emojiData = {};
              
                if (typeof emoji === 'string') {
                  let matches = emoji.match(COLONS_REGEX);
              Severity: Major
              Found in app/javascript/flavours/glitch/features/emoji/emoji_utils.js - About 2 hrs to fix

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

                  render () {
                    const { attachments, isLoading, hasMore, isAccount, multiColumn, blockedBy, suspended } = this.props;
                    const { width } = this.state;
                
                    if (!isAccount) {
                Severity: Major
                Found in app/javascript/mastodon/features/account_gallery/index.jsx - About 2 hrs to fix

                  Function getData has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function getData(emoji, skin, set) {
                    let emojiData = {};
                  
                    if (typeof emoji === 'string') {
                      let matches = emoji.match(COLONS_REGEX);
                  Severity: Major
                  Found in app/javascript/mastodon/features/emoji/emoji_utils.js - About 2 hrs to fix

                    Function notifications has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function notifications(state = initialState, action) {
                      switch(action.type) {
                      case fetchMarkers.fulfilled.type:
                        return action.payload.markers.notifications ? recountUnread(state, action.payload.markers.notifications.last_read_id) : state;
                      case NOTIFICATIONS_MOUNT:
                    Severity: Major
                    Found in app/javascript/mastodon/reducers/notifications.js - About 2 hrs to fix

                      Method merge_with! has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def merge_with!(other_account)
                          # Since it's the same remote resource, the remote resource likely
                          # already believes we are following/blocking, so it's safe to
                          # re-attribute the relationships too. However, during the presence
                          # of the index bug users could have *also* followed the reference
                      Severity: Major
                      Found in app/models/concerns/account/merging.rb - About 2 hrs to fix

                        Method open has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def open(host, *args)
                                outer_e = nil
                                port    = args.first
                        
                                addresses = [] # rubocop:disable Lint/UselessAssignment # TODO: https://github.com/rubocop/rubocop/issues/13395
                        Severity: Major
                        Found in app/lib/request.rb - About 2 hrs to fix

                          Function relationshipsReducer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const relationshipsReducer: Reducer<State> = (
                            state = initialState,
                            action,
                          ) => {
                            if (authorizeFollowRequestSuccess.match(action))
                          Severity: Major
                          Found in app/javascript/flavours/glitch/reducers/relationships.ts - About 2 hrs to fix

                            Function relationshipsReducer has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const relationshipsReducer: Reducer<State> = (
                              state = initialState,
                              action,
                            ) => {
                              if (authorizeFollowRequestSuccess.match(action))
                            Severity: Major
                            Found in app/javascript/mastodon/reducers/relationships.ts - About 2 hrs to fix

                              Method call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def call(status, **options)
                                  @payload  = Oj.dump(event: :delete, payload: status.id.to_s)
                                  @status   = status
                                  @account  = status.account
                                  @options  = options
                              Severity: Minor
                              Found in app/services/remove_status_service.rb - About 2 hrs 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 validate_each has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def validate_each(record, attribute, value)
                                  return if value.blank?
                              
                                  (options[:multiline] ? value.split : [value]).each do |domain|
                                    _, domain = domain.split('@') if options[:acct]
                              Severity: Minor
                              Found in app/validators/domain_validator.rb - About 2 hrs 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 open has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def open(host, *args)
                                      outer_e = nil
                                      port    = args.first
                              
                                      addresses = [] # rubocop:disable Lint/UselessAssignment # TODO: https://github.com/rubocop/rubocop/issues/13395
                              Severity: Minor
                              Found in app/lib/request.rb - About 2 hrs 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 to has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def to(status)
                                  case status.visibility
                                  when 'public'
                                    [COLLECTIONS[:public]]
                                  when 'unlisted', 'private'
                              Severity: Minor
                              Found in app/lib/activitypub/tag_manager.rb - About 2 hrs 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 call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def call(recipient, type, activity)
                                  return if recipient.user.nil?
                              
                                  @recipient    = recipient
                                  @activity     = activity
                              Severity: Minor
                              Found in app/services/notify_service.rb - About 2 hrs 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 useLinks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const useLinks = () => {
                                const history = useHistory();
                                const dispatch = useAppDispatch();
                              
                                const handleHashtagClick = useCallback(
                              Severity: Minor
                              Found in app/javascript/hooks/useLinks.ts - About 2 hrs 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