concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

Function render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { standardStatements } = this.props;
    const helpers: any = {};
    const unhelped = [];

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

          <ReferenceField label="User" source="userId" reference="User">
            <FunctionField render={record => `${record.firstName} ${record.lastName}`} />
          </ReferenceField>
    admin-panel/react-admin-interface/src/entities/portalStudent.js on lines 11..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 67.

    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

            <ReferenceField label="User" source="userId" reference="User">
              <FunctionField render={record => `${record.firstName} ${record.lastName}`} />
            </ReferenceField>
    admin-panel/react-admin-interface/src/entities/projectUser.js on lines 18..20

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

    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

            jQuery.post(Portal.API_V1.ASSIGN_MATERIAL_TO_CLASS, params)
              .done(response => {
                this.setState({ resourceAssigned: true, showModal: true });
              })
              .fail(function (err) {
    rails/react-components/src/library/components/assign-to-class/assign-modal.tsx on lines 34..41

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

    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

          jQuery.post(Portal.API_V1.MATERIAL_UNASSIGNED_CLASSES, data).done(response => {
            this.setState({ classes: response });
          }).fail(function (err) {
            if (err?.responseText) {
              const response = jQuery.parseJSON(err.responseText);
    rails/react-components/src/library/components/assign-to-class/assign-modal.tsx on lines 75..84

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

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

    if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
      function iter(name) {
        return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
      }
    
    
    Severity: Minor
    Found in rails/app/assets/javascripts/prototype.js - About 1 hr 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 keydown has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      keydown: function(event) {
        if (event.element() != this.input)
          return;
    
        this.ignoreKeyup = false;
    Severity: Minor
    Found in rails/public/javascripts/light_box.js - About 1 hr 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 format has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        format: function(d, format) {
            if (!d) return;
    
            var leftPad = function(n) {
                n = n.toString();
    Severity: Minor
    Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 hr 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 keydown has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      keydown: function(event) {
        if (event.element() != this.input)
          return;
    
        this.ignoreKeyup = false;
    Severity: Minor
    Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 1 hr 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 format has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        format: function(d, format) {
            if (!d) return;
    
            var leftPad = function(n) {
                n = n.toString();
    Severity: Minor
    Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 hr 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_users_password has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_users_password
        if params[:commit] == "Cancel"
          redirect_to session[:return_to] || root_path
          return
        end
    Severity: Minor
    Found in rails/app/controllers/passwords_controller.rb - About 1 hr 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 search has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def search(search, page, user, includes={}, policy_scope=nil)
        sql_parameters = []
        sql_conditions = ""
        # pass in a username to limit the search to the users items
        if (!user.nil?) && (!user.id.nil?)
    Severity: Minor
    Found in rails/lib/searchable_model.rb - About 1 hr 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 getQueryParams has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      getQueryParams () {
        const params: any = {
          hide_names: this.state.hide_names
        };
        for (const filter of ["schools", "teachers", "runnables", "permission_forms"]) {

    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 13 (exceeds 5 allowed). Consider refactoring.
    Open

      render () {
        let border, favClassMap, favDiv, outlineDiv;
        const { material, configuration } = this.props;
        const { icon } = material;
        const starred = material.is_favorite;

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

        parseCss: function( css ) {
            var p = null, x, y,
                tokenizer, token, length,
                hasNonZero = false;
    
    
    Severity: Minor
    Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 hr to fix

      Function tokenize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function tokenize( selector, parseOnly ) {
          var matched, match, tokens, type, soFar, groups, preFilters,
              cached = tokenCache[ expando ][ selector ];
      
          if ( cached ) {
      Severity: Minor
      Found in rails/app/assets/javascripts/jquery/jquery.js - About 1 hr to fix

        Function addCombinator has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function addCombinator( matcher, combinator, base ) {
            var dir = combinator.dir,
              checkNonElements = base && dir === "parentNode",
              doneName = done++;
        
        
        Severity: Minor
        Found in rails/app/assets/javascripts/prototype.js - About 1 hr to fix

          Function baseInitialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            baseInitialize: function(element, update, options) {
              element          = $(element);
              this.element     = element;
              this.update      = $(update);
              this.hasFocus    = false;
          Severity: Minor
          Found in rails/app/assets/javascripts/controls.js - About 1 hr to fix

            Method external_report_learners_from_jwt has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def external_report_learners_from_jwt
                authorize Portal::PermissionForm
            
                # Empty hashes and arrays are removed from param list now
                # see: https://github.com/rails/rails/issues/26569
            Severity: Minor
            Found in rails/app/controllers/api/v1/report_learners_es_controller.rb - About 1 hr to fix

              Method update has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def update
                  # PUNDIT_REVIEW_AUTHORIZE
                  # PUNDIT_CHECK_AUTHORIZE (did not find instance)
                  # authorize @clazz
                  @portal_clazz = Portal::Clazz.find(params[:id])
              Severity: Minor
              Found in rails/app/controllers/portal/clazzes_controller.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language