WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,667 total issues

Function StudentExerciseList has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const StudentExerciseList = (props) => {
  const {
    assignments, course, current_user, editAssignments, exerciseView, openKey, selected,
    sort, trainingStatus, wikidataLabels, sortUsers, userRevisions = {}
  } = props;

    Function CampaignList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    const CampaignList = ({ keys, showSearch, RowElement, headerText, userOnly, showStatistics = false }) => {
      const { all_campaigns, all_campaigns_loaded, sort } = useSelector(state => state.campaigns);
      const [searchParams, setSearchParams] = useSearchParams();
      const search = searchParams.get('search');
      const filteredCampaigns = showSearch && search ? all_campaigns.filter(campaign => campaign.title.toLowerCase().includes(search.toLowerCase())) : all_campaigns;
    Severity: Minor
    Found in app/assets/javascripts/components/campaign/campaign_list.jsx - About 2 hrs 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 TextInput has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    const TextInput = ({
      value,
      value_key,
      editable,
      label,
    Severity: Minor
    Found in app/assets/javascripts/components/common/text_input.jsx - About 2 hrs 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 course has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function course(state = initialState, action) {
      switch (action.type) {
        case RECEIVE_COURSE:
          return { loading: false, ...action.data.course };
        case RECEIVE_COURSE_UPDATE: {
    Severity: Major
    Found in app/assets/javascripts/reducers/course.js - About 2 hrs to fix

      Function EditableRedux has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const EditableRedux = (Component, Label) => {
        const editableComponent = createReactClass({
          displayName: 'EditableRedux',
          propTypes: {
            course_id: PropTypes.any,
      Severity: Major
      Found in app/assets/javascripts/components/high_order/editable_redux.jsx - About 2 hrs to fix

        Function Confirm has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Confirm = () => {
          const dispatch = useDispatch();
        
          const confirmationActive = useSelector(state => state.confirm.confirmationActive);
          const confirmMessage = useSelector(state => state.confirm.confirmMessage);
        Severity: Major
        Found in app/assets/javascripts/components/common/confirm.jsx - About 2 hrs to fix

          Function CampaignOresPlot has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const CampaignOresPlot = (props) => {
            const [show, setShow] = useState(false);
            const [loading, setLoading] = useState(true);
            const [filePath, setFilePath] = useState(null);
          
          
          Severity: Major
          Found in app/assets/javascripts/components/campaign/campaign_ores_plot.jsx - About 2 hrs to fix

            Function onreadystatechange has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            document.onreadystatechange = () => {
              if (document.readyState === 'complete') {
                // Find tables with rows with data-link attribute, then make them clickable
                document.querySelector('tr[data-link]')?.addEventListener('click', (e) => {
                  // skip if a button was clicked (used for other actions)
            Severity: Minor
            Found in app/assets/javascripts/utils/course.js - About 2 hrs 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 getAssessments has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            export const getAssessments = (allRatings, revisions) => {
              const ratings = Object.assign({}, ...allRatings);
              const assessments = {};
              for (const revision of revisions) {
                const assessment = {};
            Severity: Minor
            Found in app/assets/javascripts/utils/revision_utils.js - About 2 hrs 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 Upload has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            const Upload = ({ upload, view, linkUsername }) => {
              const [width, setWidth] = useState(null);
              const [height, setHeight] = useState(null);
              const [isUploadViewerOpen, setIsUploadViewerOpen] = useState(false);
              const [imageFile, setImageFile] = useState(null);
            Severity: Minor
            Found in app/assets/javascripts/components/uploads/upload.jsx - About 2 hrs 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 NotifyInstructorsButton has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const NotifyInstructorsButton = (props) => {
              const { notification, visible } = props;
              const dispatch = useDispatch();
            
              const sendNotificationHandler = () => {

              DatePicker has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              const DatePicker = createReactClass({
                displayName: 'DatePicker',
              
                propTypes: {
                  id: PropTypes.string,
              Severity: Minor
              Found in app/assets/javascripts/components/common/date_picker.jsx - About 2 hrs to fix

                Function Assignment has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Assignment = (props) => {
                    if (!props.course.home_wiki) { return <div />; }
                    const article = props.article || CourseUtils.articleFromAssignment(props.assignmentGroup[0], props.course.home_wiki);
                    if (!article.formatted_title) {
                      article.formatted_title = CourseUtils.formattedArticleTitle(article, props.course.home_wiki, props.wikidataLabel);
                Severity: Major
                Found in app/assets/javascripts/components/assignments/assignment.jsx - About 2 hrs to fix

                  Function render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      const dateCalc = new DateCalculator(this.props.timeline_start, this.props.timeline_end, this.props.index, { zeroIndexed: false });
                      let weekDatesContent;
                      let meetDates;
                      if (this.props.meetings && this.props.meetings.length > 0) {
                  Severity: Minor
                  Found in app/assets/javascripts/components/timeline/week.jsx - About 2 hrs 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 EnrollCard has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const EnrollCard = ({
                    user, userRoles, course, courseLink, passcode, enrolledParam, enrollFailureReason
                  }) => {
                    const [modalShown, setModalShown] = useState(false);
                    const [isHovered, setIsHovered] = useState(false);
                  Severity: Minor
                  Found in app/assets/javascripts/components/enroll/enroll_card.jsx - About 2 hrs 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 SearchableCourseList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const SearchableCourseList = () => {
                    const [searchParams, setSearchParams] = useSearchParams();
                    const { results, loaded, sort } = useSelector(state => state.course_search_results);
                    const dispatch = useDispatch();
                    const searchRef = useRef();
                  Severity: Minor
                  Found in app/assets/javascripts/components/course/searchable_course_list.jsx - About 2 hrs 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 render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      const keys = articleListKeys(this.props.course);
                      const project = this.props.course.home_wiki.project;
                      const trackedEditable = this.props.current_user && this.props.current_user.isAdvancedRole;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/components/articles/article_list.jsx - About 2 hrs 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 EditableRedux has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const EditableRedux = (Component, Label) => {
                    const editableComponent = createReactClass({
                      displayName: 'EditableRedux',
                      propTypes: {
                        course_id: PropTypes.any,
                  Severity: Minor
                  Found in app/assets/javascripts/components/high_order/editable_redux.jsx - About 2 hrs 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 UploadList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const UploadList = ({ uploads, view, sortBy, loadingUploads, totalUploadsCount }) => {
                    let elements;
                    let noUploadsMessage;
                    if (uploads.length > 0) {
                      elements = uploads.map(upload => (
                  Severity: Minor
                  Found in app/assets/javascripts/components/uploads/upload_list.jsx - About 2 hrs 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 AssignmentLinks has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const AssignmentLinks = ({ assignment, courseType, user, course, project, editMode }) => {
                    const { article_url, id, role, editors } = assignment;
                    const actions = [];
                  
                    if ((editors && editors.length) || assignment.role === ASSIGNED_ROLE) {

                  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