WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 1,672 of 1,672 total issues

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

export default function news(state = initialState, action) {
  switch (action.type) {
    case RECEIVE_NEWS_CONTENT_LIST:
      return { ...state, news_content_list: action.news_content_list };
    case CREATE_NEWS_CONTENT:
Severity: Minor
Found in app/assets/javascripts/reducers/news.js - About 1 hr to fix

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

    const ConfigureSiteNotice = (props) => {
      const [isSiteNotice, setIsSiteNotice] = useState();
      const dispatch = useDispatch();
    
      const getKey = () => {

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

      const TemplatesScoping = () => {
        const templates = useSelector(state => state.scopingMethods.templates.include);
        const home_wiki = useSelector(state => state.course.home_wiki);
        const [currentWiki, setCurrentWiki] = useState(home_wiki);
        return (

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

        const Expandable = function (Component) {
          const wrappedComponent = createReactClass({
            displayName: 'Expandable',
        
            statics: {
        Severity: Minor
        Found in app/assets/javascripts/components/high_order/expandable.jsx - About 1 hr to fix

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

          const NotificationsBell = () => {
            const [hasOpenTickets, setHasOpenTickets] = useState(false);
            const [hasRequestedAccounts, setHasRequestedAccounts] = useState(false);
          
            useEffect(() => {
          Severity: Minor
          Found in app/assets/javascripts/components/nav/notifications_bell.jsx - About 1 hr to fix

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

              render() {
                const currentWeek = CourseDateUtils.currentWeekOrder(this.props.timelineStart);
                const weekNumberOffset = CourseDateUtils.weeksBeforeTimeline(this.props.course);
                const blocks = [];
            
            
            Severity: Minor
            Found in app/assets/javascripts/components/overview/milestones.jsx - About 1 hr to fix

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

                test('counts partial weeks if they cross between Sunday-bounded weeks', () => {
                  const course = { start: '2017-07-06', timeline_start: '2017-07-10' };
                  const output = CourseDateUtils.weeksBeforeTimeline(course);
                  expect(output).toBe(1);
                });
              Severity: Major
              Found in test/utils/course_date_utils.spec.js and 3 other locations - About 1 hr to fix
              test/utils/course_date_utils.spec.js on lines 117..121
              test/utils/course_date_utils.spec.js on lines 122..126
              test/utils/course_date_utils.spec.js on lines 132..136

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

              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

                test('rounds times within the same week to zero', () => {
                  const course = { start: '2017-07-02', timeline_start: '2017-07-05' };
                  const output = CourseDateUtils.weeksBeforeTimeline(course);
                  expect(output).toBe(0);
                });
              Severity: Major
              Found in test/utils/course_date_utils.spec.js and 3 other locations - About 1 hr to fix
              test/utils/course_date_utils.spec.js on lines 122..126
              test/utils/course_date_utils.spec.js on lines 127..131
              test/utils/course_date_utils.spec.js on lines 132..136

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

              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

                test('rounds down to the number of week boundaries crossed', () => {
                  const course = { start: '2017-07-02', timeline_start: '2017-07-13' };
                  const output = CourseDateUtils.weeksBeforeTimeline(course);
                  expect(output).toBe(1);
                });
              Severity: Major
              Found in test/utils/course_date_utils.spec.js and 3 other locations - About 1 hr to fix
              test/utils/course_date_utils.spec.js on lines 117..121
              test/utils/course_date_utils.spec.js on lines 122..126
              test/utils/course_date_utils.spec.js on lines 127..131

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

              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

                test('counts whole weeks accurately, Sunday to Sunday', () => {
                  const course = { start: '2017-07-02', timeline_start: '2017-07-09' };
                  const output = CourseDateUtils.weeksBeforeTimeline(course);
                  expect(output).toBe(1);
                });
              Severity: Major
              Found in test/utils/course_date_utils.spec.js and 3 other locations - About 1 hr to fix
              test/utils/course_date_utils.spec.js on lines 117..121
              test/utils/course_date_utils.spec.js on lines 127..131
              test/utils/course_date_utils.spec.js on lines 132..136

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

              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

                          <TextInput
                            id="after_deadline_message"
                            editable
                            onChange={this.handleChange}
                            value={this.state.after_deadline_message}
              app/assets/javascripts/components/settings/views/course_creation_settings_form.jsx on lines 50..59

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

              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

              Checkbox.propTypes = {
                container_class: PropTypes.string,
                label: PropTypes.string,
                value: PropTypes.bool,
                editable: PropTypes.bool,
              Severity: Major
              Found in app/assets/javascripts/components/common/checkbox.jsx and 1 other location - About 1 hr to fix
              app/assets/javascripts/components/common/multi_select_field.jsx on lines 50..56

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

              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

                            <td className={rowClassName} onClick={e => (isEditing ? e.stopPropagation() : null)}>
                              <TextAreaInput
                                onChange={updateNoteTitle}
                                value={isEditing ? noteTitle : note.title}
                                placeholder={'Note Title'}
              Severity: Major
              Found in app/assets/javascripts/components/admin_notes/notes_row.jsx and 1 other location - About 1 hr to fix
              app/assets/javascripts/components/admin_notes/notes_row.jsx on lines 182..192

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

              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

                    <AsyncSelect
                      loadOptions={loadOptions}
                      placeholder={I18n.t('courses_generic.creator.scoping_methods.start_typing_to_search')}
                      isMulti
                      id="categories"
              app/assets/javascripts/components/common/ScopingMethods/autocomplete_templates_input.jsx on lines 36..44

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 61.

              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

                          <TextInput
                            id="before_deadline_message"
                            editable
                            onChange={this.handleChange}
                            value={this.state.before_deadline_message}
              app/assets/javascripts/components/settings/views/course_creation_settings_form.jsx on lines 60..69

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

              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

                              <th colSpan="5" tabIndex="0">
                                <TextAreaInput
                                  onChange={updateNoteText}
                                  value={isEditing ? noteText : note.text}
                                  placeholder={'Note Text'}
              Severity: Major
              Found in app/assets/javascripts/components/admin_notes/notes_row.jsx and 1 other location - About 1 hr to fix
              app/assets/javascripts/components/admin_notes/notes_row.jsx on lines 141..151

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

              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

                              <button
                                className="tooltip-trigger post--note admin-focus-highlight"
                                onClick={() => onClickPostNotesHandler(course.id)}
                                aria-label={I18n.t('notes.admin.aria_label.post_created_note')}
                              >
              app/assets/javascripts/components/admin_notes/notes_panel.jsx on lines 131..140

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

              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

                    <AsyncSelect
                      loadOptions={loadOptions}
                      placeholder={I18n.t('courses_generic.creator.scoping_methods.start_typing_to_search')}
                      isMulti
                      id="templates"
              app/assets/javascripts/components/common/ScopingMethods/autocomplete_categories_input.jsx on lines 33..41

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 61.

              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

              MultiSelectField.propTypes = {
                label: PropTypes.string,
                options: PropTypes.array,
                disabled: PropTypes.bool,
                selected: PropTypes.array,
              app/assets/javascripts/components/common/checkbox.jsx on lines 29..35

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

              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

                              <button
                                className="tooltip-trigger cancel--note admin-focus-highlight"
                                onClick={() => setIsNoteCreationActive(false)}
                                aria-label={I18n.t('notes.admin.aria_label.cancel_note_creation')}
                              >
              app/assets/javascripts/components/admin_notes/notes_panel.jsx on lines 141..153

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

              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

              Severity
              Category
              Status
              Source
              Language