concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

  handleAssignClick (e: any) {
    const { resource } = this.props;
    gtag("event", "click", {
      "category": "Assign to Class Button",
      "resource": resource.name
rails/react-components/src/library/components/stem-finder-result.tsx on lines 172..178
rails/react-components/src/library/components/stem-finder-result.tsx on lines 180..186
rails/react-components/src/library/components/stem-finder-result.tsx on lines 188..194
rails/react-components/src/library/components/stem-finder-result.tsx on lines 196..202
rails/react-components/src/library/components/stem-finder-result.tsx on lines 204..210
rails/react-components/src/library/components/stem-finder-result.tsx on lines 220..226
rails/react-components/src/library/components/stem-finder-result.tsx on lines 228..234

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

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 8 locations. Consider refactoring.
Open

  handleViewCollectionClick (e: any) {
    const { resource } = this.props;
    gtag("event", "click", {
      "category": "Resource View Collection Button",
      "resource": resource.name
rails/react-components/src/library/components/stem-finder-result.tsx on lines 172..178
rails/react-components/src/library/components/stem-finder-result.tsx on lines 188..194
rails/react-components/src/library/components/stem-finder-result.tsx on lines 196..202
rails/react-components/src/library/components/stem-finder-result.tsx on lines 204..210
rails/react-components/src/library/components/stem-finder-result.tsx on lines 212..218
rails/react-components/src/library/components/stem-finder-result.tsx on lines 220..226
rails/react-components/src/library/components/stem-finder-result.tsx on lines 228..234

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

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 8 locations. Consider refactoring.
Open

  handleTeacherEditionClick (e: any) {
    const { resource } = this.props;
    gtag("event", "click", {
      "category": "Resource Teacher Edition Button",
      "resource": resource.name
rails/react-components/src/library/components/stem-finder-result.tsx on lines 172..178
rails/react-components/src/library/components/stem-finder-result.tsx on lines 180..186
rails/react-components/src/library/components/stem-finder-result.tsx on lines 196..202
rails/react-components/src/library/components/stem-finder-result.tsx on lines 204..210
rails/react-components/src/library/components/stem-finder-result.tsx on lines 212..218
rails/react-components/src/library/components/stem-finder-result.tsx on lines 220..226
rails/react-components/src/library/components/stem-finder-result.tsx on lines 228..234

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

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 8 locations. Consider refactoring.
Open

  handleTeacherResourcesClick (e: any) {
    const { resource } = this.props;
    gtag("event", "click", {
      "category": "Resource Teacher Resources Button",
      "resource": resource.name
rails/react-components/src/library/components/stem-finder-result.tsx on lines 172..178
rails/react-components/src/library/components/stem-finder-result.tsx on lines 180..186
rails/react-components/src/library/components/stem-finder-result.tsx on lines 188..194
rails/react-components/src/library/components/stem-finder-result.tsx on lines 204..210
rails/react-components/src/library/components/stem-finder-result.tsx on lines 212..218
rails/react-components/src/library/components/stem-finder-result.tsx on lines 220..226
rails/react-components/src/library/components/stem-finder-result.tsx on lines 228..234

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

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

      if (gradeFilter.searchGroups) {
        gradeFilter.searchGroups.forEach((searchGroup: any) => {
          query.push("&grade_level_groups[]=");
          query.push(encodeURIComponent(searchGroup));
        });
Severity: Minor
Found in rails/react-components/src/library/components/stem-finder.tsx and 1 other location - About 55 mins to fix
rails/react-components/src/library/components/stem-finder.tsx on lines 268..273

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

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

  toggleDescription (e: any) {
    this.setState((prevState: any) => ({ descriptionVisible: !prevState.descriptionVisible }));
    e.preventDefault();
  }
rails/react-components/src/library/components/materials-collection/materials-collection.tsx on lines 61..64

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

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

    this.state.subjectAreasSelected.forEach((subjectArea: any) => {
      subjectArea.searchAreas.forEach((searchArea: any) => {
        query.push("&subject_areas[]=");
        query.push(encodeURIComponent(searchArea));
      });
Severity: Minor
Found in rails/react-components/src/library/components/stem-finder.tsx and 1 other location - About 55 mins to fix
rails/react-components/src/library/components/stem-finder.tsx on lines 277..282

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

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

  toggle (e: any) {
    this.setState((prevState: any) => ({ truncated: !prevState.truncated }));
    e.preventDefault();
  }
rails/react-components/src/library/components/materials-bin/material.tsx on lines 19..22

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

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

async function fetchLearnerData(jwt, query, learnersApiUrl, pageSize) {
  const queryParams = {
    query,
    page_size: pageSize
  };
Severity: Minor
Found in external-report-demo/report-demo/app.js - About 55 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 Selector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

Prototype.Selector = (function() {

  function select() {
    throw new Error('Method "Prototype.Selector.select" must be defined.');
  }
Severity: Minor
Found in rails/app/assets/javascripts/prototype.js - About 55 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 setAltitude has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  setAltitude: function(win, altitude) {
    var stack = this.stack;

    if (altitude === "front") {
      if (stack.getFrontWindow() === win) return;
Severity: Minor
Found in rails/public/javascripts/light_box.js - About 55 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 Hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

var Hash = Class.create(Enumerable, (function() {
  function initialize(object) {
    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
  }

Severity: Minor
Found in rails/app/assets/javascripts/prototype.js - About 55 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 convertToBytes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    convertToBytes: function(value, precision, base){
        var sizes =         ['Y','Z','E','P','T','G','M','k',''],
            fractionSizes = ['y','z','a','f','p','n','µ','m',''], 
                total = sizes.length;
            
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 55 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 downloadCSV has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    downloadCSV: function(){
        var i, csv = '"x"',
            series = this.series,
            dg = this.loadDataGrid();
        
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  render: function() {
    if(this.entryCount > 0) {
      for (var i = 0; i < this.entryCount; i++)
        this.index==i ?
          Element.addClassName(this.getEntry(i),"selected") :
Severity: Minor
Found in rails/app/assets/javascripts/controls.js - About 55 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 parseColor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    parseColor: function(str){
        if (str instanceof Flotr.Color) return str;
        
        var result, Color = Flotr.Color;

Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 55 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 formatter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    formatter: function (v, axis) {
        var d = new Date(v);

        // first check global format
        if (axis.options.timeformat != null)
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 55 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 convertToBytes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    convertToBytes: function(value, precision, base){
        var sizes =         ['Y','Z','E','P','T','G','M','k',''],
            fractionSizes = ['y','z','a','f','p','n','µ','m',''], 
                total = sizes.length;
            
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 55 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 downloadCSV has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    downloadCSV: function(){
        var i, csv = '"x"',
            series = this.series,
            dg = this.loadDataGrid();
        
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 55 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 setAltitude has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  setAltitude: function(win, altitude) {
    var stack = this.stack;

    if (altitude === "front") {
      if (stack.getFrontWindow() === win) return;
Severity: Minor
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 55 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