radgrad/radgrad2

View on GitHub

Showing 211 of 211 total issues

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

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

              return undefined;
        Severity: Major
        Found in archive/issue-414/utilities/explorer.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 archive/api/log/AdvisorLogCollection.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 s;
              Severity: Major
              Found in archive/redux/admin/data-model/reducers.ts - About 30 mins to fix

                Function UploadFixture has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const UploadFixture: React.FC = () => {
                  const [fileDataState, setFileData] = useState('');
                  const [uploadResult, setUploadResult] = useState('');
                  const [error, setError] = useState(false);
                  const [uploadFixtureWorking, setUploadFixtureWorking] = useStickyState('UploadFixture', false);
                Severity: Minor
                Found in app/imports/ui/components/admin/database/UploadFixture.tsx - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public updateState(): void {
                    if (this.profile.lastLeveledUp) {
                      if (this.isSixMonthsOld(this.profile.lastLeveledUp) && this.profile.level !== 6) {
                        this.state = CHECKSTATE.REVIEW;
                      } else {
                Severity: Minor
                Found in app/imports/ui/components/checklist/LevelChecklist.tsx - About 25 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 OpportunityInformationItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const OpportunityInformationItem: React.FC<OpportunityItemWidgetProps> = ({
                  informationConfiguration,
                  opportunity,
                }) => {
                  const match = useRouteMatch();
                Severity: Minor
                Found in archive/issue-399/OpportunityInformationItem.tsx - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  run(fixtureData) {
                    // console.log('loadFixtureMethod', fixtureData);
                    if (!this.userId) {
                      throw new Meteor.Error('unauthorized', 'You must be logged in to load a fixture.', '');
                    } else if (!Roles.userIsInRole(this.userId, [ROLE.ADMIN])) {
                Severity: Minor
                Found in app/imports/api/base/BaseCollection.methods.ts - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  run({ studentID }) {
                    if (Meteor.isServer) {
                      if (!this.userId) {
                        throw new Meteor.Error('unauthorized', 'You must be logged in to calculate Levels.');
                      } else if (!Roles.userIsInRole(this.userId, [ROLE.ADMIN, ROLE.ADVISOR])) {
                Severity: Minor
                Found in app/imports/api/level/LevelProcessor.methods.ts - About 25 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 findProfilesWithRole has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public findProfilesWithRole(role, selector, options) {
                    const theSelector = (typeof selector === 'undefined') ? {} : selector;
                    if (role === ROLE.STUDENT) { // TODO why isn't this a switch?
                      theSelector.isAlumni = false;
                      return StudentProfiles.findNonRetired(theSelector, options);
                Severity: Minor
                Found in app/imports/api/user/UserCollection.ts - About 25 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 removeAllEntities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export const removeAllEntities = (): boolean => {
                  if (Meteor.isTest || Meteor.isAppTest) {
                    // assertIntegrity();  // this started failing after update to Meteor 1.6.1!
                    RadGrad.collections.forEach((collection) => {
                      if (collection.type !== 'AdminProfile') {
                Severity: Minor
                Found in app/imports/api/base/BaseUtilities.ts - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  run(user: string) {
                    if (Meteor.isServer) {
                      StudentProfiles.assertValidRoleForMethod(this.userId);
                      const profile = Users.getProfile(user);
                      if (profile.role !== ROLE.STUDENT && profile.role !== ROLE.ALUMNI) {
                Severity: Minor
                Found in app/imports/api/user/StudentProfileCollection.methods.ts - About 25 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 getID has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public getID(instance) {
                    let id;
                    // If we've been passed a document, check to see if it has an _id field and use that if available.
                    if (_.isObject(instance) && _.has(instance, '_id')) {
                      // @ts-ignore
                Severity: Minor
                Found in app/imports/api/user/BaseProfileCollection.ts - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public updateState(): void {
                    // console.log(this.profile.lastVisited);
                    const lastVisited = this.profile.lastVisited[PAGEIDS.VISIBILITY] || this.profile.lastVisited[PAGEIDS.STUDENT_VISIBILITY];
                    if (lastVisited) {
                      if (this.isSixMonthsOld(lastVisited)) {
                Severity: Minor
                Found in app/imports/ui/components/checklist/VisibilityChecklist.tsx - About 25 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 6 (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/course/CourseCollection.ts - About 25 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 findAcademicTermSlug has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const findAcademicTermSlug = (starDataObject: StarDataObject): string => {
                  const academicTerm = starDataObject.semester;
                  if ((!_.isString(academicTerm)) || (academicTerm.length < 8)) {
                    throw new Meteor.Error(`Could not parse academic term data: ${JSON.stringify(starDataObject)}`);
                  }
                Severity: Minor
                Found in app/imports/api/star/StarProcessor.ts - About 25 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 MostPopular has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const MostPopular: React.FC<MostPopularProps> = ({ type, data }) => {
                  let icon;
                  let title;
                  let labels;
                  const userID = Users.getID(Meteor.user().username);
                Severity: Minor
                Found in app/imports/ui/components/shared/community/MostPopular.tsx - About 25 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