glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

const mapStateToProps = (state, { statusId }) => ({
  status: state.getIn(['statuses', statusId]),
  accountStaticAvatar: state.getIn(['accounts', state.getIn(['statuses', statusId, 'account']), 'avatar_static']),
});
app/javascript/flavours/glitch/features/ui/components/audio_modal.jsx on lines 10..13

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

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

  return (
    <Button
      onClick={handleClick}
      disabled={relationship?.blocked_by || relationship?.blocking}
      secondary={following}
Severity: Major
Found in app/javascript/mastodon/components/follow_button.tsx and 1 other location - About 1 hr to fix
app/javascript/flavours/glitch/components/follow_button.tsx on lines 99..108

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

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 interface ApiAccountWarningJSON {
  id: string;
  action: AccountWarningAction;
  text: string;
  status_ids: string[];
Severity: Major
Found in app/javascript/flavours/glitch/api_types/notifications.ts and 1 other location - About 1 hr to fix
app/javascript/mastodon/api_types/notifications.ts on lines 90..98

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

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

  return (
    <Button
      onClick={handleClick}
      disabled={relationship?.blocked_by || relationship?.blocking}
      secondary={following}
Severity: Major
Found in app/javascript/flavours/glitch/components/follow_button.tsx and 1 other location - About 1 hr to fix
app/javascript/mastodon/components/follow_button.tsx on lines 99..108

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

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 requestNotificationPermission = async (
  callback: NotificationPermissionCallback,
) => {
  try {
    callback(await Notification.requestPermission());
Severity: Major
Found in app/javascript/mastodon/utils/notifications.ts and 1 other location - About 1 hr to fix
app/javascript/flavours/glitch/utils/notifications.ts on lines 5..13

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

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 requestNotificationPermission = async (
  callback: NotificationPermissionCallback,
) => {
  try {
    callback(await Notification.requestPermission());
Severity: Major
Found in app/javascript/flavours/glitch/utils/notifications.ts and 1 other location - About 1 hr to fix
app/javascript/mastodon/utils/notifications.ts on lines 5..13

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

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 interface ApiAccountWarningJSON {
  id: string;
  action: AccountWarningAction;
  text: string;
  status_ids: string[];
Severity: Major
Found in app/javascript/mastodon/api_types/notifications.ts and 1 other location - About 1 hr to fix
app/javascript/flavours/glitch/api_types/notifications.ts on lines 90..98

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

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

export const makeGetStatus = () => {
  return createSelector(
    [
      (state, { id }) => state.getIn(['statuses', id]),
      (state, { id }) => state.getIn(['statuses', state.getIn(['statuses', id, 'reblog'])]),
Severity: Minor
Found in app/javascript/flavours/glitch/selectors/index.js - About 1 hr to fix

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

      render () {
        const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, className, id, maxLength, lang, spellCheck } = this.props;
        const { suggestionsHidden } = this.state;
    
        return (
    Severity: Minor
    Found in app/javascript/flavours/glitch/components/autosuggest_input.jsx - About 1 hr to fix

      Function expandTimeline has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function expandTimeline(timelineId, path, params = {}) {
        return async (dispatch, getState) => {
          const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
          const isLoadingMore = !!params.max_id;
      
      
      Severity: Minor
      Found in app/javascript/flavours/glitch/actions/timelines.js - About 1 hr to fix

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

          render () {
            const { columns, children, singleColumn, isModalOpen, openSettings } = this.props;
            const { renderComposePanel } = this.state;
        
            if (singleColumn) {

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

            render () {
              const { disabledAcct, movedToAcct } = this.props;
          
              const disabledAccountLink = (
                <Link to={`/@${disabledAcct}`}>

            Function componentDidMount has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              componentDidMount () {
                const { signedIn } = this.props.identity;
            
                window.addEventListener('beforeunload', this.handleBeforeUnload, false);
                window.addEventListener('resize', this.handleResize, { passive: true });
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 hr to fix

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

                render () {
                  const { hasUnread, columnId, multiColumn, tag } = this.props;
                  const { id, local } = this.props.params;
                  const pinned = !!columnId;
                  const { signedIn } = this.props.identity;
              Severity: Minor
              Found in app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx - About 1 hr to fix

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

                  _updateStatusLinks () {
                    const node = this.node;
                
                    if (!node) {
                      return;
                Severity: Minor
                Found in app/javascript/mastodon/components/status_content.jsx - About 1 hr to fix

                  Function expandTimeline has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function expandTimeline(timelineId, path, params = {}) {
                    return async (dispatch, getState) => {
                      const timeline = getState().getIn(['timelines', timelineId], ImmutableMap());
                      const isLoadingMore = !!params.max_id;
                  
                  
                  Severity: Minor
                  Found in app/javascript/mastodon/actions/timelines.js - About 1 hr to fix

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

                      render () {
                        const { disabledAcct, movedToAcct } = this.props;
                    
                        const disabledAccountLink = (
                          <Link to={`/@${disabledAcct}`}>

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

                        render () {
                          const { columns, children, singleColumn, isModalOpen } = this.props;
                          const { renderComposePanel } = this.state;
                      
                          if (singleColumn) {
                      Severity: Minor
                      Found in app/javascript/mastodon/features/ui/components/columns_area.jsx - About 1 hr to fix

                        Function UploadForm has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const UploadForm = () => {
                          const dispatch = useDispatch();
                          const mediaIds = useSelector(state => state.getIn(['compose', 'media_attachments']).map(item => item.get('id')));
                          const active = useSelector(state => state.getIn(['compose', 'is_uploading']));
                          const progress = useSelector(state => state.getIn(['compose', 'progress']));
                        Severity: Minor
                        Found in app/javascript/mastodon/features/compose/components/upload_form.jsx - About 1 hr to fix

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

                            render () {
                              const { hasUnread, columnId, multiColumn, tag } = this.props;
                              const { id, local } = this.props.params;
                              const pinned = !!columnId;
                              const { signedIn } = this.props.identity;
                          Severity: Minor
                          Found in app/javascript/mastodon/features/hashtag_timeline/index.jsx - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language