WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,667 total issues

Avoid too many return statements within this function.
Open

      return { ...state, blocks };
Severity: Major
Found in app/assets/javascripts/reducers/timeline.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return { ...state, blocks: { ...state.blocksPersisted }, weeks: deepCopyWeeks(state.weeksPersisted), editableBlockIds: [] };
    Severity: Major
    Found in app/assets/javascripts/reducers/timeline.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return newState;
      Severity: Major
      Found in app/assets/javascripts/reducers/notifications.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return {
                ...state,
                templates: {
                  ...state.templates,
                  include: action.templates
        Severity: Major
        Found in app/assets/javascripts/reducers/scoping_methods.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return {
                  ...state,
                  articles: newStateArticles,
                  fetchState: 'PAGEVIEWS_RECEIVED',
                };
          Severity: Major
          Found in app/assets/javascripts/reducers/article_finder.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return newState;
            Severity: Major
            Found in app/assets/javascripts/reducers/revisions.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return {
                      ...state,
                      uploadMetadata: action.data,
                    };
              Severity: Major
              Found in app/assets/javascripts/reducers/uploads.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return {
                        ...state,
                        averageViews: initialState.averageViews,
                      };
                Severity: Major
                Found in app/assets/javascripts/reducers/uploads.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return { ...state, loading: true };
                  Severity: Major
                  Found in app/assets/javascripts/reducers/assignments.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return {
                            ...state,
                            selectedFilters: action.selectedFilters,
                          };
                    Severity: Major
                    Found in app/assets/javascripts/reducers/uploads.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return {
                              ...state,
                              averageViews: views,
                            };
                      Severity: Major
                      Found in app/assets/javascripts/reducers/uploads.js - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                            return false
                        Severity: Major
                        Found in app/presenters/rapidfire_question_presenter.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return nil if @assignments.empty? && initial_page_content.empty?
                          Severity: Major
                          Found in lib/wiki_assignment_output.rb - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return (
                                  <div className="tile-container" onClick={toggleUploadViewer}>
                                    <div className="tile">
                                      <img src={imageFile} alt={fileName} />
                                      <div className="info">
                            Severity: Major
                            Found in app/assets/javascripts/components/uploads/upload.jsx - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                    return nil
                              Severity: Major
                              Found in app/helpers/article_helper.rb - About 30 mins to fix

                                Function addSandboxUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const addSandboxUrl = (assignments, course, user_id) => {
                                  return (assignment) => {
                                    const result = {
                                      ...assignment,
                                      sandboxUrl: sandboxUrl(course, assignment)

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function formattedArticleTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  static formattedArticleTitle(article, defaultWiki, wikidataLabel) {
                                    let languagePrefix = '';
                                    if (!defaultWiki || !defaultWiki.language || !article.language || article.language === defaultWiki.language) {
                                      languagePrefix = '';
                                    } else {
                                Severity: Minor
                                Found in app/assets/javascripts/utils/course_utils.js - About 25 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function toDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const toDate = (date, suppressError) => {
                                  if (date instanceof Date) {
                                    return date;
                                  }
                                  // should not really happen in production, but it's here for making the tests pass
                                Severity: Minor
                                Found in app/assets/javascripts/utils/date_utils.js - About 25 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function fetchReferencesAddedFromWiki has a Cognitive Complexity of 6 (exceeds 5 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 25 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function nameHasChanged has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export const nameHasChanged = () => (_dispatch, getState) => {
                                  const { course, persistedCourse } = getState();
                                  if (course.title !== persistedCourse.title) { return true; }
                                  if (course.term !== persistedCourse.term) { return true; }
                                  if (course.school !== persistedCourse.school) { return true; }
                                Severity: Minor
                                Found in app/assets/javascripts/actions/course_actions.js - About 25 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Severity
                                Category
                                Status
                                Source
                                Language