radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

Function AdminAnalyticsNewsletterPage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const AdminAnalyticsNewsletterPage: React.FC = () => {

  const [testNewsletterWorking, setTestNewsletterWorking] = useStickyState('Newsletter.test', false);
  const [levelNewsletterWorking, setLevelNewsletterWorking] = useStickyState('Newsletter.level', false);
  const [allNewsletterWorking, setAllNewsletterWorking] = useStickyState('Newsletter.all', false);
Severity: Minor
Found in app/imports/ui/pages/admin/AdminAnalyticsNewsletterPage.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 AddCareerGoalToProfileButton has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const AddCareerGoalToProfileButton: React.FC<AddCareerGoalToProfileButtonProps> = ({ careerGoal, userID, added }) => {
  const [open, setOpen] = useState(false);
  const careerGoalInterestIDs = careerGoal.interestIDs;
  const profileInterests = ProfileInterests.findNonRetired({ userID });
  const shareInterests = profileInterests.length > 0 ? profileInterests[0].share : false;
Severity: Minor
Found in archive/issue-410/AddCareerGoalToProfileButton.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 define has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  public define({ term, year, retired = false }: AcademicTermDefine) {
    // Check that term and year are valid.
    if (this.terms.indexOf(term) < 0) {
      throw new Meteor.Error(`Invalid term: ${term}`);
    }
Severity: Minor
Found in app/imports/api/academic-term/AcademicTermCollection.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 14 (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(studentID) {
Severity: Minor
Found in app/imports/api/verification/VerificationRequestCollection.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 PageTrackingScoreboardWidget has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const PageTrackingScoreboardWidget: React.FC<PageTrackingScoreboardWidgetProps> = ({ pageInterestsDailySnapshots }) => {
  const match = useRouteMatch();
  const urlCategory: IPageInterestsCategoryTypes = getUrlCategory(match);
  // See page-tracking-general.ts to see urlCategory vs category
  const category = getCategory(urlCategory);

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

const StudentExplorerEditReviewForm: React.FC<StudentExplorerEditReviewWidgetProps> = ({ review, itemToReview }) => {
  const formRef = React.createRef();
  const [activeState, setActive] = useState(false);
  const [confirmOpenState, setConfirmOpen] = useState(false);
  const match = useRouteMatch();

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

const RadGradLoginButtons: React.FC<RadGradLoginButtonsProps> = ({ instanceName = '', size = 'medium', inverted = false }) => {
  const [pathname, setPathname] = useState<string>('');
  const [redirectToRefererState, setRedirectToReferer] = useState<boolean>(false);

  const handleClick = (e, instance) => {
Severity: Minor
Found in app/imports/ui/components/landing/RadGradLoginButtons.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 SigninPage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const SigninPage: React.FC = () => {
  const [emailState, setEmail] = useState('');
  const [passwordState, setPassword] = useState('');
  const [errorState, setError] = useState('');
  const [redirectToRefererState, setRedirectToReferer] = useState(false);
Severity: Minor
Found in app/imports/ui/pages/SigninPage.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 publish has a Cognitive Complexity of 13 (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(studentID) {
Severity: Minor
Found in archive/api/log/AdvisorLogCollection.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

Consider simplifying this complex logical expression.
Open

  if (earnedICE.i >= 100 &&
    earnedICE.c >= 100 &&
    earnedICE.e >= 100 &&
    numReviews >= 6 &&
    plannedICE.i >= 100 &&
Severity: Critical
Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

      } else if (earnedICE.i >= 30 &&
        earnedICE.c >= 36 &&
        earnedICE.e >= 30 &&
        numReviews >= 0 &&
        plannedICE.i >= 100 &&
    Severity: Critical
    Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

        } else if (earnedICE.i >= 80 &&
          earnedICE.c >= 80 &&
          earnedICE.e >= 80 &&
          numReviews >= 1 &&
          plannedICE.i >= 100 &&
      Severity: Critical
      Found in app/imports/api/level/LevelProcessor.ts - About 1 hr to fix

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

        const UpdateUserForm: React.FC<UpdateUserProps> = ({
          id,
          interests,
          careerGoals,
          academicTerms,
        Severity: Minor
        Found in app/imports/ui/components/admin/datamodel/user/UpdateUserForm.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 toString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          public toString(planChoice: string) {
            let ret = '';
            let slug;
            const countIndex = planChoice.indexOf('-');
            if (countIndex === -1) {
        Severity: Minor
        Found in app/imports/api/degree-plan/PlanChoiceCollection.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 PictureField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const PictureField: React.FC<TextFieldProps> = ({
          autoComplete,
          className,
          disabled,
          error,
        Severity: Minor
        Found in app/imports/ui/components/form-fields/PictureField.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 getCurrentTerm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getCurrentTerm = (academicTerms) => {
          const isQuarter = isQuarterSystem(academicTerms);
          let fallStart;
          let springStart;
          let summerStart;
        Severity: Minor
        Found in scripts/ts/fixture-generator/academic-term-utilities.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 getCurrentTerm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          public getCurrentTerm() {
            const isQuarter = this.isQuarterSystem();
            let fallStart;
            let springStart;
            let summerStart;
        Severity: Minor
        Found in scripts/ts/fixture-generator/AcademicTermCollection.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 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 processInternAlohaInternships has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const processInternAlohaInternships = async () => {
          // get the internships
          const rawInternships = await getAllInternAlohaInternships();
          console.log('raw internships', rawInternships.length);
          // add interests
        Severity: Minor
        Found in app/imports/api/internship/import/process-canonical.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

        Severity
        Category
        Status
        Source
        Language