concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method create_default_clazzes has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_default_clazzes
    # this method creates default classes,
    # teacher class mapping
    # student class mapping

Severity: Minor
Found in rails/lib/mock_data/create_default_data.rb - About 4 hrs 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 componentDidMount has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidMount () {
    if (this.props.info.total_pages < 2) {
      // don't display pagination if there's only 1 page
      return;
    }
Severity: Minor
Found in rails/react-components/src/library/components/search/pagination.tsx - About 4 hrs 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 parseCss has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    parseCss: function( css ) {
        var p = null, tokenizer, token, type, value,
            slices, widths, outsets,
            slashCount = 0,
            Type = PIE.Tokenizer.Type,
Severity: Major
Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 4 hrs to fix

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

      handlePosition: function(win) {
        // window has its own position, nothing needs to be done
        if (Object.isNumber(win.options.top) && Object.isNumber(win.options.left))
          return;
    
    
    Severity: Major
    Found in rails/public/javascripts/light_box.js and 2 other locations - About 4 hrs to fix
    rails/app/assets/javascripts/livepipe/window.js on lines 2899..2908
    rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4866..4875

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

    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

        updateResize: function(event) {
            if(!this.activeResizable) return;
            var pointer = [Event.pointerX(event), Event.pointerY(event)];
            // Mozilla-based browsers fire successive mousemove events with
            // the same coordinates, prevent needless redrawing (moz bug?)
    Severity: Major
    Found in rails/app/assets/javascripts/livepipe/resizable.js and 1 other location - About 4 hrs to fix
    rails/app/assets/javascripts/dragdrop.js on lines 170..179

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

    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

      updateDrag: function(event) {
        if(!this.activeDraggable) return;
        var pointer = [Event.pointerX(event), Event.pointerY(event)];
        // Mozilla-based browsers fire successive mousemove events with
        // the same coordinates, prevent needless redrawing (moz bug?)
    Severity: Major
    Found in rails/app/assets/javascripts/dragdrop.js and 1 other location - About 4 hrs to fix
    rails/app/assets/javascripts/livepipe/resizable.js on lines 47..56

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

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

      handlePosition: function(win) {
        // window has its own position, nothing needs to be done
        if (Object.isNumber(win.options.top) && Object.isNumber(win.options.left))
          return;
    
    
    Severity: Major
    Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 4 hrs to fix
    rails/app/assets/javascripts/livepipe/window.js on lines 2899..2908
    rails/public/javascripts/light_box.js on lines 4866..4875

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

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

      handlePosition: function(win) {
        // window has its own position, nothing needs to be done
        if (Object.isNumber(win.options.top) && Object.isNumber(win.options.left))
          return;
    
    
    Severity: Major
    Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 4 hrs to fix
    rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4866..4875
    rails/public/javascripts/light_box.js on lines 4866..4875

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

    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 StudentsTab has 100 lines of code (exceeds 25 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);

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

      export class ImportSchoolDistrictMappings {
        @PrimaryGeneratedColumn({ type: "int", name: "id" })
        id: number;
      
        @Column("int", { name: "district_id", nullable: true })
      admin-panel/graphql-backend/src/entities/unused/ImportUserSchoolMappings.ts on lines 4..13

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

      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

      export class ImportUserSchoolMappings {
        @PrimaryGeneratedColumn({ type: "int", name: "id" })
        id: number;
      
        @Column("int", { name: "school_id", nullable: true })
      admin-panel/graphql-backend/src/entities/unused/ImportSchoolDistrictMappings.ts on lines 4..17

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

      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 Hash has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Hash = Class.create(Enumerable, (function() {
        function initialize(object) {
          this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
        }
      
      
      Severity: Major
      Found in rails/app/assets/javascripts/prototype.js - About 3 hrs to fix

        Function getDiv has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this.getDiv = function () {
            if (this.pe.length === 0 &&
                this.dci.length === 0 &&
                Object.keys(this.practicesGroup).length === 0 &&
                Object.keys(this.conceptsGroup).length === 0) {
        Severity: Major
        Found in rails/react-components/src/library/helpers/standards-helpers.tsx - About 3 hrs to fix

          Function ManageFormsTab has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function ManageFormsTab() {
            // Fetch projects and permission forms (with refetch function) on initial load
            const { data: permissionsData, refetch: refetchPermissions } = useFetch<IPermissionForm[]>(Portal.API_V1.PERMISSION_FORMS, []);
            const { data: projectsData } = useFetch<IProject[]>(Portal.API_V1.PERMISSION_FORMS_PROJECTS, []);
          
          

            Function create has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var create = function create() {
                    // Module definitions.
                    var definitions = {};
            
                    // Module instances.
            Severity: Major
            Found in rails/app/assets/javascripts/modulejs.js - About 3 hrs to fix

              Function drawTitles has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  drawTitles: function(){
                      var html,
                          options = this.options,
                          margin = options.grid.labelMargin,
                          ctx = this.ctx,
              Severity: Minor
              Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 3 hrs 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 drawTitles has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  drawTitles: function(){
                      var html,
                          options = this.options,
                          margin = options.grid.labelMargin,
                          ctx = this.ctx,
              Severity: Minor
              Found in rails/app/assets/javascripts/flotr/flotr.js - About 3 hrs 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 3 locations. Consider refactoring.
              Open

                focus: function() {
                  if (this.focused) return this;
              
                  this.windowManager.focus(this);
                  // Hide the overlay that catch events
              Severity: Major
              Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 3 hrs to fix
              rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3329..3341
              rails/public/javascripts/light_box.js on lines 3329..3341

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

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

                focus: function() {
                  if (this.focused) return this;
              
                  this.windowManager.focus(this);
                  // Hide the overlay that catch events
              Severity: Major
              Found in rails/public/javascripts/light_box.js and 2 other locations - About 3 hrs to fix
              rails/app/assets/javascripts/livepipe/window.js on lines 1581..1593
              rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3329..3341

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

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

                focus: function() {
                  if (this.focused) return this;
              
                  this.windowManager.focus(this);
                  // Hide the overlay that catch events
              Severity: Major
              Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 3 hrs to fix
              rails/app/assets/javascripts/livepipe/window.js on lines 1581..1593
              rails/public/javascripts/light_box.js on lines 3329..3341

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

              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