concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Method create has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    # PUNDIT_REVIEW_AUTHORIZE
    # PUNDIT_CHECK_AUTHORIZE
    # authorize Portal::Student
    @portal_clazz = find_clazz_from_params
Severity: Minor
Found in rails/app/controllers/portal/students_controller.rb - About 6 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

File materials_controller.rb has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class API::V1::MaterialsController < API::APIController
  include Materials::DataHelpers

  #
  # Default number of related materials to return
Severity: Minor
Found in rails/app/controllers/api/v1/materials_controller.rb - About 6 hrs to fix

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

    @Index("admin_proj_mat_mat_idx", ["materialId", "materialType"], {})
    @Index(
      "admin_proj_mat_proj_mat_idx",
      ["projectId", "materialId", "materialType"],
      {}
    admin-panel/graphql-backend/src/entities/unused/Favorites.ts on lines 3..27

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

    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

    @Index("favorite_unique", ["userId", "favoritableId", "favoritableType"], {
      unique: true,
    })
    @Index("index_favorites_on_favoritable_id", ["favoritableId"], {})
    @Index("index_favorites_on_favoritable_type", ["favoritableType"], {})
    Severity: Major
    Found in admin-panel/graphql-backend/src/entities/unused/Favorites.ts and 1 other location - About 6 hrs to fix
    admin-panel/graphql-backend/src/entities/unused/AdminProjectMaterials.ts on lines 3..29

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

    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

    File routes.rb has 452 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    RailsPortal::Application.routes.draw do
    
      devise_for :users, :controllers => {
        :registrations => 'registrations',
        :confirmations => 'confirmations',
    Severity: Minor
    Found in rails/config/routes.rb - About 6 hrs to fix

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

        handleSortEnd ({
          oldIndex,
          newIndex
        }: any) {
          let { items } = this.state;
      rails/react-components/src/library/components/bookmarks/edit.tsx on lines 89..103
      rails/react-components/src/library/components/portal-classes/manage-classes.tsx on lines 56..70

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

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

        handleSortEnd ({
          oldIndex,
          newIndex
        }: any) {
          let { classes } = this.state;
      rails/react-components/src/library/components/bookmarks/edit.tsx on lines 89..103
      rails/react-components/src/library/components/materials-collection/edit-list.tsx on lines 33..47

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

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

        handleSortEnd ({
          oldIndex,
          newIndex
        }: any) {
          let { bookmarks } = this.state;
      rails/react-components/src/library/components/materials-collection/edit-list.tsx on lines 33..47
      rails/react-components/src/library/components/portal-classes/manage-classes.tsx on lines 56..70

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

      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 AuthoringSites {
        @PrimaryGeneratedColumn({ type: "int", name: "id" })
        id: number;
      
        @Column("varchar", { name: "name", nullable: true, length: 255 })
      admin-panel/graphql-backend/src/entities/unused/AdminTags.ts on lines 4..19

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

      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 AdminTags {
        @PrimaryGeneratedColumn({ type: "int", name: "id" })
        id: number;
      
        @Column("varchar", { name: "scope", nullable: true, length: 255 })
      Severity: Major
      Found in admin-panel/graphql-backend/src/entities/unused/AdminTags.ts and 1 other location - About 6 hrs to fix
      admin-panel/graphql-backend/src/entities/unused/AuthoringSites.ts on lines 4..19

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

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

                  "setPage": function(page) {
      
          if (Paging.opts["lock"]) {
                          Paging.opts["onSelect"](0, self);
              return Paging;
      Severity: Major
      Found in rails/app/assets/javascripts/jquery.paging.js - About 6 hrs to fix

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

          show: function(modal) {
            if (this.visible) return this;
        
            this.fire('showing');
            this.effect('show');
        Severity: Major
        Found in rails/public/javascripts/light_box.js and 2 other locations - About 6 hrs to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1483..1504
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3231..3252

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

        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

          show: function(modal) {
            if (this.visible) return this;
        
            this.fire('showing');
            this.effect('show');
        Severity: Major
        Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 6 hrs to fix
        rails/app/assets/javascripts/livepipe/window.js on lines 1483..1504
        rails/public/javascripts/light_box.js on lines 3231..3252

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

        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

          show: function(modal) {
            if (this.visible) return this;
        
            this.fire('showing');
            this.effect('show');
        Severity: Major
        Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 6 hrs to fix
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 3231..3252
        rails/public/javascripts/light_box.js on lines 3231..3252

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

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

            plotLineArea: function(series, offset){
                var data = series.data;
                if(data.length < 2) return;
        
                var top, lastX = 0,
        Severity: Minor
        Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 6 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 plotLineArea has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            plotLineArea: function(series, offset){
                var data = series.data;
                if(data.length < 2) return;
        
                var top, lastX = 0,
        Severity: Minor
        Found in rails/app/assets/javascripts/flotr/flotr.js - About 6 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

        Method update has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            if params[:commit] == "Cancel"
              redirect_to view_context.class_link_for_user
            else
              @user = User.find(params[:id])
        Severity: Minor
        Found in rails/app/controllers/users_controller.rb - About 6 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

        Method check_for_auth_token has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_for_auth_token(params)
            header = request.headers["Authorization"]
            if header && header =~ /^Bearer (.*)$/i
              token = $1
              grant = AccessGrant.find_by_access_token(token)
        Severity: Minor
        Found in rails/app/controllers/api/api_controller.rb - About 6 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 Canvas2Image has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        var Canvas2Image = (function() {
            // check if we have canvas support
            var oCanvas = document.createElement("canvas"),
                sc = String.fromCharCode,
              strDownloadMime = "image/octet-stream",
        Severity: Minor
        Found in rails/app/assets/javascripts/canvas2image.js - About 6 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 extend has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            extend: function(object){
                object._objectEventSetup = function(event_name){
                    this._observers = this._observers || {};
                    this._observers[event_name] = this._observers[event_name] || [];
                };
        Severity: Minor
        Found in rails/app/assets/javascripts/livepipe/livepipe.js - About 6 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

        Severity
        Category
        Status
        Source
        Language