radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

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

const BrowserView: React.FC<BrowserViewProps> = ({ items, explorerType, profileCareerGoals, profileCourses, profileInterests, profileOpportunities, careerGoals, courses, interests, opportunities }) => {
  const [filterChoice] = useStickyState(`Filter.${explorerType}`, EXPLORER_FILTER_KEYS.NONE);
  const defaultSortChoice = (explorerType === EXPLORER_TYPE.COURSES) ? EXPLORER_SORT_KEYS.NUMBER
    : EXPLORER_SORT_KEYS.ALPHABETIC;
  const [sortChoice] = useStickyState(`Sort.${explorerType}`, defaultSortChoice);
Severity: Minor
Found in app/imports/ui/components/shared/explorer/browser-view/BrowserView.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 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 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 ExplorerOpportunity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const ExplorerOpportunity: React.FC<ExplorerOpportunitiesProps> = ({ opportunity, opportunityTypes, opportunities, terms, interests, sponsors, completed, itemReviews, profile, review, teaser }) => {
  const segmentStyle = { backgroundColor: 'white' };
  const compactRowStyle = { paddingTop: 3, paddingBottom: 3 };
  const gridStyle = { paddingLeft: 17, paddingTop: 10, paddingBottom: 17 };
  const hasTeaser = teaser.length > 0;

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

const ExplorerUsersWidget: React.FC<ExplorerUsersWidgetProps> = ({ userProfile, isActive, handleClose }) => {
  if (!userProfile) return undefined;
  const overflowStyle: React.CSSProperties = { overflow: 'scroll' };
  const cardStyle: React.CSSProperties = {
    textAlign: 'left',
Severity: Minor
Found in archive/issue-367/community-users/ExplorerUsersWidget.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 buildNoItemsMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const buildNoItemsMessage = (noItemsMessageType, type: IExplorerTypes): Element | JSX.Element | string => {
  switch (noItemsMessageType) {
    case 'noInterests':
      if (isType(EXPLORER_TYPE.CAREERGOALS, type)) {
        return <p>Add interests to your profile to see sorted Career Goals. To add Interests to your profile,
Severity: Minor
Found in archive/issue-414/utilities/explorer.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 AdvisorLogEntryWidget has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const AdvisorLogEntryWidget: React.FC<AdvisorLogEntryWidgetProps> = ({ advisorLogs, usernameDoc, advisorUsername }) => {
  const [commentState, setComment] = useState('');

  // For use with Date.getMinutes()
  const formatMinuteString = (min) => {
Severity: Minor
Found in archive/ui/component/advisor/AdvisorLogEntryWidget.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 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 updateState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public updateState(): void {
    const username = this.profile.username;
    const projectedICE: Ice = StudentProfiles.getProjectedICE(username);
    const lastUpdate = PublicStats.getLastUpdateTimestamp(PublicStats.opportunitiesUpdateTime);
    if (projectedICE.i < 100 || projectedICE.e < 100) {
Severity: Minor
Found in app/imports/ui/components/checklist/OpportunitiesChecklist.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 EditInterestButton has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const EditInterestButton: React.FC<EditInterestButtonProps> = ({ interest, interestTypes }) => {
  const [open, setOpen] = useState(false);

  const model: InterestUpdate = interest;
  model.interestType = InterestTypes.findDoc(interest.interestTypeID).name;
Severity: Minor
Found in app/imports/ui/components/shared/manage/interest/EditInterestButton.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() {
    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 LandingHomeContainer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const LandingHomeContainer = withTracker(() => {
  let role = 'student';
  if (Meteor.userId()) {
    if (Roles.userIsInRole(Meteor.userId(), [ROLE.ADMIN])) {
      role = 'admin';
Severity: Minor
Found in app/imports/ui/pages/landing/LandingHomePage.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  public update(docID: string, { termID, verified, fromRegistrar, grade, creditHrs, note, ice, retired }: CourseInstanceUpdate) {
    // console.log('CourseInstances.update', termID, verified, fromRegistrar, grade, creditHrs, note, ice);
    this.assertDefined(docID);
    const updateData: CourseInstanceUpdate = {};
    if (termID) {
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 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

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

Avoid deeply nested control flow statements.
Open

        if (inPastStart) {
          RadGradAlert.failure('Cannot drop courses in the past.', 'You cannot drag courses to a past academic term.');
        } else {
          const termID = AcademicTerms.findIdBySlug(termSlug);
          const updateData: CourseInstanceUpdate = {};
Severity: Major
Found in app/imports/ui/pages/student/StudentDegreePlannerPage.tsx - About 45 mins to fix

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

      public update(docID, { title, targetSlug, interests, author, url, description, duration, retired }: TeaserUpdate) {
        this.assertDefined(docID);
        const updateData: TeaserUpdateData = {};
        if (title) {
          updateData.title = title;
    Severity: Minor
    Found in app/imports/api/teaser/TeaserCollection.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
            // console.log('Internships.publish studentID %o is admin = %o', studentID, Roles.userIsInRole(studentID, [ROLE.ADMIN]));
    Severity: Minor
    Found in app/imports/api/internship/InternshipCollection.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 defaultCalcLevel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const defaultCalcLevel = (studentID: string): number => {
      const instances = _.concat(CourseInstances.find({ studentID })
        .fetch(),
      OpportunityInstances.find({ studentID })
        .fetch());
    Severity: Minor
    Found in app/imports/api/level/LevelProcessor.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

    Severity
    Category
    Status
    Source
    Language