glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

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

  render () {
    const {
      intl,
      statusId,
      contextType,

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

      render () {
        const { server, intl } = this.props;
        const isLoading = server.get('isLoading');
    
        return (
    Severity: Minor
    Found in app/javascript/mastodon/components/server_banner.jsx - About 1 hr to fix

      Function PollForm has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PollForm = () => {
        const intl = useIntl();
        const dispatch = useDispatch();
        const poll = useSelector(state => state.getIn(['compose', 'poll']));
        const options = poll?.get('options');
      Severity: Minor
      Found in app/javascript/mastodon/features/compose/components/poll_form.jsx - About 1 hr to fix

        Function PollForm has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const PollForm = () => {
          const intl = useIntl();
          const dispatch = useDispatch();
          const poll = useSelector(state => state.getIn(['compose', 'poll']));
          const options = poll?.get('options');

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

            render () {
              const {
                intl,
                statusId,
                contextType,
          Severity: Minor
          Found in app/javascript/mastodon/features/ui/components/filter_modal.jsx - About 1 hr to fix

            Method paginate_groups has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def paginate_groups(limit, pagination_order, grouped_types: nil)
                  raise ArgumentError unless %i(asc desc).include?(pagination_order)
            
                  query = reorder(id: pagination_order)
            
            
            Severity: Minor
            Found in app/models/concerns/notification/groups.rb - About 1 hr to fix

              Function FilteredNotificationsBanner has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const FilteredNotificationsBanner: React.FC = () => {
                const dispatch = useAppDispatch();
                const policy = useAppSelector((state) => state.notificationPolicy);
                const minimizeSetting = useAppSelector(
                  selectSettingsNotificationsMinimizeFilteredBanner,

                Function FilteredNotificationsBanner has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const FilteredNotificationsBanner: React.FC = () => {
                  const dispatch = useAppDispatch();
                  const policy = useAppSelector((state) => state.notificationPolicy);
                  const minimizeSetting = useAppSelector(
                    selectSettingsNotificationsMinimizeFilteredBanner,

                  Method purge has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def purge(*domains)
                        domains            = domains.map { |domain| TagManager.instance.normalize_domain(domain) }
                        account_scope      = Account.none
                        domain_block_scope = DomainBlock.none
                        emoji_scope        = CustomEmoji.none
                  Severity: Minor
                  Found in lib/mastodon/cli/domains.rb - About 1 hr to fix

                    Function normalizeContext has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const normalizeContext = (immutableState, id, ancestors, descendants) => immutableState.withMutations(state => {
                      state.update('inReplyTos', immutableAncestors => immutableAncestors.withMutations(inReplyTos => {
                        state.update('replies', immutableDescendants => immutableDescendants.withMutations(replies => {
                          function addReply({ id, in_reply_to_id }) {
                            if (in_reply_to_id && !inReplyTos.has(id)) {
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/reducers/contexts.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 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render () {
                        const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
                        const { dragging, detecting, progress, ocrStatus } = this.state;
                        const x = (focusX /  2) + .5;
                        const y = (focusY / -2) + .5;

                    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 deleteFromContexts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const deleteFromContexts = (immutableState, ids) => immutableState.withMutations(state => {
                      state.update('inReplyTos', immutableAncestors => immutableAncestors.withMutations(inReplyTos => {
                        state.update('replies', immutableDescendants => immutableDescendants.withMutations(replies => {
                          ids.forEach(id => {
                            const inReplyToIdOfId = inReplyTos.get(id);
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/reducers/contexts.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 Firehose has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const Firehose = ({ feedType, multiColumn }) => {
                      const dispatch = useAppDispatch();
                      const intl = useIntl();
                      const { signedIn } = useIdentity();
                      const columnRef = useRef(null);
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/features/firehose/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 deleteFromContexts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const deleteFromContexts = (immutableState, ids) => immutableState.withMutations(state => {
                      state.update('inReplyTos', immutableAncestors => immutableAncestors.withMutations(inReplyTos => {
                        state.update('replies', immutableDescendants => immutableDescendants.withMutations(replies => {
                          ids.forEach(id => {
                            const inReplyToIdOfId = inReplyTos.get(id);
                    Severity: Minor
                    Found in app/javascript/mastodon/reducers/contexts.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 normalizeContext has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const normalizeContext = (immutableState, id, ancestors, descendants) => immutableState.withMutations(state => {
                      state.update('inReplyTos', immutableAncestors => immutableAncestors.withMutations(inReplyTos => {
                        state.update('replies', immutableDescendants => immutableDescendants.withMutations(replies => {
                          function addReply({ id, in_reply_to_id }) {
                            if (in_reply_to_id && !inReplyTos.has(id)) {
                    Severity: Minor
                    Found in app/javascript/mastodon/reducers/contexts.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 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render () {
                        const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
                        const { dragging, detecting, progress, ocrStatus } = this.state;
                        const x = (focusX /  2) + .5;
                        const y = (focusY / -2) + .5;

                    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 from_notifications has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.from_notifications(notifications, pagination_range: nil, grouped_types: nil)
                        return [] if notifications.empty?
                    
                        grouped_types = grouped_types.presence&.map(&:to_sym) || Notification::GROUPABLE_NOTIFICATION_TYPES
                    
                    
                    Severity: Minor
                    Found in app/models/notification_group.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 process_url_from_db has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def process_url_from_db
                        if [500, 502, 503, 504, nil].include?(fetch_resource_service.response_code)
                          account = Account.find_by(uri: @url)
                          return account unless account.nil?
                        end
                    Severity: Minor
                    Found in app/services/resolve_url_service.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 drop? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def drop?
                          blocked   = @recipient.unavailable?
                          blocked ||= from_self? && %i(poll severed_relationships moderation_warning annual_report).exclude?(@notification.type)
                    
                          return blocked if message? && from_staff?
                    Severity: Minor
                    Found in app/services/notify_service.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 filter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def filter(timeline_type, status, receiver)
                        case timeline_type
                        when :home
                          filter_from_home(status, receiver.id, build_crutches(receiver.id, [status]), :home)
                        when :list
                    Severity: Minor
                    Found in app/lib/feed_manager.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