radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

Function publish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public publish() {
    if (Meteor.isServer) {
      const collection = this.collection;
      Meteor.publish(this.collectionName, function filterStudentID(studentID) { // eslint-disable-line meteor/audit-argument-checks
        // console.log('CourseInstances.publish studentID %o is admin = %o', studentID, Roles.userIsInRole(studentID, [ROLE.ADMIN]));
Severity: Minor
Found in app/imports/api/course/CourseInstanceCollection.ts - About 45 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 AdvisorAddStudentTab has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const AdvisorAddStudentTab: React.FC<AdvisorAddStudentWidgetProps> = ({ interests, careerGoals }) => {
  const [firstName, setFirstName] = useState('');
  const [lastName, setLastName] = useState('');
  const [username, setUsername] = useState('');
  const [isAlumni, setIsAlumni] = useState(false);
Severity: Minor
Found in app/imports/ui/components/advisor/manage/AdvisorAddStudentTab.tsx - About 45 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 publish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public publish(): void {
    if (Meteor.isServer) {
      const collection = this.collection;
      Meteor.publish(this.collectionName, function filterStudentID(studentID) { // eslint-disable-line meteor/audit-argument-checks
        if (_.isNil(studentID)) {
Severity: Minor
Found in app/imports/api/degree-plan/AcademicYearInstanceCollection.ts - About 45 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 FacultyAboutMeWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const FacultyAboutMeWidget: React.FC<FacultyPageAboutMeWidgetProps> = ({ profile, favoriteCareerGoals, favoriteInterests }) => {
  const [websiteState, setWebsite] = useState(profile.website);
  const [pictureState, setPicture] = useState(profile.picture);
  const [aboutMeState, setAboutMe] = useState(profile.aboutMe);
  const { username } = useParams();
Severity: Minor
Found in archive/old-menus/FacultyAboutMeWidget.tsx - About 45 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

Avoid deeply nested control flow statements.
Open

        if (instance.ice.e > 0) {
          iceInstances.push(instance);
        }
Severity: Major
Found in archive/ui/component/student/ice/StudentIceColumnUnverified.tsx - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            if (instance.ice.e > 0) {
              iceInstances.push(instance);
            }
    Severity: Major
    Found in archive/ui/component/student/ice/StudentIceColumnVerified.tsx - About 45 mins to fix

      Function ExplorerMultipleItemsMenuNonMobileWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const ExplorerMultipleItemsMenuNonMobileWidget: React.FC<CardExplorerMenuNonMobileWidgetProps> = ({ menuAddedList, type }) => {
        const match = useRouteMatch();
        const adminEmail = RadGradProperties.getAdminEmail();
        const isStudent = isUrlRoleStudent(match);
        const isFaculty = isUrlRoleFaculty(match) || isUrlRoleAdvisor(match);
      Severity: Minor
      Found in archive/issue-414/ExplorerMultipleItemsMenuNonMobileWidget.tsx - About 45 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

      Avoid deeply nested control flow statements.
      Open

                      if (preAcademicTerm.termNumber >= academicTerm.termNumber) {
                        const academicTermName2 = AcademicTerms.toString(preAcademicTerm._id, false);
                        const description = `${academicTermName}: ${course.num}'s prerequisite ${preCourse.num} is ` +
                          `after or in ${academicTermName2}.`;
                        const definitionData = { user, functionName, description, feedbackType };
      Severity: Major
      Found in archive/api/feedback/FeedbackFunctions.ts - About 45 mins to fix

        Function CommunityUsersWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const CommunityUsersWidget: React.FC<CommunityUsersWidgetProps> = ({ advisors, faculty, loggedInRole, students }) => {
          const tabPaneStyle: React.CSSProperties = {
            overflowX: 'hidden',
            overflowY: 'hidden',
          };
        Severity: Minor
        Found in archive/issue-367/community-users/CommunityUsersWidget.tsx - About 45 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 AdvisorAboutMeWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const AdvisorAboutMeWidget: React.FC<AdvisorAboutMeWidgetProps> = ({ profile, favoriteCareerGoals, favoriteInterests }) => {
          const [websiteState, setWebsite] = useState(profile.website);
          const [pictureState, setPicture] = useState(profile.picture);
          const [aboutMeState, setAboutMe] = useState(profile.aboutMe);
          const { username } = useParams();
        Severity: Minor
        Found in archive/about-me/AdvisorAboutMeWidget.tsx - About 45 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 ExplorerCourse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const ExplorerCourse: React.FC<ExplorerCoursesWidgetProps> = ({ course, courses, completed, itemReviews, profile, terms, interests, teaser, review }) => {
          const segmentStyle = { backgroundColor: 'white' };
          const gridStyle = { marginTop: '5px', paddingLeft: 16 };
          const compactRowStyle = { paddingTop: 2, paddingBottom: 2 };
          const linkStyle = {  textDecoration: 'underline' };

        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 publish has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          publish() {
            if (Meteor.isServer) {
              const collection = this.collection;
              Meteor.publish(this.collectionName, function filterStudentID(userID) { // eslint-disable-line meteor/audit-argument-checks
                if (_.isNil(userID)) {
        Severity: Minor
        Found in app/imports/api/user/profile-entries/ProfileCourseCollection.ts - About 35 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          run({ student, opportunity, academicTerm, verified = false }: { student: string; opportunity: string; academicTerm: string; verified?: boolean; }) {
            if (Meteor.isServer) {
              // Define a string to hold the result of this process.
              let resultMessage = '';
        
        
        Severity: Minor
        Found in app/imports/api/verification/VerificationRequestCollection.methods.ts - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          public update(docID, { academicTerm, rating, comments, moderated, visible, moderatorComments, retired }: ReviewUpdate) {
            this.assertDefined(docID);
            const updateData: ReviewUpdateData = {};
            if (academicTerm) {
              updateData.termID = AcademicTerms.getID(academicTerm);
        Severity: Minor
        Found in app/imports/api/review/ReviewCollection.ts - About 35 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 publish has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          publish() {
            if (Meteor.isServer) {
              const collection = this.collection;
              Meteor.publish(this.collectionName, function filterStudentID(userID) { // eslint-disable-line meteor/audit-argument-checks
                if (_.isNil(userID)) {
        Severity: Minor
        Found in app/imports/api/user/profile-entries/ProfileOpportunityCollection.ts - About 35 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 WriteReviews has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        const WriteReviews: React.FC<WriteReviewsProps> = ({ unreviewedCourses, unreviewedOpportunities, username }) => {
          const cIDs = unreviewedCourses.map((ci) => ci.courseID);
          const courseNames = Courses.findNames(cIDs);
          let names = courseNames.map((cName) => `${cName} (Course)`);
          const oIDs = unreviewedOpportunities.map((oi) => oi.opportunityID);
        Severity: Minor
        Found in app/imports/ui/components/student/reviews/WriteReviews.tsx - About 35 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 testSuite has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          describe('OpportunityInstanceCollection', function testSuite() {
            before(function setup() {
              removeAllEntities();
            });
        
        
        Severity: Minor
        Found in app/imports/api/opportunity/OpportunityInstanceCollection.test.ts - About 35 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 Day has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function Day({
          className,
          disabled,
          error,
          errorMessage,
        Severity: Minor
        Found in app/imports/ui/components/form-fields/DayField.tsx - About 35 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 updateState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          public updateState(): void {
            const username = this.profile.username;
            const projectedICE: Ice = StudentProfiles.getProjectedICE(username);
            if (projectedICE.c < 100) {
              this.state = CHECKSTATE.IMPROVE;
        Severity: Minor
        Found in app/imports/ui/components/checklist/CoursesChecklist.tsx - About 35 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          run() {
            if (!this.userId) {
              throw new Meteor.Error('unauthorized', 'You must be logged in to get internships.');
            } else {
              if (Meteor.isServer) {
        Severity: Minor
        Found in app/imports/api/internship/InternshipCollection.methods.ts - About 35 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