noesya/osuny

View on GitHub

Showing 67 of 70 total issues

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

init: function () {
'use strict';
var i;
this.textareas = document.querySelectorAll('textarea[data-provider="codemirror"]');
this.instances = [];
Severity: Major
Found in app/assets/javascripts/admin/plugins/codemirror.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/admin/plugins/sortable.js on lines 8..16

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

init: function () {
'use strict';
var i;
this.containers = document.querySelectorAll('[data-sortable]');
this.instances = [];
Severity: Major
Found in app/assets/javascripts/admin/plugins/sortable.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/admin/plugins/codemirror.js on lines 13..21

Function setConfigs has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

setConfigs: function () {
'use strict';
this.setConfig('nothing',
{
toolbar: []
Severity: Major
Found in app/assets/javascripts/application/plugins/summernote.js - About 2 hrs to fix

    Method set_l10n_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_l10n_attributes(base_params, resource)
    l10ns_attributes = base_params.delete(:localizations)
    base_params[:localizations_attributes] = []
    l10ns_attributes.each do |language_iso_code, l10n_params|
    language = Language.find_by(iso_code: language_iso_code)

    Class Origins has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Osuny::Media::Picker::Origins
    attr_reader :picker
    delegate :params, :university, :about, :image, :image_property, :alt, :credit,
    to: :picker
     
     
    Severity: Minor
    Found in app/services/osuny/media/picker/origins.rb - About 2 hrs to fix

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      organizations_params = params[:organizations] || []
      every_organization_has_migration_identifier = organizations_params.all? { |organization_params|
      organization_params[:migration_identifier].present?
      }
      Severity: Minor
      Found in app/controllers/api/osuny/university/organizations_controller.rb - About 2 hrs to fix

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      categories_params = params[:categories] || []
      every_category_has_migration_identifier = categories_params.all? { |category_params|
      category_params[:migration_identifier].present?
      }

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      pages_params = params[:pages] || []
      every_page_has_migration_identifier = pages_params.all? { |page_params|
      page_params[:migration_identifier].present?
      }
      Severity: Minor
      Found in app/controllers/api/osuny/communication/websites/pages_controller.rb - About 2 hrs to fix

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      categories_params = params[:categories] || []
      every_category_has_migration_identifier = categories_params.all? { |category_params|
      category_params[:migration_identifier].present?
      }

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      posts_params = params[:posts] || []
      every_post_has_migration_identifier = posts_params.all? { |post_params|
      post_params[:migration_identifier].present?
      }
      Severity: Minor
      Found in app/controllers/api/osuny/communication/websites/posts_controller.rb - About 2 hrs to fix

      Method upsert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def upsert
      events_params = params[:events] || []
      every_event_has_migration_identifier = events_params.all? { |event_params|
      event_params[:migration_identifier].present?
      }

      Method set_time_slots_attributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_time_slots_attributes(permitted_params, event)
      time_slots_attributes = permitted_params.delete(:time_slots)
       
      time_slots_attributes.each do |time_slot_attributes|
      # Set the id of the time slot if it already exists

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

      if (notyfAlerts.length > 0) {
      notyf.open({
      type: 'error',
      position: {
      x: 'left',
      Severity: Major
      Found in app/assets/javascripts/application/plugins/notyf.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/application/plugins/notyf.js on lines 21..33

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

      if (notyfNotices.length > 0) {
      notyf.open({
      type: 'success',
      position: {
      x: 'left',
      Severity: Major
      Found in app/assets/javascripts/application/plugins/notyf.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/application/plugins/notyf.js on lines 8..20

      Function initSortable has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      initSortable: function () {
      'use strict';
      var nestedSortables,
      i;
       
       
      Severity: Minor
      Found in app/assets/javascripts/admin/plugins/treeview.js - About 1 hr to fix

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

        for (i = 0; i < this.kinds.length; i += 1) {
        kind = this.kinds[i];
        kind.addEventListener('click', this.onKindChange.bind(this));
        }
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 17..20
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 21..24
        app/assets/javascripts/admin/commons/content_editor/tabs.js on lines 21..24

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

        for (i = 0; i < this.tabs.length; i += 1) {
        tab = this.tabs[i];
        tab.addEventListener('shown.bs.tab', this.tabChanged.bind(this));
        }
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 17..20
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 21..24
        app/assets/javascripts/admin/communication/websites/menu_items.js on lines 14..17

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

        for (i = 0; i < this.editButtons.length; i += 1) {
        button = this.editButtons[i];
        button.addEventListener('click', this.onBlockActionClick.bind(this));
        }
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 21..24
        app/assets/javascripts/admin/commons/content_editor/tabs.js on lines 21..24
        app/assets/javascripts/admin/communication/websites/menu_items.js on lines 14..17

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

        for (i = 0; i < this.addBlockButtons.length; i += 1) {
        button = this.addBlockButtons[i];
        button.addEventListener('click', this.onBlockActionClick.bind(this));
        }
        app/assets/javascripts/admin/commons/content_editor/offcanvas.js on lines 17..20
        app/assets/javascripts/admin/commons/content_editor/tabs.js on lines 21..24
        app/assets/javascripts/admin/communication/websites/menu_items.js on lines 14..17

        Method upsert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def upsert
        categories_params = params[:categories] || []
        every_category_has_migration_identifier = categories_params.all? { |category_params|
        category_params[:migration_identifier].present?
        }
          Severity
          Category
          Status
          Source
          Language