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

  onToggle = () => {
    if (this.state.open && this.hasTags()) {
      this.props.onChange('tags', {});
    }

app/javascript/flavours/glitch/features/hashtag_timeline/components/column_settings.jsx on lines 60..66

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

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

  handleOpenMedia = (media, index, lang) => {
    this.props.dispatch(openModal({
      modalType: 'MEDIA',
      modalProps: { statusId: this.props.status.get('id'), media, index, lang },
    }));
Severity: Major
Found in app/javascript/flavours/glitch/features/status/index.jsx and 3 other locations - About 2 hrs to fix
app/javascript/flavours/glitch/features/status/index.jsx on lines 423..428
app/javascript/mastodon/features/status/index.jsx on lines 368..373
app/javascript/mastodon/features/status/index.jsx on lines 375..380

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

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 makeMapStateToProps = () => {
  const getAccount = makeGetAccount();

  const mapStateToProps = (state, { accountId }) => ({
    account: getAccount(state, accountId),
app/javascript/mastodon/features/account_timeline/containers/header_container.jsx on lines 33..43

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

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 makeMapStateToProps = () => {
  const getAccount = makeGetAccount();

  const mapStateToProps = (state, { accountId }) => ({
    account: getAccount(state, accountId),
app/javascript/flavours/glitch/features/account_timeline/containers/header_container.jsx on lines 31..41

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

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

registerRoute(
  ({ request }) => request.destination === 'font',
  new CacheFirst({
    cacheName: `${CACHE_NAME_PREFIX}fonts`,
    plugins: [
Severity: Major
Found in app/javascript/mastodon/service_worker/entry.js and 1 other location - About 2 hrs to fix
app/javascript/mastodon/service_worker/entry.js on lines 46..57

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

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

registerRoute(
  ({ request }) => request.destination === 'image',
  new CacheFirst({
    cacheName: `m${CACHE_NAME_PREFIX}media`,
    plugins: [
Severity: Major
Found in app/javascript/mastodon/service_worker/entry.js and 1 other location - About 2 hrs to fix
app/javascript/mastodon/service_worker/entry.js on lines 33..44

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

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

  renderItem (account, size, index) {
    const { animate } = this.props;

    let width  = 50;
    let height = 100;
Severity: Major
Found in app/javascript/flavours/glitch/components/avatar_composite.jsx - About 2 hrs to fix

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

      render () {
        const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
        const pinned = !!columnId;
        const { signedIn } = this.props.identity;
        const banners = [];
    Severity: Major
    Found in app/javascript/flavours/glitch/features/home_timeline/index.jsx - About 2 hrs to fix

      Function listEditorReducer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function listEditorReducer(state = initialState, action) {
        switch(action.type) {
        case LIST_EDITOR_RESET:
          return initialState;
        case LIST_EDITOR_SETUP:
      Severity: Major
      Found in app/javascript/flavours/glitch/reducers/list_editor.js - About 2 hrs to fix

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

          render () {
            const { url, type, displayNameHtml, signupUrl } = this.props;
        
            const name = <bdi dangerouslySetInnerHTML={{ __html: displayNameHtml }} />;
        
        
        Severity: Major
        Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 2 hrs to fix

          Function renderItem has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderItem (account, size, index) {
              const { animate } = this.props;
          
              let width  = 50;
              let height = 100;
          Severity: Major
          Found in app/javascript/mastodon/components/avatar_composite.jsx - About 2 hrs to fix

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

              render () {
                const { url, type, displayNameHtml, signupUrl } = this.props;
            
                const name = <bdi dangerouslySetInnerHTML={{ __html: displayNameHtml }} />;
            
            
            Severity: Major
            Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 2 hrs to fix

              Function listEditorReducer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function listEditorReducer(state = initialState, action) {
                switch(action.type) {
                case LIST_EDITOR_RESET:
                  return initialState;
                case LIST_EDITOR_SETUP:
              Severity: Major
              Found in app/javascript/mastodon/reducers/list_editor.js - About 2 hrs to fix

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

                  render () {
                    const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
                    const pinned = !!columnId;
                    const { signedIn } = this.props.identity;
                    const banners = [];
                Severity: Major
                Found in app/javascript/mastodon/features/home_timeline/index.jsx - About 2 hrs to fix

                  File compose_form.jsx has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import PropTypes from 'prop-types';
                  import { createRef } from 'react';
                  
                  import { defineMessages, injectIntl } from 'react-intl';
                  
                  
                  Severity: Minor
                  Found in app/javascript/mastodon/features/compose/components/compose_form.jsx - About 2 hrs to fix

                    Function connectTimelineStream has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) => {
                      const { messages } = getLocale();
                    
                      return connectStream(channelName, params, (dispatch, getState) => {
                        const locale = getState().getIn(['meta', 'locale']);
                    Severity: Major
                    Found in app/javascript/flavours/glitch/actions/streaming.js - About 2 hrs to fix

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

                        render () {
                          const { status, intl, showReplyCount, withOpenButton } = this.props;
                      
                          const publicStatus  = ['public', 'unlisted'].includes(status.get('visibility'));
                          const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';

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

                          render () {
                            const { intl } = this.props;
                            const { value, expanded, options, selectedOption, error, isSubmitting } = this.state;
                            const domain = (valueToDomain(value) || '').trim();
                            const domainRegExp = new RegExp(`(${escapeRegExp(domain)})`, 'gi');
                        Severity: Major
                        Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 2 hrs to fix

                          Function connectTimelineStream has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) => {
                            const { messages } = getLocale();
                          
                            return connectStream(channelName, params, (dispatch, getState) => {
                              const locale = getState().getIn(['meta', 'locale']);
                          Severity: Major
                          Found in app/javascript/mastodon/actions/streaming.js - About 2 hrs to fix

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

                              render () {
                                const { intl } = this.props;
                                const { value, expanded, options, selectedOption, error, isSubmitting } = this.state;
                                const domain = (valueToDomain(value) || '').trim();
                                const domainRegExp = new RegExp(`(${escapeRegExp(domain)})`, 'gi');
                            Severity: Major
                            Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language