WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 1,672 of 1,672 total issues

Function fetchRevisions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const fetchRevisions = course => async (dispatch, getState) => {
  dispatch({ type: REVISIONS_LOADING });
  const state = getState();
  const users = state.users.users.filter(user => user.role === STUDENT_ROLE);
  if (users.length === 0) {
Severity: Minor
Found in app/assets/javascripts/actions/revisions_actions.js - About 1 hr to fix

    Function fetchReferencesAddedFromWiki has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const fetchReferencesAddedFromWiki = async (wiki_url, revisions) => {
      const wiki = getWikiObjectFromURL(wiki_url);
      if (!isSupportedORESWiki(wiki)) {
        // wiki is not supported
        return;
    Severity: Minor
    Found in app/assets/javascripts/utils/media_wiki_references_utils.js - About 1 hr to fix

      Function validateCurrentQuestion has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        validateCurrentQuestion(e) {
          e.preventDefault();
          const $target = $(e.target);
          const $block = $target.parents('.block');
          this.$currentBlock = $block;
      Severity: Minor
      Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 hr to fix

        Function users has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function users(state = initialState, action) {
          switch (action.type) {
            case RECEIVE_USERS: {
              // Transform the 'real_name' for users in 'action' into separate 'first_name'
              // and 'last_name' properties if 'real_name' is available by using transformUsers.
        Severity: Minor
        Found in app/assets/javascripts/reducers/users.js - About 1 hr to fix

          Function Campaign has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Campaign = () => {
            const dispatch = useDispatch();
            const campaign = useSelector(state => state.campaign);
          
            const { campaign_slug } = useParams();
          Severity: Minor
          Found in app/assets/javascripts/components/campaign/campaign.jsx - About 1 hr to fix

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

                                <li>
                                  <b><a href={`/users/${encodeURIComponent(currentUser)}`} className="current-user">{currentUser}</a></b>
                                </li>
            Severity: Major
            Found in app/assets/javascripts/components/nav/nav.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/nav/hamburger_menu.jsx on lines 79..81

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

            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

                                <li>
                                  <b><a href={`/users/${encodeURIComponent(currentUser)}`} className="current-user">{currentUser}</a></b>
                                </li>
            Severity: Major
            Found in app/assets/javascripts/components/nav/hamburger_menu.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/components/nav/nav.jsx on lines 142..144

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

            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 ModuleStatus = ({
              block_id, course, deadline_status, due_date, flags, kind, module_progress, progressClass, slug,
              complete, fetchExercises, incomplete
            }) => {
              const isTrainingModule = kind === TRAINING_MODULE_KIND;
            app/assets/javascripts/components/common/ArticleViewer/components/Footer.jsx on lines 8..104

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 63.

            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 Footer = ({
              article, colors, failureMessage, showArticleFinder, highlightedHtml, isWhocolorLang,
              whoColorFailed, users, unhighlightedContributors, revisionId, toggleRevisionHandler, pendingRequest
            }) => {
              // Determine the Article Viewer Legend status based on what information
            app/assets/javascripts/components/timeline/TrainingModules/ModuleRow/ModuleStatus/ModuleStatus.jsx on lines 19..53

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

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

              async searchForPages(wiki, search_term, namespace, map=(el)=>el, depth, limit=10){
                let search_query;
                if(search_term.split(' ').length > 1){
                  // if we have multiple words, search for the exact words
                  search_query = `intitle:${search_term}`;
            Severity: Minor
            Found in app/assets/javascripts/utils/api.js - About 1 hr to fix

              Function handleParentConditionalChange has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                handleParentConditionalChange(value, conditionalGroup, $parent) {
                  let { currentAnswers } = conditionalGroup;
                  let conditional;
                  // let resetQuestions = false;
              
              
              Severity: Minor
              Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 hr to fix

                Function search_results has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function search_results(state = initialState, action) {
                  switch (action.type) {
                    case FETCH_COURSE_SEARCH_RESULTS: {
                      return {
                        ...state,
                Severity: Minor
                Found in app/assets/javascripts/reducers/course_search_results.js - About 1 hr to fix

                  Function Controls has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Controls = (props) => {
                    const {
                      course, current_user, students, notify, showOverviewFilters, sortSelect
                    } = props;
                  
                  

                    Function LanguagePicker has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const LanguagePicker = () => {
                      const enN = getNativeName('en');
                      const esN = getNativeName('es');
                      const frN = getNativeName('fr');
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/components/nav/language_picker.jsx - About 1 hr to fix

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

                          expect(newsReducer(initialState, action)).toEqual({
                            news_content_list: [{ id: 1, content: 'News 1' }, { id: 2, content: 'New News' }],
                            create_news: {
                              content: ''
                            }
                      Severity: Major
                      Found in test/reducers/news.spec.js and 1 other location - About 1 hr to fix
                      test/reducers/news.spec.js on lines 53..58

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

                      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

                                    <div className="top-nav__site-logo">
                                      <a className="logo__link" href={rootUrl}>
                                        <img src={logoPath} alt="wiki logo" />
                                      </a>
                                    </div>
                      Severity: Major
                      Found in app/assets/javascripts/components/nav/nav.jsx and 1 other location - About 1 hr to fix
                      app/assets/javascripts/components/nav/hamburger_menu.jsx on lines 18..22

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

                      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

                                <div className="ham-nav__site-logo">
                                  <a className="logo__link" href={rootUrl}>
                                    <img src={logoPath} alt="wiki logo" />
                                  </a>
                                </div>
                      Severity: Major
                      Found in app/assets/javascripts/components/nav/hamburger_menu.jsx and 1 other location - About 1 hr to fix
                      app/assets/javascripts/components/nav/nav.jsx on lines 82..86

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

                      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

                          expect(newsReducer(initialState, action)).toEqual({
                            news_content_list: [{ id: 1, content: 'News 1' }, { id: 2, content: 'Updated News 2' }],
                            create_news: {
                              content: ''
                            }
                      Severity: Major
                      Found in test/reducers/news.spec.js and 1 other location - About 1 hr to fix
                      test/reducers/news.spec.js on lines 70..75

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

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

                      export default function validations(state = initialState, action) {
                        switch (action.type) {
                          // This adds a validation, but without marking it 'changed'.
                          // This means no error message gets added to the queue.
                          case ADD_VALIDATION: {
                      Severity: Minor
                      Found in app/assets/javascripts/reducers/validations.js - About 1 hr to fix

                        Function processQuestionGroupData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          processQuestionGroupData(data) {
                            const _postData = {};
                            const answerGroup = {};
                            data.forEach((field) => {
                              const { name } = field;
                        Severity: Minor
                        Found in app/assets/javascripts/surveys/modules/Survey.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language