glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/actions/accounts.js

Summary

Maintainability
F
2 wks
Test Coverage

File accounts.js has 643 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import api, { getLinks } from '../api';

import {
  followAccountSuccess, unfollowAccountSuccess,
  authorizeFollowRequestSuccess, rejectFollowRequestSuccess,
Severity: Major
Found in app/javascript/flavours/glitch/actions/accounts.js - About 1 day to fix

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

    export function fetchRelationships(accountIds) {
      return (dispatch, getState) => {
        const state = getState();
        const loadedRelationships = state.get('relationships');
        const newAccountIds = accountIds.filter(id => loadedRelationships.get(id, null) === null);
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 1 day to fix
    app/javascript/mastodon/actions/accounts.js on lines 450..469

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

    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 function expandFollowers(id) {
      return (dispatch, getState) => {
        const url = getState().getIn(['user_lists', 'followers', id, 'next']);
    
        if (url === null) {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 1 day to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 417..437
    app/javascript/mastodon/actions/accounts.js on lines 317..337
    app/javascript/mastodon/actions/accounts.js on lines 404..424

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

    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 function expandFollowing(id) {
      return (dispatch, getState) => {
        const url = getState().getIn(['user_lists', 'following', id, 'next']);
    
        if (url === null) {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 1 day to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 330..350
    app/javascript/mastodon/actions/accounts.js on lines 317..337
    app/javascript/mastodon/actions/accounts.js on lines 404..424

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

    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 function followAccount(id, options = { reblogs: true }) {
      return (dispatch, getState) => {
        const alreadyFollowing = getState().getIn(['relationships', id, 'following']);
        const locked = getState().getIn(['accounts', id, 'locked'], false);
    
    
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 1 day to fix
    app/javascript/mastodon/actions/accounts.js on lines 142..155

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

    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 8 locations. Consider refactoring.
    Open

    export function fetchFollowing(id) {
      return (dispatch, getState) => {
        dispatch(fetchFollowingRequest(id));
    
        api(getState).get(`/api/v1/accounts/${id}/following`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 7 other locations - About 1 day to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 289..303
    app/javascript/flavours/glitch/actions/interactions.js on lines 280..293
    app/javascript/flavours/glitch/actions/interactions.js on lines 362..375
    app/javascript/mastodon/actions/accounts.js on lines 276..290
    app/javascript/mastodon/actions/accounts.js on lines 363..377
    app/javascript/mastodon/actions/interactions.js on lines 280..293
    app/javascript/mastodon/actions/interactions.js on lines 362..375

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

    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 8 locations. Consider refactoring.
    Open

    export function fetchFollowers(id) {
      return (dispatch, getState) => {
        dispatch(fetchFollowersRequest(id));
    
        api(getState).get(`/api/v1/accounts/${id}/followers`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 7 other locations - About 1 day to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 376..390
    app/javascript/flavours/glitch/actions/interactions.js on lines 280..293
    app/javascript/flavours/glitch/actions/interactions.js on lines 362..375
    app/javascript/mastodon/actions/accounts.js on lines 276..290
    app/javascript/mastodon/actions/accounts.js on lines 363..377
    app/javascript/mastodon/actions/interactions.js on lines 280..293
    app/javascript/mastodon/actions/interactions.js on lines 362..375

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

    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 function expandFollowRequests() {
      return (dispatch, getState) => {
        const url = getState().getIn(['user_lists', 'follow_requests', 'next']);
    
        if (url === null) {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 7 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 521..537

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

    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 updateAccount = ({ displayName, note, avatar, header, discoverable, indexable }) => (dispatch, getState) => {
      const data = new FormData();
    
      data.append('display_name', displayName);
      data.append('note', note);
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 7 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 665..678

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

    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 function muteAccount(id, notifications, duration=0) {
      return (dispatch, getState) => {
        dispatch(muteAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/mute`, { notifications, duration }).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 6 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 222..233

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

    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 function fetchFollowRequests() {
      return (dispatch, getState) => {
        dispatch(fetchFollowRequestsRequest());
    
        api(getState).get('/api/v1/follow_requests').then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 6 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 488..498

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

    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 function blockAccount(id) {
      return (dispatch, getState) => {
        dispatch(blockAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/block`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 5 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 169..180

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

    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 lookupAccount = acct => (dispatch, getState) => {
      dispatch(lookupAccountRequest(acct));
    
      api(getState).get('/api/v1/accounts/lookup', { params: { acct } }).then(response => {
        dispatch(fetchRelationships([response.data.id]));
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 5 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 92..102

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

    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 function unfollowAccount(id) {
      return (dispatch, getState) => {
        dispatch(unfollowAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/unfollow`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 5 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 157..167

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

    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 function fetchAccount(id) {
      return (dispatch, getState) => {
        dispatch(fetchRelationships([id]));
        dispatch(fetchAccountRequest(id));
    
    
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 1 other location - About 5 hrs to fix
    app/javascript/mastodon/actions/accounts.js on lines 78..90

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

    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 function unmuteAccount(id) {
      return (dispatch, getState) => {
        dispatch(unmuteAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/unmute`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 4 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 195..205
    app/javascript/mastodon/actions/accounts.js on lines 182..192
    app/javascript/mastodon/actions/accounts.js on lines 235..245

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

    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 function unblockAccount(id) {
      return (dispatch, getState) => {
        dispatch(unblockAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/unblock`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 4 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 248..258
    app/javascript/mastodon/actions/accounts.js on lines 182..192
    app/javascript/mastodon/actions/accounts.js on lines 235..245

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

    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 function unpinAccount(id) {
      return (dispatch, getState) => {
        dispatch(unpinAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/unpin`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 4 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 626..636
    app/javascript/mastodon/actions/accounts.js on lines 613..623
    app/javascript/mastodon/actions/accounts.js on lines 625..635

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

    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 function pinAccount(id) {
      return (dispatch, getState) => {
        dispatch(pinAccountRequest(id));
    
        api(getState).post(`/api/v1/accounts/${id}/pin`).then(response => {
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 4 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 638..648
    app/javascript/mastodon/actions/accounts.js on lines 613..623
    app/javascript/mastodon/actions/accounts.js on lines 625..635

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

    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 function authorizeFollowRequest(id) {
      return (dispatch, getState) => {
        dispatch(authorizeFollowRequestRequest(id));
    
        api(getState)
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 3 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 600..609
    app/javascript/mastodon/actions/accounts.js on lines 560..569
    app/javascript/mastodon/actions/accounts.js on lines 587..596

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

    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 function rejectFollowRequest(id) {
      return (dispatch, getState) => {
        dispatch(rejectFollowRequestRequest(id));
    
        api(getState)
    Severity: Major
    Found in app/javascript/flavours/glitch/actions/accounts.js and 3 other locations - About 3 hrs to fix
    app/javascript/flavours/glitch/actions/accounts.js on lines 573..582
    app/javascript/mastodon/actions/accounts.js on lines 560..569
    app/javascript/mastodon/actions/accounts.js on lines 587..596

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

    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

    There are no issues that match your filters.

    Category
    Status