WikiEducationFoundation/WikiEduDashboard

View on GitHub
app/assets/javascripts/actions/settings_actions.js

Summary

Maintainability
F
1 wk
Test Coverage
F
46%

File settings_actions.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open


import {
  SET_ADMIN_USERS, SET_SPECIAL_USERS,
  SUBMITTING_NEW_SPECIAL_USER, REVOKING_SPECIAL_USER,
  SUBMITTING_NEW_ADMIN, REVOKING_ADMIN, SET_COURSE_CREATION_SETTINGS,
Severity: Major
Found in app/assets/javascripts/actions/settings_actions.js - About 1 day to fix

    Function downgradeSpecialUser has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const downgradeSpecialUser = (username, position) => (dispatch) => {
      // remove a user's admin status
      // username: user's username
      dispatch({
        type: REVOKING_SPECIAL_USER,
    Severity: Minor
    Found in app/assets/javascripts/actions/settings_actions.js - About 2 hrs to fix

      Function downgradeAdmin has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const downgradeAdmin = username => (dispatch) => {
        // remove a user's admin status
        // username: user's username
        dispatch({
          type: REVOKING_ADMIN,
      Severity: Minor
      Found in app/assets/javascripts/actions/settings_actions.js - About 1 hr to fix

        Function upgradeAdmin has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const upgradeAdmin = username => (dispatch) => {
          // grant a user admin status
          // username: user's username
          dispatch({
            type: SUBMITTING_NEW_ADMIN,
        Severity: Minor
        Found in app/assets/javascripts/actions/settings_actions.js - About 1 hr to fix

          Function upgradeSpecialUser has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const upgradeSpecialUser = (username, position) => (dispatch) => {
            // grant a user admin status
            // username: user's username
            dispatch({
              type: SUBMITTING_NEW_SPECIAL_USER,
          Severity: Minor
          Found in app/assets/javascripts/actions/settings_actions.js - About 1 hr to fix

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

            const updateSiteNoticePromise = async (siteNotice) => {
              const body = {
                site_notice: siteNotice,
              };
              const response = await request('/settings/update_site_notice', {
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 436..451

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

            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 updateImpactStatsPromise = async (impactStats) => {
              const body = {
                impactStats: impactStats,
              };
              const response = await request('/settings/update_impact_stats', {
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 498..513

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            export const updateDefaultCampaign = campaignSlug => (dispatch) => {
              return updateDefaultCampaignPromise(campaignSlug)
                .then((data) => {
                  dispatch({ type: ADD_NOTIFICATION, notification: { ...data, type: 'success', closable: true } });
                  fetchDefaultCampaign()(dispatch);
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 375..382

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            export const updateCourseCreationSettings = settings => (dispatch) => {
              return updateCourseCreationSettingsPromise(settings)
                .then((data) => {
                  dispatch({ type: ADD_NOTIFICATION, notification: { ...data, type: 'success', closable: true } });
                  fetchCourseCreationSettings()(dispatch);
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 427..434

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

            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 updateCourseCreationSettingsPromise = async (settings) => {
              const response = await request('/settings/update_course_creation', {
                method: 'POST',
                body: JSON.stringify(settings)
              });
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/actions/category_actions.js on lines 29..42

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

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

            const addFeaturedCampaignPromise = async (campaign_slug) => {
              const response = await request(`/settings/add_featured_campaign?featured_campaign_slug=${campaign_slug}`, {
                method: 'POST'
              });
              if (!response.ok) {
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 2 other locations - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 485..496
            app/assets/javascripts/actions/tickets_actions.js on lines 166..177

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

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

            const removeFeaturedCampaignPromise = async (campaign_slug) => {
              const response = await request(`/settings/remove_featured_campaign?featured_campaign_slug=${campaign_slug}`, {
                method: 'POST'
              });
              if (!response.ok) {
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 2 other locations - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 521..532
            app/assets/javascripts/actions/tickets_actions.js on lines 166..177

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

            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

                  fetchSpecialUsersPromise()
                    .then((resp) => {
                      dispatch({
                        type: SET_SPECIAL_USERS,
                        data: resp,
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 279..297

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

            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

                  fetchAdminUsersPromise()
                    .then((resp) => {
                      dispatch({
                        type: SET_ADMIN_USERS,
                        data: resp,
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 170..188

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

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

            export function fetchSpecialUsers() {
              return (dispatch) => {
                return fetchSpecialUsersPromise()
                  .then((resp) => {
                    dispatch({
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 4 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 87..100
            app/assets/javascripts/actions/settings_actions.js on lines 345..358
            app/assets/javascripts/actions/settings_actions.js on lines 397..410
            app/assets/javascripts/actions/settings_actions.js on lines 470..483

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

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

            export function fetchDefaultCampaign() {
              return (dispatch) => {
                return fetchDefaultCamapignPromise()
                  .then((resp) => {
                    dispatch({
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 4 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 72..85
            app/assets/javascripts/actions/settings_actions.js on lines 87..100
            app/assets/javascripts/actions/settings_actions.js on lines 345..358
            app/assets/javascripts/actions/settings_actions.js on lines 470..483

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

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

            export function fetchFeaturedCampaigns() {
              return (dispatch) => {
                return fetchFeaturedCampaignsPromise()
                  .then((resp) => {
                    dispatch({
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 4 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 72..85
            app/assets/javascripts/actions/settings_actions.js on lines 87..100
            app/assets/javascripts/actions/settings_actions.js on lines 345..358
            app/assets/javascripts/actions/settings_actions.js on lines 397..410

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

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

            export function fetchCourseCreationSettings() {
              return (dispatch) => {
                return fetchCourseCreationSettingsPromise()
                  .then((resp) => {
                    dispatch({
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 4 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 72..85
            app/assets/javascripts/actions/settings_actions.js on lines 87..100
            app/assets/javascripts/actions/settings_actions.js on lines 397..410
            app/assets/javascripts/actions/settings_actions.js on lines 470..483

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

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

            export function fetchAdminUsers() {
              return (dispatch) => {
                return fetchAdminUsersPromise()
                  .then((resp) => {
                    dispatch({
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 4 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 72..85
            app/assets/javascripts/actions/settings_actions.js on lines 345..358
            app/assets/javascripts/actions/settings_actions.js on lines 397..410
            app/assets/javascripts/actions/settings_actions.js on lines 470..483

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

            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 grantSpecialUserPromise(username, false, position)
                .then(() => {
                  dispatch(addNotification({
                    type: 'success',
                    message: `${username} was removed as ${position}.`,
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 218..254

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 86.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

              return grantAdminPromise(username, true)
                .then(() => {
                  dispatch({
                    type: SUBMITTING_NEW_ADMIN,
                    data: {
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/actions/settings_actions.js on lines 161..204

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 86.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            const fetchDefaultCamapignPromise = async () => {
              const response = await request('/settings/default_campaign');
            
              if (!response.ok) {
                logErrorMessage(response);
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 7 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/campaign_actions.js on lines 86..95
            app/assets/javascripts/actions/settings_actions.js on lines 15..24
            app/assets/javascripts/actions/settings_actions.js on lines 334..343
            app/assets/javascripts/actions/settings_actions.js on lines 459..468
            app/assets/javascripts/actions/tag_actions.js on lines 29..38
            app/assets/javascripts/actions/training_actions.js on lines 11..20
            app/assets/javascripts/actions/wizard_actions.js on lines 21..30

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

            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

            const fetchAdminUsersPromise = async () => {
              const response = await request('/settings/all_admins');
              if (!response.ok) {
                logErrorMessage(response);
                const data = await response.text();
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 7 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/campaign_actions.js on lines 86..95
            app/assets/javascripts/actions/settings_actions.js on lines 334..343
            app/assets/javascripts/actions/settings_actions.js on lines 385..395
            app/assets/javascripts/actions/settings_actions.js on lines 459..468
            app/assets/javascripts/actions/tag_actions.js on lines 29..38
            app/assets/javascripts/actions/training_actions.js on lines 11..20
            app/assets/javascripts/actions/wizard_actions.js on lines 21..30

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

            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

            const fetchCourseCreationSettingsPromise = async () => {
              const response = await request('/settings/course_creation');
              if (!response.ok) {
                logErrorMessage(response);
                const data = await response.text();
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 7 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/campaign_actions.js on lines 86..95
            app/assets/javascripts/actions/settings_actions.js on lines 15..24
            app/assets/javascripts/actions/settings_actions.js on lines 385..395
            app/assets/javascripts/actions/settings_actions.js on lines 459..468
            app/assets/javascripts/actions/tag_actions.js on lines 29..38
            app/assets/javascripts/actions/training_actions.js on lines 11..20
            app/assets/javascripts/actions/wizard_actions.js on lines 21..30

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

            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

            const fetchFeaturedCampaignsPromise = async () => {
              const response = await request('/campaigns/featured_campaigns');
              if (!response.ok) {
                logErrorMessage(response);
                const data = await response.text();
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 7 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/campaign_actions.js on lines 86..95
            app/assets/javascripts/actions/settings_actions.js on lines 15..24
            app/assets/javascripts/actions/settings_actions.js on lines 334..343
            app/assets/javascripts/actions/settings_actions.js on lines 385..395
            app/assets/javascripts/actions/tag_actions.js on lines 29..38
            app/assets/javascripts/actions/training_actions.js on lines 11..20
            app/assets/javascripts/actions/wizard_actions.js on lines 21..30

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

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

            export const removeFeaturedCampaign = campaign_slug => (dispatch) => {
              return removeFeaturedCampaignPromise(campaign_slug)
                  .then(data => dispatch({ type: REMOVE_FEATURED_CAMPAIGN, data }))
                  .catch(data => dispatch({ type: API_FAIL, data }));
            };
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 8 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/category_actions.js on lines 17..27
            app/assets/javascripts/actions/category_actions.js on lines 44..54
            app/assets/javascripts/actions/course_creation_actions.js on lines 18..22
            app/assets/javascripts/actions/settings_actions.js on lines 559..563
            app/assets/javascripts/actions/timeline_actions.js on lines 35..39
            app/assets/javascripts/actions/training_status_actions.js on lines 29..33
            app/assets/javascripts/actions/uploads_actions.js on lines 20..32
            app/assets/javascripts/actions/uploads_actions.js on lines 84..96

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

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

            export const addFeaturedCampaign = campaign_slug => (dispatch) => {
                return addFeaturedCampaignPromise(campaign_slug)
                  .then(data => dispatch({ type: ADD_FEATURED_CAMPAIGN, data }))
                  .catch(data => dispatch({ type: API_FAIL, data }));
            };
            Severity: Major
            Found in app/assets/javascripts/actions/settings_actions.js and 8 other locations - About 2 hrs to fix
            app/assets/javascripts/actions/category_actions.js on lines 17..27
            app/assets/javascripts/actions/category_actions.js on lines 44..54
            app/assets/javascripts/actions/course_creation_actions.js on lines 18..22
            app/assets/javascripts/actions/settings_actions.js on lines 515..519
            app/assets/javascripts/actions/timeline_actions.js on lines 35..39
            app/assets/javascripts/actions/training_status_actions.js on lines 29..33
            app/assets/javascripts/actions/uploads_actions.js on lines 20..32
            app/assets/javascripts/actions/uploads_actions.js on lines 84..96

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

            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 grantSpecialUserPromise(username, true, position)
                .then(() => {
                  dispatch({
                    type: SUBMITTING_NEW_SPECIAL_USER,
                    data: {
            Severity: Minor
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 45 mins to fix
            app/assets/javascripts/actions/settings_actions.js on lines 270..310

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

            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 grantAdminPromise(username, false)
                .then(() => {
                  dispatch(addNotification({
                    type: 'success',
                    message: `${username} was removed as an administrator.`,
            Severity: Minor
            Found in app/assets/javascripts/actions/settings_actions.js and 1 other location - About 45 mins to fix
            app/assets/javascripts/actions/settings_actions.js on lines 112..145

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

            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

            Parsing error: Cannot find module 'babel-plugin-root-import' Require stack: - /usr/local/node_modules/@babel/core/lib/config/files/plugins.js - /usr/local/node_modules/@babel/core/lib/config/files/index.js - /usr/local/node_modules/@babel/core/lib/index.js - /usr/local/node_modules/@babel/eslint-parser/lib/worker/babel-core.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/worker/handle-message.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/client.cjs - /usr/local/node_modules/@babel/eslint-parser/lib/index.cjs - /usr/local/node_modules/eslint/lib/cli-engine/config-array-factory.js - /usr/src/app/lib/eslint6-patch.js - /usr/src/app/lib/eslint.js - /usr/src/app/bin/eslint.js
            Open

            
            

            For more information visit Source: http://eslint.org/docs/rules/

            There are no issues that match your filters.

            Category
            Status