concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

  const handleEditModalSave = async (newFormData: IPermissionFormFormData) => {
    const updatedForm = await editPermissionForm(newFormData);
    if (updatedForm) {
      setCurrentSelectedProject(updatedForm.project_id as CurrentSelectedProject);
      setEditForm(false);
rails/react-components/src/library/components/permission-forms/manage-forms-tab/manage-forms-tab.tsx on lines 52..59

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

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

  @Authorized()
  @Query(() => listMeta)
  async _allPortalPermissionFormsMeta(@Args() searchParams:PermissionSearch){
    const count =  await fuzzyCount<PortalPermissionForm>(PortalPermissionForm, 'portalPermissionForm', searchParams);
    return {count}
admin-panel/graphql-backend/src/resolvers/AdminProjectResolver.ts on lines 60..65
admin-panel/graphql-backend/src/resolvers/PortalStudentResolver.ts on lines 52..57
admin-panel/graphql-backend/src/resolvers/UserResolver.ts on lines 69..74

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

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

  @Authorized()
  @Query(() => listMeta)
  async _allPortalStudentsMeta(@Args() searchParams:PortalStudentPaginationAndFilter){
    const count = await fuzzyCount<PortalStudent>(PortalStudent, 'PortalStudent', searchParams);
    return {count}
admin-panel/graphql-backend/src/resolvers/AdminProjectResolver.ts on lines 60..65
admin-panel/graphql-backend/src/resolvers/PortalPermissionFormResolver.ts on lines 51..56
admin-panel/graphql-backend/src/resolvers/UserResolver.ts on lines 69..74

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

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

      providers.sort(function (a: any, b: any) { return (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0); }); // sort providers alphabetically by name
rails/react-components/src/library/components/signup/basic_data_form.tsx on lines 62..62

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

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

      providers.sort(function (a: any, b: any) { return (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0); }); // sort providers alphabetically by name
rails/react-components/src/library/components/signup/login_modal.tsx on lines 62..62

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

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

  displayCompletion: function(event) {
    var value = this.input.value.strip();
    this.current = null;
    if (!this.canAddMoreItems())
      return;
Severity: Minor
Found in rails/public/javascripts/light_box.js - About 1 hr to fix

    Function keydown has 42 lines of code (exceeds 25 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

      Function matcherFromTokens has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function matcherFromTokens( tokens ) {
          var checkContext, matcher, j,
              len = tokens.length,
              leadingRelative = Expr.relative[ tokens[0].type ],
              implicitRelative = leadingRelative || Expr.relative[" "],
      Severity: Minor
      Found in rails/app/assets/javascripts/jquery/jquery.js - About 1 hr to fix

        Function generator has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            generator: function(axis) {
                var ticks = [],
                    tickSize = axis.tickSize[0], unit = axis.tickSize[1],
                    d = new Date(axis.min),
                    step = tickSize * timeUnitSize[unit];
        Severity: Minor
        Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 hr to fix

          Function generator has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              generator: function(axis) {
                  var ticks = [],
                      tickSize = axis.tickSize[0], unit = axis.tickSize[1],
                      d = new Date(axis.min),
                      step = tickSize * timeUnitSize[unit];
          Severity: Minor
          Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 hr to fix

            Function keydown has 42 lines of code (exceeds 25 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

              Function displayCompletion has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                displayCompletion: function(event) {
                  var value = this.input.value.strip();
                  this.current = null;
                  if (!this.canAddMoreItems())
                    return;
              Severity: Minor
              Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 1 hr to fix

                Function IframeableLink has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var IframeableLink = (function() {
                    let IFRAME_CLASS = undefined;
                    IframeableLink = class IframeableLink {
                      static initClass() {
                        IFRAME_CLASS = 'external-link-iframe';
                Severity: Minor
                Found in rails/app/assets/javascripts/iframeable-link.js - About 1 hr to fix

                  Method down has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def down
                      resilient_remove_index :admin_site_notices, :created_by
                      resilient_remove_index :admin_site_notices, :updated_by
                      resilient_remove_index :admin_site_notice_roles, :notice_id
                      resilient_remove_index :admin_site_notice_roles, :role_id
                  Severity: Minor
                  Found in rails/db/migrate/20141006195946_add_more_missing_indexes.rb - About 1 hr to fix

                    Method up has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def up
                    
                        # site notices indexes
                        resilient_add_index :admin_site_notices, :created_by
                        resilient_add_index :admin_site_notices, :updated_by
                    Severity: Minor
                    Found in rails/db/migrate/20141006195946_add_more_missing_indexes.rb - About 1 hr to fix

                      Function renderLinks has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        renderLinks () {
                          const { material } = this.props;
                          for (const key of Object.keys(material.links || {})) {
                            const link = material.links[key];
                            link.key = key;

                        Consider simplifying this complex logical expression.
                        Open

                                if( css ) {
                                    tokenizer = new PIE.Tokenizer( css );
                                    p = {};
                        
                                    isSlash = function ( token ) {
                        Severity: Critical
                        Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
                                          ( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
                                          ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
                                          !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
                          
                          
                          Severity: Critical
                          Found in rails/app/assets/javascripts/jquery/jquery.js - About 1 hr to fix

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

                              @Authorized()
                              @Query(() => User)
                              User(@Arg("id") id: string) {
                                return User.findOne({ where: { id }, relations: ["projects"]});
                              }
                            Severity: Major
                            Found in admin-panel/graphql-backend/src/resolvers/UserResolver.ts and 2 other locations - About 1 hr to fix
                            admin-panel/graphql-backend/src/resolvers/PortalPermissionFormResolver.ts on lines 58..62
                            admin-panel/graphql-backend/src/resolvers/PortalStudentResolver.ts on lines 59..63

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

                            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

                              @Authorized()
                              @Query(() => PortalStudent)
                              PortalStudent(@Arg("id") id: string) {
                                return PortalStudent.findOne({ where: { id }, relations: ["user"]});
                              }
                            admin-panel/graphql-backend/src/resolvers/PortalPermissionFormResolver.ts on lines 58..62
                            admin-panel/graphql-backend/src/resolvers/UserResolver.ts on lines 76..80

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

                            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