radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

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

const descriptionPairs = (item: Opportunity): DescriptionPair[] => {
  const retVal = [
    { label: 'Description', value: item.description },
    { label: 'Opportunity Type', value: OpportunityTypes.findDoc(item.opportunityTypeID).name },
    { label: 'Sponsor', value: Users.getProfile(item.sponsorID).username },
Severity: Minor
Found in app/imports/ui/pages/admin/AdminDataModelOpportunitiesPage.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

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

  public findDoc(name: string | { [key: string]: unknown } | { name } | { _id: string; } | { username: string; }) {
    if (_.isNull(name) || _.isUndefined(name)) {
      throw new Meteor.Error(`${name} is not a defined ${this.type}`);
    }
    const doc = (
Severity: Minor
Found in app/imports/api/base/BaseCollection.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 StudentOfInterestWidget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const StudentOfInterestWidget = (props: IStudentOfInterestWidgetProps) => {
  /*
   Had to declare the styles as React.CSSProperties to fix the "Type X is not assignable to Type Y" errors
   See https://github.com/microsoft/TypeScript/issues/11465#issuecomment-252453037
   */

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

const FutureCourseEnrollmentWidget = (props: IFutureCourseEnrollmentWidgetProps) => {
  const initData: any = {};
  const [dataState, setData] = useState(initData);
  getFutureEnrollmentMethod.call(props.courseID, (error, result) => {
    if (error) {
Severity: Minor
Found in archive/ui/component/FutureCourseEnrollmentWidget.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

  public publish() {
    if (Meteor.isServer) {
      // Meteor.publish(this.collectionName, () => this.collection.find({}, { limit: 0 }));
      const collection = this.collection;
      // eslint-disable-next-line meteor/audit-argument-checks
Severity: Minor
Found in archive/issue-415/api/page-tracking/PageInterestCollection.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 ExplorerMenuMobile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const ExplorerMenuMobile: React.FC<ExplorerMenuMobileWidgetProps> = ({ menuAddedList, type }) => {
  const match = useRouteMatch();
  const isStudent = Router.isUrlRoleStudent(match);
  return (
    <React.Fragment>
Severity: Minor
Found in archive/issue-412/ExplorerMenuMobile.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

Avoid too many return statements within this function.
Open

        return 1;
Severity: Major
Found in scripts/ts/fixture-generator/academic-term-utilities.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return ' <em><a href="https://radgrad.ics.hawaii.edu">' +
            ' Add more Interests to your profile so we can provide opportunity recommendations!</a></em>';
    Severity: Major
    Found in app/imports/ui/pages/admin/AdminAnalyticsNewsletterPage.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return collection.find({ studentID, retired: { $not: { $eq: true } } });
      Severity: Major
      Found in app/imports/api/verification/VerificationRequestCollection.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return s;
        Severity: Major
        Found in archive/redux/admin/analytics/reducers.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return 'Undefined';
          Severity: Major
          Found in app/imports/ui/components/landing/utilities/helper-functions.ts - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language