radgrad/radgrad2

View on GitHub

Showing 205 of 205 total issues

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

  public define({ academicTerm, course, verified = false, fromRegistrar = false, grade = '', note = '', student, creditHrs, retired = false }: CourseInstanceDefine) {
    // Check arguments
    const termID = AcademicTerms.getID(academicTerm);
    const academicTermDoc = AcademicTerms.findDoc(termID);
    const courseID = Courses.getID(course);
Severity: Minor
Found in app/imports/api/course/CourseInstanceCollection.ts - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

  public publish() {
    if (Meteor.isServer) {
      const collection = this.collection;
      Meteor.publish(this.collectionName, function filterStudent(studentID) { // eslint-disable-line meteor/audit-argument-checks
        if (_.isNil(studentID)) {
Severity: Minor
Found in app/imports/api/opportunity/OpportunityInstanceCollection.ts - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

  public publish() {
    if (Meteor.isServer) {
      const collection = this.collection;
      // eslint-disable-next-line meteor/audit-argument-checks
      Meteor.publish(this.collectionName, function publish(userID) {
Severity: Minor
Found in archive/api/feedback/FeedbackInstanceCollection.ts - About 1 hr 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 checkForNoItems has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const checkForNoItems = (match: MatchProps, type: IExplorerTypes): Element | JSX.Element | string => {
  switch (type) {
    case EXPLORER_TYPE.CAREERGOALS:
      return (
        <React.Fragment>
Severity: Minor
Found in archive/issue-414/utilities/explorer.tsx - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

  public update(instance: string, { name, shortName, num, description, creditHrs, interests, picture, syllabus, retired, repeatable }: CourseUpdate) {
    const docID = this.getID(instance);
    const updateData: {
      name?: string;
      description?: string;
Severity: Minor
Found in app/imports/api/course/CourseCollection.ts - About 1 hr 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 loadDatabase has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const loadDatabase = () => {
  const loadFileName = Meteor.settings.databaseRestoreFileName;
  if (loadFileName && (totalDocuments() === 0 || totalDocuments() === 1)) {
    const loadFileAge = getRestoreFileAge(loadFileName);
    console.log(`Loading database from file ${loadFileName}, dumped ${loadFileAge}.`);
Severity: Minor
Found in app/imports/startup/server/initialize-db.ts - About 1 hr 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 ProfileCard has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ProfileCard: React.FC<ProfileCardProps> = ({ name, email, image, website, level, ice, careerGoals, interests, courses, opportunities, fluid = false }) => {
  const levelIconURL = `/images/level-icons/radgrad-level-${level}-icon.png`;
  const userID = Users.getID(email);
  const tabPanes = [];
  if (interests) {
Severity: Minor
Found in app/imports/ui/components/shared/profile/ProfileCard.tsx - About 1 hr 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 ExplorerMenuNonMobile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ExplorerMenuNonMobile: React.FC<ExplorerMenuNonMobileWidgetProps> = ({ menuAddedList, type }) => {
  // console.log('ExplorerMenuNonMobile', props);
  const marginTopStyle = { marginTop: '5px' };
  const match = useRouteMatch();

Severity: Minor
Found in archive/issue-412/ExplorerMenuNonMobile.tsx - About 1 hr 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 AdvisorStudentSelectorWidget has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const AdvisorStudentSelectorWidget: React.FC<AdvisorStudentSelectorWidgetProps> = ({ dispatch, advisorUsername, careerGoals, interests, students, username, alumni, firstName, lastName }) => {
  const [fileDataState, setFileData] = useState('');
  const [isEmailWorkingState, setIsEmailWorking] = useState(false);
  const [isUploadWorkingState, setIsUploadWorking] = useState(false);
  const [generatedDataState, setGeneratedData] = useState('');
Severity: Minor
Found in archive/ui/component/advisor/AdvisorStudentSelectorWidget.tsx - About 1 hr 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

Consider simplifying this complex logical expression.
Open

  if (earnedICE.i >= Meteor.settings.public.level.six.earnedICE.i &&
    earnedICE.c >= Meteor.settings.public.level.six.earnedICE.c &&
    earnedICE.e >= Meteor.settings.public.level.six.earnedICE.e &&
    numReviews >= Meteor.settings.public.level.six.reviews &&
    plannedICE.i >= Meteor.settings.public.level.six.plannedICE.i &&
Severity: Major
Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

      } else if (earnedICE.i >= Meteor.settings.public.level.five.earnedICE.i &&
        earnedICE.c >= Meteor.settings.public.level.five.earnedICE.c &&
        earnedICE.e >= Meteor.settings.public.level.five.earnedICE.e &&
        numReviews >= Meteor.settings.public.level.five.reviews &&
        plannedICE.i >= Meteor.settings.public.level.five.plannedICE.i &&
    Severity: Major
    Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

        } else if (earnedICE.i >= Meteor.settings.public.level.three.earnedICE.i &&
          earnedICE.c >= Meteor.settings.public.level.three.earnedICE.c &&
          earnedICE.e >= Meteor.settings.public.level.three.earnedICE.e &&
          numReviews >= Meteor.settings.public.level.three.reviews &&
          plannedICE.i >= Meteor.settings.public.level.three.plannedICE.i &&
      Severity: Major
      Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

          } else if (earnedICE.i >= Meteor.settings.public.level.four.earnedICE.i &&
            earnedICE.c >= Meteor.settings.public.level.four.earnedICE.c &&
            earnedICE.e >= Meteor.settings.public.level.four.earnedICE.e &&
            numReviews >= Meteor.settings.public.level.four.reviews &&
            plannedICE.i >= Meteor.settings.public.level.four.plannedICE.i &&
        Severity: Major
        Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

            } else if (earnedICE.i >= Meteor.settings.public.level.two.earnedICE.i &&
              earnedICE.c >= Meteor.settings.public.level.two.earnedICE.c &&
              earnedICE.e >= Meteor.settings.public.level.two.earnedICE.e &&
              numReviews >= Meteor.settings.public.level.two.reviews &&
              plannedICE.i >= Meteor.settings.public.level.two.plannedICE.i &&
          Severity: Major
          Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

            Function StudentExplorerReviewWidget has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const StudentExplorerReviewWidget: React.FC<StudentExplorerReviewWidgetProps> = ({ itemReviews, userReview, completed, reviewType, itemToReview }) => {
              const match = useRouteMatch();
              const commentsStyle = { paddingTop: '5px' };
            
              const {  rating, comments, username } = reviewData(userReview);

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

              public define({
                username,
                firstName,
                lastName,
                picture = defaultProfilePicture,
            Severity: Minor
            Found in app/imports/api/user/FacultyProfileCollection.ts - About 55 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 FutureParticipation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const FutureParticipation: React.FC<FutureParticipationProps> = ({ item }) => {
              const isCourse = Courses.isDefined(item._id);
              const type = isCourse ? ENROLLMENT_TYPE.COURSE : ENROLLMENT_TYPE.OPPORTUNITY;
              const [data, setData] = useState<EnrollmentForecast>({});
              const [fetched, setFetched] = useState(false);
            Severity: Minor
            Found in app/imports/ui/components/shared/explorer/FutureParticipation.tsx - About 55 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 processRadGradCollection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            const processRadGradCollection = (collection: ICollection) => {
              const result: any = {};
              // console.log(collection.name/* , collection.contents */);
              if (collection.name === 'SemesterCollection') {
                result.name = 'AcademicTermCollection';
            Severity: Minor
            Found in scripts/ts/convert-dump.ts - About 55 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 define has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              public define({
                username,
                firstName,
                lastName,
                picture = defaultProfilePicture,
            Severity: Minor
            Found in app/imports/api/user/AdvisorProfileCollection.ts - About 55 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 getCurrentTermID has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              public getCurrentTermID() {
                const year = moment().year();
                const day = moment().dayOfYear();
                let term = '';
                if (RadGradProperties.getQuarterSystem()) {
            Severity: Minor
            Found in app/imports/api/academic-term/AcademicTermCollection.ts - About 55 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