concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

      def boolean_param(symbol)
        boolvalue = params[symbol]

        if boolvalue.class == String
          boolvalue = false if (boolvalue =~ /false/i)
Severity: Minor
Found in rails/lib/controller_param_utils.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

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

  render () {
    const { resource, index, opacity } = this.props;
    const resourceTypeClass = resource.material_type.toLowerCase();
    const finderResultClasses = this.state.isOpen ? `resourceItem ${css.finderResult} ${css.open} ${css[resourceTypeClass]}` : `resourceItem ${css.finderResult} ${css[resourceTypeClass]}`;
    const resourceName = resource.name;
Severity: Minor
Found in rails/react-components/src/library/components/stem-finder-result.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 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

Avoid deeply nested control flow statements.
Open

            if (sensors.length === 2) {
              sensorTypes = sensorTypes.replace(/, $/, ""); // prevents things like "motion, and temperature sensors"
            }

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

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      function createInputPseudo( type ) {
        return function( elem ) {
          var name = elem.nodeName.toLowerCase();
          return name === "input" && elem.type === type;
        };
    Severity: Minor
    Found in rails/app/assets/javascripts/prototype.js and 1 other location - About 45 mins to fix
    rails/app/assets/javascripts/jquery/jquery.js on lines 3953..3958

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        needsUpdate: function() {
            var si = this.styleInfos;
            return si.boxShadowInfo.changed() || si.borderRadiusInfo.changed();
        },
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 4 other locations - About 45 mins to fix
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2655..2658
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2945..2948
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3501..3504
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3612..3615

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    function createInputPseudo( type ) {
        return function( elem ) {
            var name = elem.nodeName.toLowerCase();
            return name === "input" && elem.type === type;
        };
    Severity: Minor
    Found in rails/app/assets/javascripts/jquery/jquery.js and 1 other location - About 45 mins to fix
    rails/app/assets/javascripts/prototype.js on lines 4864..4869

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        needsUpdate: function() {
            var si = this.styleInfos;
            return si.borderInfo.changed() || si.borderRadiusInfo.changed();
        },
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 4 other locations - About 45 mins to fix
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2655..2658
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3359..3362
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3501..3504
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3612..3615

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        isActive: function() {
            var si = this.styleInfos;
            return si.borderRadiusInfo.isActive() || si.backgroundInfo.isPngFix();
        },
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 4 other locations - About 45 mins to fix
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2655..2658
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2945..2948
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3359..3362
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3612..3615

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        needsUpdate: function() {
            var si = this.styleInfos;
            return si.backgroundInfo.changed() || si.borderRadiusInfo.changed();
        },
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 4 other locations - About 45 mins to fix
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2945..2948
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3359..3362
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3501..3504
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3612..3615

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

        isActive: function() {
            var si = this.styleInfos;
            return si.backgroundInfo.isActive() || si.borderImageInfo.isActive();
        },
    Severity: Major
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 4 other locations - About 45 mins to fix
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2655..2658
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2945..2948
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3359..3362
    rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3501..3504

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            Event.observe('login', 'focus', function(event) {
                $("login").previous(0).setStyle({"display": "none"});
            });
    Severity: Minor
    Found in rails/app/assets/javascripts/globals.js and 1 other location - About 45 mins to fix
    rails/app/assets/javascripts/globals.js on lines 94..96

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        create_table :commons_licenses, :id => false do |t|
          t.string   :code, :uniqueness => true, :null => false, :primary_key => true
          t.string   :name, :uniqueness => true, :null => false
          t.text     :description
          t.string   :deed
    Severity: Minor
    Found in rails/db/migrate/20130212203033_create_commons_license.rb and 1 other location - About 45 mins to fix
    rails/db/migrate/20130214205707_redo_commons_licenses.rb on lines 23..30

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language