concord-consortium/rigse

View on GitHub

Showing 1,200 of 2,137 total issues

Method resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve
      if user.has_role?('manager','admin','researcher')
        all
      elsif user.is_project_admin? || user.is_project_researcher?
        where = []
Severity: Minor
Found in rails/app/policies/report/learner_policy.rb - 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 api has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const api = (endPoints: any) => {
  return (action: any, options: any) => {
    const endPoint = endPoints[action];
    if (endPoint) {
      const { url } = endPoint;
Severity: Minor
Found in rails/react-components/src/library/helpers/api/index.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 StudentsTab has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function StudentsTab() {
  // Fetch projects (with refetch function) on initial load
  const { data: projectsData } = useFetch<IProject[]>(Portal.API_V1.PERMISSION_FORMS_PROJECTS, []);
  // `null` means no search has been done yet, while an empty array means no results were found.
  const [teachers, setTeachers] = useState<ITeacher[] | null>(null);

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 (sensors.length === 2) {
              sensorTypes = sensorTypes.replace(/, $/, ""); // prevents things like "motion, and temperature sensors"
            }

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

      renderLink (linkDef: any) {
        const { popOut, iconName, label, url, onClick } = linkDef;
        const { location } = this.state;
        const target = popOut ? "_blank" : "_self";
        const icon = popOut && iconName !== "icon-help" ? "icon-arrow-circle-right" : iconName;
    Severity: Minor
    Found in rails/react-components/src/library/components/navigation/index.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      render () {
        const { anonymous } = this.props;
        const { canSubmit, currentCountry, currentZipcode, registerNewSchool } = this.state;
        const showZipcode = currentCountry != null;
        const showSchool = (currentCountry != null) && (currentZipcode != null);
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/teacher_form.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 renderPagination has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      renderPagination () {
        const { count, start, skipPaginate } = this.props;
    
        if (skipPaginate) {
          return undefined;

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

      render () {
        const resource = this.props.resource;
        const levels = filters.gradeFilters.reduce(function (levelAcc: any, gradeFilter: any) {
          const matching = gradeFilter.grades.reduce(function (matchingAcc: any, grade: any) {
            if (resource.grade_levels && resource.grade_levels.indexOf(grade) !== -1) {
    Severity: Minor
    Found in rails/react-components/src/library/components/grade-levels.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 convertValidationsToObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const convertValidationsToObject = (validations: any) => {
      if (typeof validations === "string") {
        return validations.split(/,(?![^{[]*[}\]])/g).reduce((validationsAccumulator, validation) => {
          let args = validation.split(":");
          const validateMethod = args.shift() as string;
    Severity: Minor
    Found in rails/react-components/src/library/components/signup/text_input.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      render () {
        let buttonText;
        const { updating } = this.state;
        const { statement } = this.props;
    
    

    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 ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
                 (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
              // "submit" => "emulated:submit"
              this.eventName = 'emulated:' + this.eventName
            }
    Severity: Major
    Found in rails/app/assets/javascripts/rails.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if ( matcher[ expando ] ) {
                j = ++i;
                for ( ; j < len; j++ ) {
                  if ( Expr.relative[ tokens[j].type ] ) {
                    break;
      Severity: Major
      Found in rails/app/assets/javascripts/prototype.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

            if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) {
              var style = element.style.left, rStyle = element.runtimeStyle.left;
              element.runtimeStyle.left = element.currentStyle.left;
              element.style.left = value || 0;
              value = element.style.pixelLeft;
        Severity: Major
        Found in rails/app/assets/javascripts/prototype.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

              if ( support.matchesSelector && documentIsHTML &&
                ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
          
                try {
          Severity: Major
          Found in rails/app/assets/javascripts/prototype.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if( borderProps.widthsSame && borderProps.stylesSame && borderProps.colorsSame ) {
                            if( colors.t.alpha() > 0 ) {
                                // shortcut for identical border on all sides - only need 1 stroked shape
                                wT = widths.t.pixels( el ); //thickness
                                wR = wT / 2; //shrink
            Severity: Major
            Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                    if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
                      (classNames && classNames.all(function(name) {
                        return !name.toString().blank() && cn.include(' ' + name + ' ');
                      }))))
                      elements.push(Element.extend(child));
              Severity: Major
              Found in rails/app/assets/javascripts/prototype.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                                if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
                
                                    // Don't re-trigger an onFOO event when we call its FOO() method
                                    old = elem[ ontype ];
                
                
                Severity: Major
                Found in rails/app/assets/javascripts/jquery/jquery.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
                              return;
                          }
                  Severity: Major
                  Found in rails/app/assets/javascripts/jquery/jquery.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if ( matcher[ expando ] ) {
                                    // Find the next relative operator (if any) for proper handling
                                    j = ++i;
                                    for ( ; j < len; j++ ) {
                                        if ( Expr.relative[ tokens[j].type ] ) {
                    Severity: Major
                    Found in rails/app/assets/javascripts/jquery/jquery.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                      if ( !jQuery.support.opacity ) {
                          jQuery.cssHooks.opacity = {
                              get: function( elem, computed ) {
                                  // IE uses filters for opacity
                                  return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
                      Severity: Major
                      Found in rails/app/assets/javascripts/jquery/jquery.js - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language