mashirozx/mastodon

View on GitHub

Showing 1,785 of 1,785 total issues

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

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

    Function normalizeWheel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const normalizeWheel = event => {
      // Reasonable defaults
      const PIXEL_STEP = 10;
      const LINE_HEIGHT = 40;
      const PAGE_HEIGHT = 800;
    Severity: Major
    Found in app/javascript/mastodon/features/ui/components/zoomable_image.js - About 2 hrs to fix

      Method crawl has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def crawl(start = nil)
            stats           = Concurrent::Hash.new
            processed       = Concurrent::AtomicFixnum.new(0)
            failed          = Concurrent::AtomicFixnum.new(0)
            start_at        = Time.now.to_f
      Severity: Major
      Found in lib/mastodon/domains_cli.rb - About 2 hrs to fix

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        const messages = defineMessages({
          show: { id: 'column_header.show_settings', defaultMessage: 'Show settings' },
          hide: { id: 'column_header.hide_settings', defaultMessage: 'Hide settings' },
          moveLeft: { id: 'column_header.moveLeft_settings', defaultMessage: 'Move column to the left' },
          moveRight: { id: 'column_header.moveRight_settings', defaultMessage: 'Move column to the right' },
        Severity: Major
        Found in app/javascript/mastodon/components/column_header.js and 3 other locations - About 2 hrs to fix
        app/javascript/mastodon/actions/alerts.js on lines 3..8
        app/javascript/mastodon/features/notifications/components/report.js on lines 9..14
        app/javascript/mastodon/features/ui/components/mute_modal.js on lines 11..16

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if (status.get('in_reply_to_id', null) === null) {
              replyIcon = 'reply';
              replyTitle = intl.formatMessage(messages.reply);
            } else {
              replyIcon = 'reply-all';
        Severity: Major
        Found in app/javascript/mastodon/components/status_action_bar.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/features/picture_in_picture/components/footer.js on lines 180..186

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            if (status.get('in_reply_to_id', null) === null) {
              replyIcon = 'reply';
              replyTitle = intl.formatMessage(messages.reply);
            } else {
              replyIcon = 'reply-all';
        app/javascript/mastodon/components/status_action_bar.js on lines 336..342

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        const messages = defineMessages({
          openReport: { id: 'report_notification.open', defaultMessage: 'Open report' },
          other: { id: 'report_notification.categories.other', defaultMessage: 'Other' },
          spam: { id: 'report_notification.categories.spam', defaultMessage: 'Spam' },
          violation: { id: 'report_notification.categories.violation', defaultMessage: 'Rule violation' },
        app/javascript/mastodon/actions/alerts.js on lines 3..8
        app/javascript/mastodon/components/column_header.js on lines 8..13
        app/javascript/mastodon/features/ui/components/mute_modal.js on lines 11..16

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        const messages = defineMessages({
          unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' },
          unexpectedMessage: { id: 'alert.unexpected.message', defaultMessage: 'An unexpected error occurred.' },
          rateLimitedTitle: { id: 'alert.rate_limited.title', defaultMessage: 'Rate limited' },
          rateLimitedMessage: { id: 'alert.rate_limited.message', defaultMessage: 'Please retry after {retry_time, time, medium}.' },
        Severity: Major
        Found in app/javascript/mastodon/actions/alerts.js and 3 other locations - About 2 hrs to fix
        app/javascript/mastodon/components/column_header.js on lines 8..13
        app/javascript/mastodon/features/notifications/components/report.js on lines 9..14
        app/javascript/mastodon/features/ui/components/mute_modal.js on lines 11..16

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        const messages = defineMessages({
          minutes: { id: 'intervals.full.minutes', defaultMessage: '{number, plural, one {# minute} other {# minutes}}' },
          hours: { id: 'intervals.full.hours', defaultMessage: '{number, plural, one {# hour} other {# hours}}' },
          days: { id: 'intervals.full.days', defaultMessage: '{number, plural, one {# day} other {# days}}' },
          indefinite: { id: 'mute_modal.indefinite', defaultMessage: 'Indefinite' },
        app/javascript/mastodon/actions/alerts.js on lines 3..8
        app/javascript/mastodon/components/column_header.js on lines 8..13
        app/javascript/mastodon/features/notifications/components/report.js on lines 9..14

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const readMoreButton = (
              <button className='status__content__read-more-button' onClick={this.props.onClick} key='read-more'>
                <FormattedMessage id='status.read_more' defaultMessage='Read more' /><Icon id='angle-right' fixedWidth />
              </button>
            );
        Severity: Major
        Found in app/javascript/mastodon/components/status_content.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/components/status_content.js on lines 212..216

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          it('renders a overlay avatar', () => {
            const component = renderer.create(<AvatarOverlay account={account} friend={friend} />);
            const tree      = component.toJSON();
        
            expect(tree).toMatchSnapshot();
        app/javascript/mastodon/components/__tests__/avatar-test.js on lines 27..32

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            it('renders a still avatar', () => {
              const component = renderer.create(<Avatar account={account} size={size} />);
              const tree      = component.toJSON();
        
              expect(tree).toMatchSnapshot();
        Severity: Major
        Found in app/javascript/mastodon/components/__tests__/avatar-test.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/components/__tests__/avatar_overlay-test.js on lines 23..28

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const showPollButton = (
              <button className='status__content__read-more-button' onClick={this.props.onClick} key='show-poll'>
                <FormattedMessage id='status.show_poll' defaultMessage='Show poll' /><Icon id='angle-right' fixedWidth />
              </button>
            );
        Severity: Major
        Found in app/javascript/mastodon/components/status_content.js and 1 other location - About 2 hrs to fix
        app/javascript/mastodon/components/status_content.js on lines 206..210

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function submitCompose has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function submitCompose(routerHistory) {
          return function (dispatch, getState) {
            const status   = getState().getIn(['compose', 'text'], '');
            const media    = getState().getIn(['compose', 'media_attachments']);
            const statusId = getState().getIn(['compose', 'id'], null);
        Severity: Major
        Found in app/javascript/mastodon/actions/compose.js - About 2 hrs to fix

          Function register has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function register () {
            return (dispatch, getState) => {
              dispatch(setBrowserSupport(supportsPushNotifications));
          
              if (supportsPushNotifications) {
          Severity: Major
          Found in app/javascript/mastodon/actions/push_notifications/registerer.js - About 2 hrs to fix

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

              render () {
                const { loading, style, intl, custom_emojis, skinTone, frequentlyUsedEmojis } = this.props;
            
                if (loading) {
                  return <div style={{ width: 299 }} />;

              Function statusLists has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function statusLists(state = initialState, action) {
                switch(action.type) {
                case FAVOURITED_STATUSES_FETCH_REQUEST:
                case FAVOURITED_STATUSES_EXPAND_REQUEST:
                  return state.setIn(['favourites', 'isLoading'], true);
              Severity: Major
              Found in app/javascript/mastodon/reducers/status_lists.js - About 2 hrs to fix

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

                  render () {
                    const { label, href, target } = this.props;
                    const { loading, data } = this.state;
                
                    let content;
                Severity: Minor
                Found in app/javascript/mastodon/components/admin/Counter.js - About 2 hrs to fix

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

                    render () {
                      const { index, versions, onClose } = this.props;
                      const currentVersion = versions.get(index);
                  
                      const emojiMap = currentVersion.get('emojis').reduce((obj, emoji) => {

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                          map.update('text', text => [text.trim(), `@${action.account.get('acct')} `].filter((str) => str.length !== 0).join(' '));
                    Severity: Major
                    Found in app/javascript/mastodon/reducers/compose.js and 1 other location - About 2 hrs to fix
                    app/javascript/mastodon/reducers/compose.js on lines 460..460

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 75.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language