glitch-soc/mastodon

View on GitHub

Showing 4,633 of 4,633 total issues

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

const mapStateToProps = (state, { match: { params: { acct } } }) => {
  const accountId = state.getIn(['accounts_map', normalizeForLookup(acct)]);

  if (!accountId) {
    return {
app/javascript/mastodon/features/account/navigation.jsx on lines 9..22

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

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

    } else if (status.get('visibility') === 'direct') {
      prepend = (
        <div className='status__prepend'>
          <div className='status__prepend-icon-wrapper'><Icon id='at' icon={AlternateEmailIcon} className='status__prepend-icon' /></div>
          <FormattedMessage id='status.direct_indicator' defaultMessage='Private mention' />
Severity: Major
Found in app/javascript/mastodon/components/status.jsx and 1 other location - About 2 hrs to fix
app/javascript/mastodon/components/status.jsx on lines 415..452

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

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

export const connectCommunityStream = ({ onlyMedia } = {}) =>
  connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
Severity: Major
Found in app/javascript/mastodon/actions/streaming.js and 1 other location - About 2 hrs to fix
app/javascript/flavours/glitch/actions/streaming.js on lines 150..151

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

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

export const connectCommunityStream = ({ onlyMedia } = {}) =>
  connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`, {}, { fillGaps: () => (fillCommunityTimelineGaps({ onlyMedia })) });
Severity: Major
Found in app/javascript/flavours/glitch/actions/streaming.js and 1 other location - About 2 hrs to fix
app/javascript/mastodon/actions/streaming.js on lines 150..151

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

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

          <a href={status.getIn(['account', 'url'])} onClick={this.handleAccountClick} className='detailed-status__display-name'>
            <div className='detailed-status__display-avatar'><Avatar account={status.get('account')} size={48} /></div>
            <DisplayName account={status.get('account')} localDomain={this.props.domain} />
          </a>
app/javascript/mastodon/features/status/components/detailed_status.jsx on lines 275..278

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

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

          <a href={`/@${status.getIn(['account', 'acct'])}`} onClick={this.handleAccountClick} className='detailed-status__display-name'>
            <div className='detailed-status__display-avatar'><Avatar account={status.get('account')} size={46} /></div>
            <DisplayName account={status.get('account')} localDomain={this.props.domain} />
          </a>
app/javascript/flavours/glitch/features/status/components/detailed_status.jsx on lines 288..291

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

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

    if (featured) {
      prepend = (
        <div className='status__prepend'>
          <div className='status__prepend-icon-wrapper'><Icon id='thumb-tack' icon={PushPinIcon} className='status__prepend-icon' /></div>
          <FormattedMessage id='status.pinned' defaultMessage='Pinned post' />
Severity: Major
Found in app/javascript/mastodon/components/status.jsx and 1 other location - About 2 hrs to fix
app/javascript/mastodon/components/status.jsx on lines 436..452

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

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

export const fetchMarkers = createAppAsyncThunk('markers/fetch', async () => {
  const response = await api().get<Record<string, MarkerJSON>>(
    `/api/v1/markers`,
    { params: { timeline: ['notifications'] } },
  );
Severity: Major
Found in app/javascript/mastodon/actions/markers.ts and 1 other location - About 2 hrs to fix
app/javascript/flavours/glitch/actions/markers.ts on lines 142..149

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

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

export const fetchMarkers = createAppAsyncThunk('markers/fetch', async () => {
  const response = await api().get<Record<string, MarkerJSON>>(
    `/api/v1/markers`,
    { params: { timeline: ['notifications'] } },
  );
Severity: Major
Found in app/javascript/flavours/glitch/actions/markers.ts and 1 other location - About 2 hrs to fix
app/javascript/mastodon/actions/markers.ts on lines 141..148

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

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

File language_dropdown.jsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { injectIntl, defineMessages } from 'react-intl';

    File language_dropdown.jsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import PropTypes from 'prop-types';
    import { PureComponent } from 'react';
    
    import { injectIntl, defineMessages } from 'react-intl';
    
    

      Function renderOption has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        renderOption (option, optionIndex, showResults) {
          const { poll, lang, disabled, intl } = this.props;
          const pollVotesCount  = poll.get('voters_count') || poll.get('votes_count');
          const percent         = pollVotesCount === 0 ? 0 : (option.get('votes_count') / pollVotesCount) * 100;
          const leading         = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
      Severity: Major
      Found in app/javascript/flavours/glitch/components/poll.jsx - About 2 hrs to fix

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

          render () {
            const { multiColumn, showSearch, showNotificationsBadge, unreadNotifications, intl } = this.props;
        
            const elefriend = [glitchedElephant1, glitchedElephant2, glitchedElephant3, elephantUIPlane][this.state.elefriend];
        
        
        Severity: Major
        Found in app/javascript/flavours/glitch/features/compose/index.jsx - About 2 hrs to fix

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

            render () {
              const { filter, contextType } = this.props;
          
              let expiredMessage = null;
              if (filter.get('expires_at') && filter.get('expires_at') < new Date()) {
          Severity: Major
          Found in app/javascript/flavours/glitch/features/filters/added_to_filter.jsx - About 2 hrs to fix

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

              render () {
                const { filter, contextType } = this.props;
            
                let expiredMessage = null;
                if (filter.get('expires_at') && filter.get('expires_at') < new Date()) {
            Severity: Major
            Found in app/javascript/mastodon/features/filters/added_to_filter.jsx - About 2 hrs to fix

              Function renderOption has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderOption (option, optionIndex, showResults) {
                  const { poll, lang, disabled, intl } = this.props;
                  const pollVotesCount  = poll.get('voters_count') || poll.get('votes_count');
                  const percent         = pollVotesCount === 0 ? 0 : (option.get('votes_count') / pollVotesCount) * 100;
                  const leading         = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
              Severity: Major
              Found in app/javascript/mastodon/components/poll.jsx - About 2 hrs to fix

                Function setupMetrics has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function setupMetrics(channels, pgPool) {
                  // Collect metrics from Node.js
                  metrics.collectDefaultMetrics();
                
                  new metrics.Gauge({
                Severity: Major
                Found in streaming/metrics.js - About 2 hrs to fix

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

                    render() {
                      const { others, localDomain } = this.props;
                  
                      let displayName: React.ReactNode,
                        suffix: React.ReactNode,
                  Severity: Major
                  Found in app/javascript/flavours/glitch/components/display_name.tsx - About 2 hrs to fix

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

                      render() {
                        const { others, localDomain } = this.props;
                    
                        let displayName: React.ReactNode,
                          suffix: React.ReactNode,
                    Severity: Major
                    Found in app/javascript/mastodon/components/display_name.tsx - About 2 hrs to fix

                      StatusActionBar has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class StatusActionBar extends ImmutablePureComponent {
                        static propTypes = {
                          identity: identityContextPropShape,
                          status: ImmutablePropTypes.map.isRequired,
                          relationship: ImmutablePropTypes.record,
                      Severity: Minor
                      Found in app/javascript/mastodon/components/status_action_bar.jsx - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language