radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

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

  public update(docID, { academicTerm, rating, comments, moderated, visible, moderatorComments, retired }: ReviewUpdate) {
    this.assertDefined(docID);
    const updateData: ReviewUpdateData = {};
    if (academicTerm) {
      updateData.termID = AcademicTerms.getID(academicTerm);
Severity: Minor
Found in app/imports/api/review/ReviewCollection.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 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 nextAcademicTerm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const nextAcademicTerm = (termDoc: AcademicTerm): AcademicTerm => {
  const currentTerm = termDoc.term;
  const currentYear = termDoc.year;
  let term;
  let year = currentYear;
Severity: Minor
Found in app/imports/api/academic-term/AcademicTermUtilities.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 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 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 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 testCalcLevel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const testCalcLevel = (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 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 userID = this.profile.userID;
    const careerGoals = ProfileCareerGoals.findNonRetired({ userID });
    if (careerGoals.length < 3) {
      this.state = CHECKSTATE.IMPROVE;
Severity: Minor
Found in app/imports/ui/components/checklist/CareerGoalsChecklist.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/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 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 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 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 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

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

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 s;
    Severity: Major
    Found in archive/redux/admin/data-model/reducers.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return 0;
      Severity: Major
      Found in scripts/ts/fixture-generator/AcademicTermCollection.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

                return [this.getAdminProfile()];
          Severity: Major
          Found in app/imports/api/user/UserCollection.ts - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language