concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

document.whenReady(function() {
  if ($('log'))             UI.logger = new UI.ElementLogger('log');
  else if (window.console)  UI.logger = new UI.ConsoleLogger();
  else                      UI.logger = new UI.MemLogger();
});
Severity: Major
Found in rails/public/javascripts/light_box.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 2453..2457

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

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

        for( i = 0; i < stopCount; i++ ) {
            stopPx.push( stops[i].offset ? stops[i].offset.pixels( el, lineLength ) :
                         i === 0 ? 0 : i === stopCount - 1 ? lineLength : null );
        }
Severity: Major
Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 3702..3705

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

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

        for( i = 0; i < stopCount; i++ ) {
            stopPx.push( stopsInfo[i].offset ? stopsInfo[i].offset.pixels( el, lineLength ) :
                         i === 0 ? 0 : i === stopCount - 1 ? lineLength : null );
        }
Severity: Major
Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js and 1 other location - About 2 hrs to fix
rails/app/assets/javascripts/pie/PIE_uncompressed.js on lines 2877..2880

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

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

  @Mutation(() => AdminProjectUser)
  async deleteAdminProjectUser(@Arg("id") id: string) {
    const projectUser = await AdminProjectUser.findOne({ where: { id } });
    if (!projectUser) throw new Error("AdminProjectUser not found!");
    await projectUser.remove();
admin-panel/graphql-backend/src/resolvers/PortalStudentPermissionFormResolver.ts on lines 135..141

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

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

  @Mutation(() => PortalStudentPermissionForm)
  async deletePortalStudentPermissionForm(@Arg("id") id: string) {
    const projectUser = await PortalStudentPermissionForm.findOne({ where: { id } });
    if (!projectUser) throw new Error("PortalStudentPermissionForm not found!");
    await projectUser.remove();
admin-panel/graphql-backend/src/resolvers/AdminProjectUserResolver.ts on lines 139..145

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

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

var CSS = (function() {
  // Code based on:
  //   - IE5.5+ PNG Alpha Fix v1.0RC4 (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
  //   - Whatever:hover - V2.02.060206 - hover, active & focus (c) 2005 - Peter Nederlof * Peterned - http://www.xs4all.nl/~peterned/
  function fixPNG() {
Severity: Major
Found in rails/public/javascripts/light_box.js - About 2 hrs to fix

    Function CSS has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var CSS = (function() {
      // Code based on:
      //   - IE5.5+ PNG Alpha Fix v1.0RC4 (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
      //   - Whatever:hover - V2.02.060206 - hover, active & focus (c) 2005 - Peter Nederlof * Peterned - http://www.xs4all.nl/~peterned/
      function fixPNG() {
    Severity: Major
    Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 2 hrs to fix

      Method create has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create
          # PUNDIT_REVIEW_AUTHORIZE
          # PUNDIT_CHECK_AUTHORIZE
          # authorize Portal::Student
          @portal_clazz = find_clazz_from_params
      Severity: Major
      Found in rails/app/controllers/portal/students_controller.rb - About 2 hrs to fix

        Function constructor has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(props: Props) {
            super(props);
        
            const hideFeatured = this.props.hideFeatured || false;
            let subjectAreaKey = this.props.subjectAreaKey;
        Severity: Major
        Found in rails/react-components/src/library/components/stem-finder.tsx - About 2 hrs to fix

          File clazzes_controller.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class Portal::ClazzesController < ApplicationController
          
            # TODO:  There need to be a lot more
            # controller filters here...
            # this only protects management actions:
          Severity: Minor
          Found in rails/app/controllers/portal/clazzes_controller.rb - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                        if( !p.src || !slices || slices.length < 1 || slices.length > 4 ||
                            ( widths && widths.length > 4 ) || ( slashCount === 1 && widths.length < 1 ) ||
                            ( outsets && outsets.length > 4 ) || ( slashCount === 2 && outsets.length < 1 ) ) {
                            return null;
                        }
            Severity: Critical
            Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 2 hrs to fix

              InPlaceEditor has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              Ajax.InPlaceEditor = Class.create({
                initialize: function(element, url, options) {
                  this.url = url;
                  this.element = element = $(element);
                  this.prepareOptions();
              Severity: Minor
              Found in rails/app/assets/javascripts/controls.js - About 2 hrs to fix

                Function BgPosition has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                PIE.BgPosition = (function() {
                
                    var length_fifty = PIE.getLength( '50%' ),
                        vert_idents = { 'top': 1, 'center': 1, 'bottom': 1 },
                        horiz_idents = { 'left': 1, 'center': 1, 'right': 1 };
                Severity: Major
                Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 2 hrs to fix

                  Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                      if ( postFilter && !postFilter[ expando ] ) {
                        postFilter = setMatcher( postFilter );
                      }
                      if ( postFinder && !postFinder[ expando ] ) {
                  Severity: Major
                  Found in rails/app/assets/javascripts/prototype.js - About 2 hrs to fix

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

                           create: function(options) {
                                   
                                   /*
                                           options - object to store initialization parameters
                                           options.blankURL - string to override the default location of blank.html. Must end in "?"
                    Severity: Major
                    Found in rails/app/assets/javascripts/active_scaffold/default/dhtml_history.js - About 2 hrs to fix

                      Function openPreviewHelpPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function openPreviewHelpPage(isExternalUrl, urlOrHtmlContainerId, isDomId, project_id){
                            var linkPattern = /(^((http|https|ftp):\/\/){0,1}[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ig;
                            var protocolPattern = /(^(http|https|ftp):\/\/)/ig;
                            var customHtml = null;
                            var previewWindow = null;
                      Severity: Major
                      Found in rails/app/assets/javascripts/preview_help_page.js - About 2 hrs to fix

                        Function CSS has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var CSS = (function() {
                          // Code based on:
                          //   - IE5.5+ PNG Alpha Fix v1.0RC4 (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
                          //   - Whatever:hover - V2.02.060206 - hover, active & focus (c) 2005 - Peter Nederlof * Peterned - http://www.xs4all.nl/~peterned/
                          function fixPNG() {
                        Severity: Major
                        Found in rails/app/assets/javascripts/livepipe/window.js - About 2 hrs to fix

                          Method perform has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def perform
                              import = Import::Import.find(import_id)
                              content_hash = JSON.parse(import.upload_data, :symbolize_names => true)
                              total_users_count = content_hash[:users].size
                              batch_size = 250
                          Severity: Major
                          Found in rails/app/models/import/import_users.rb - About 2 hrs to fix

                            Function done has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function done( status, nativeStatusText, responses, headers ) {
                                        var isSuccess, success, error, response, modified,
                                            statusText = nativeStatusText;
                            
                                        // Called once
                            Severity: Major
                            Found in rails/app/assets/javascripts/jquery/jquery.js - About 2 hrs to fix

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

                                  if (!this.options.formId && this.element.id) {
                                    this.options.formId = this.element.id + '-inplaceeditor';
                                    if ($(this.options.formId))
                                      this.options.formId = '';
                                  }
                              rails/app/assets/javascripts/controls.js on lines 489..493

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

                              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