radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

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

  public define({ username, role }: { username: string; role: string; }) {
    // console.log('Users.define', username, role);
    if (Meteor.isServer) {
      Roles.createRole(role, { unlessExists: true });
      // In test Meteor.settings is not set from settings.development.json so we use _.get to see if it is set.
Severity: Minor
Found in app/imports/api/user/UserCollection.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 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 testSuite has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  describe('ReviewCollection', function testSuite() {
    before(function setup() {
      removeAllEntities();
    });

Severity: Minor
Found in app/imports/api/review/ReviewCollection.test.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

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

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

    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

    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

      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

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

          public updateState(): void {
            const interests = Users.getInterestIDs(this.profile.userID);
            if (interests.length < 3) {
              this.state = CHECKSTATE.IMPROVE;
            } else if (this.profile.lastVisited[PAGEIDS.INTEREST_BROWSER]) {
        Severity: Minor
        Found in app/imports/ui/components/checklist/InterestsChecklist.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

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

        const AdvisorOtherTab: React.FC = () => {
          const [bulkCourseDataState, setBulkCourseData] = useState('');
          const [alumniEmailsState, setAlumniEmails] = useState('');
          const [isAlumniWorkingState, setIsAlumniWorking] = useState(false);
          const [isEmailWorkingState, setIsEmailWorking] = useState(false);
        Severity: Minor
        Found in app/imports/ui/components/advisor/manage/AdvisorOtherTab.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 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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          run({ itemID, explorerType }) {
            if (!this.userId) {
              throw new Meteor.Error('unauthorized', 'You must be logged in to get visible usernames.');
            }
            const usernames = {};
        Severity: Minor
        Found in app/imports/api/user/profile-entries/ProfileAssociatedUsers.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