glitch-soc/mastodon

View on GitHub

Showing 4,906 of 4,906 total issues

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

            <div>
              <label htmlFor='dd_smoothing'>Smoothing</label>
              <span className='val'>
                <input type='checkbox' id='dd_smoothing' onChange={this.tglSmooth} checked={this.smoothing} />
              </span>
app/javascript/flavours/glitch/features/ui/components/doodle_modal.jsx on lines 570..575

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

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 async function loadIntlPolyfills() {
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we want to match empty strings
  const locale = document.querySelector('html')?.lang || 'en';

  // order is important here
Severity: Major
Found in app/javascript/flavours/glitch/polyfills/intl.ts and 1 other location - About 2 hrs to fix
app/javascript/mastodon/polyfills/intl.ts on lines 82..106

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

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 async function loadIntlPolyfills() {
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- we want to match empty strings
  const locale = document.querySelector('html')?.lang || 'en';

  // order is important here
Severity: Major
Found in app/javascript/mastodon/polyfills/intl.ts and 1 other location - About 2 hrs to fix
app/javascript/flavours/glitch/polyfills/intl.ts on lines 82..106

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

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 render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { intl, onOpenSettings } = this.props;
    const { signedIn, disabledAccountId, permissions } = this.props.identity;

    let banner = undefined;

    Function makeMapStateToProps has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const makeMapStateToProps = () => {
      const getStatus = makeGetStatus();
      const getPictureInPicture = makeGetPictureInPicture();
    
      const getAncestorsIds = createSelector([
    Severity: Major
    Found in app/javascript/mastodon/features/status/index.jsx - About 2 hrs to fix

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

        render() {
          const style = {
            ...this.props.style,
            ...(this.props.active ? this.props.activeStyle : {}),
          };
      Severity: Major
      Found in app/javascript/mastodon/components/icon_button.tsx - About 2 hrs to fix

        Function _updateStatusLinks has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _updateStatusLinks () {
            const node = this.node;
            const { tagLinks, rewriteMentions } = this.props;
        
            if (!node) {
        Severity: Major
        Found in app/javascript/flavours/glitch/components/status_content.jsx - About 2 hrs to fix

          Function statuses has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function statuses(state = initialState, action) {
            switch(action.type) {
            case STATUS_FETCH_REQUEST:
              return state.setIn([action.id, 'isLoading'], true);
            case STATUS_FETCH_FAIL:
          Severity: Major
          Found in app/javascript/flavours/glitch/reducers/statuses.js - About 2 hrs to fix

            Function statuses has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                      <IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' iconComponent={StarIcon} onClick={this.handleFavouriteClick} counter={status.get('favourites_count')} />
              app/javascript/flavours/glitch/features/picture_in_picture/components/footer.jsx on lines 211..211

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

              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

                _sendBackgroundColor () {
                  const { media, onChangeBackgroundColor } = this.props;
                  const index = this.getIndex();
                  const blurhash = media.getIn([index, 'blurhash']);
              
              
              app/javascript/flavours/glitch/features/ui/components/media_modal.jsx on lines 125..134

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

              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

              export const detachFullscreenListener = (listener) => {
                if ('onfullscreenchange' in document) {
                  document.removeEventListener('fullscreenchange', listener);
                } else if ('onwebkitfullscreenchange' in document) {
                  document.removeEventListener('webkitfullscreenchange', listener);
              Severity: Major
              Found in app/javascript/mastodon/features/ui/util/fullscreen.js and 3 other locations - About 2 hrs to fix
              app/javascript/flavours/glitch/features/ui/util/fullscreen.js on lines 28..36
              app/javascript/flavours/glitch/features/ui/util/fullscreen.js on lines 38..46
              app/javascript/mastodon/features/ui/util/fullscreen.js on lines 28..36

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

              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 (signedIn) {
                    dispatch(toggleFavourite(status.get('id')));
                  } else {
                    dispatch(openModal({
                      modalType: 'INTERACTION',
              app/javascript/mastodon/features/status/index.jsx on lines 238..249

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

              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 (signedIn) {
                    dispatch(toggleFavourite(status.get('id')));
                  } else {
                    dispatch(openModal({
                      modalType: 'INTERACTION',
              Severity: Major
              Found in app/javascript/mastodon/features/status/index.jsx and 1 other location - About 2 hrs to fix
              app/javascript/mastodon/features/picture_in_picture/components/footer.jsx on lines 100..111

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

              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

                _sendBackgroundColor () {
                  const { media, onChangeBackgroundColor } = this.props;
                  const index = this.getIndex();
                  const blurhash = media.getIn([index, 'blurhash']);
              
              
              app/javascript/mastodon/features/ui/components/media_modal.jsx on lines 125..134

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

              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

                _handleModalClose () {
                  if (this.unlistenHistory) {
                    this.unlistenHistory();
                  }
                  const { state } = this.history.location;
              Severity: Major
              Found in app/javascript/flavours/glitch/components/modal_root.jsx and 1 other location - About 2 hrs to fix
              app/javascript/mastodon/components/modal_root.jsx on lines 110..118

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

              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

              export const attachFullscreenListener = (listener) => {
                if ('onfullscreenchange' in document) {
                  document.addEventListener('fullscreenchange', listener);
                } else if ('onwebkitfullscreenchange' in document) {
                  document.addEventListener('webkitfullscreenchange', listener);
              app/javascript/flavours/glitch/features/ui/util/fullscreen.js on lines 38..46
              app/javascript/mastodon/features/ui/util/fullscreen.js on lines 28..36
              app/javascript/mastodon/features/ui/util/fullscreen.js on lines 38..46

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

              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

                modeLabel (mode) {
                  switch(mode) {
                  case 'any':
                    return <FormattedMessage id='hashtag.column_settings.tag_mode.any' defaultMessage='Any of these' />;
                  case 'all':
              app/javascript/mastodon/features/hashtag_timeline/components/column_settings.jsx on lines 93..104

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

              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

                _handleModalClose () {
                  if (this.unlistenHistory) {
                    this.unlistenHistory();
                  }
                  const { state } = this.history.location;
              Severity: Major
              Found in app/javascript/mastodon/components/modal_root.jsx and 1 other location - About 2 hrs to fix
              app/javascript/flavours/glitch/components/modal_root.jsx on lines 115..123

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

              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

                modeLabel (mode) {
                  switch(mode) {
                  case 'any':
                    return <FormattedMessage id='hashtag.column_settings.tag_mode.any' defaultMessage='Any of these' />;
                  case 'all':
              app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx on lines 95..106

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

              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