IT61/it61-rails

View on GitHub

Showing 20 of 24 total issues

Function dropdown has 188 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.fn.dropdown = function (options) {
    var defaults = {
      inDuration: 300,
      outDuration: 225,
      constrain_width: false, // Does not change width of dropdown to that of the activator
Severity: Major
Found in app/assets/javascripts/components/dropdown.js - About 7 hrs to fix

    Method import_events has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

      def import_events
        puts "Importing events"
        Geocoder.configure(lookup: :yandex)
    
        use_old_db
    Severity: Minor
    Found in lib/tasks/importer/events_importer.rb - About 5 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 placeDropdown has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function placeDropdown(eventType) {
            // Check for simultaneous focus and click events.
            if (eventType === 'focus') {
              isFocused = true;
            }
    Severity: Major
    Found in app/assets/javascripts/components/dropdown.js - About 2 hrs to fix

      Function imageImport has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      var imageImport = (function () {
        // Import image to Canvas when $setImage input changed
        var importImage = function ($croppedModalImage, $imageInput, $modal) {
          var files = $imageInput[0].files;
          var file;
      Severity: Minor
      Found in app/assets/javascripts/components/image_import.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 import_events has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def import_events
          puts "Importing events"
          Geocoder.configure(lookup: :yandex)
      
          use_old_db
      Severity: Minor
      Found in lib/tasks/importer/events_importer.rb - About 1 hr to fix

        Function autocomplete has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          $.fn.autocomplete = function (options) {
        
            var $container,
              _data = [],
              self = this.filter('input');
        Severity: Minor
        Found in app/assets/javascripts/components/autocomplete-input.js - About 1 hr to fix

          Function imageImport has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var imageImport = (function () {
            // Import image to Canvas when $setImage input changed
            var importImage = function ($croppedModalImage, $imageInput, $modal) {
              var files = $imageInput[0].files;
              var file;
          Severity: Minor
          Found in app/assets/javascripts/components/image_import.js - About 1 hr to fix

            Function bindGeocoder has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function bindGeocoder() {
                function addressValue() {
                  return $placeAddress.val();
                }
            
            
            Severity: Minor
            Found in app/assets/javascripts/events/place.js - About 1 hr to fix

              Function cropper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var cropper = (function () {
              
                var createCropper = function ($croppedModalImage, $currentImage, $form, onCropperCreated) {
                  $croppedModalImage.cropper({
                    background: false,
              Severity: Minor
              Found in app/assets/javascripts/components/image_crop.js - About 1 hr to fix

                Method all_providers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def all_providers
                    {
                      facebook: {
                        name: t("socials.facebook"),
                        class: "fa fa-facebook",
                Severity: Minor
                Found in app/helpers/user_helper.rb - About 1 hr to fix

                  Method import_social_accounts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def import_social_accounts
                      puts "Importing social accounts"
                  
                      use_old_db
                      social_accounts = ActiveRecord::Base.connection.execute("SELECT * FROM authentications")
                  Severity: Minor
                  Found in lib/tasks/importer/social_accounts_importer.rb - About 55 mins 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 initCropper has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    initCropper: function($croppedModalImage, $imageInput, $modal, $uploadImage, $imageForm, $currentImage) {
                  Severity: Minor
                  Found in app/assets/javascripts/users/edit_event_manager.js - About 45 mins to fix

                    Method build_permalink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def build_permalink
                          target_field_value = send(permalink_configuration[:target_field])
                    
                          return if permalink.present? || target_field_value.blank?
                          permalink_base = I18n.transliterate(target_field_value).parameterize.downcase
                    Severity: Minor
                    Found in lib/permalink_for/slug_implementation.rb - About 45 mins 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 easeOutQuad has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        easeOutQuad: function (x, t, b, c, d) {
                    Severity: Minor
                    Found in app/assets/javascripts/components/dropdown.js - About 35 mins to fix

                      Function easeOutCubic has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          easeOutCubic: function (x, t, b, c, d) {
                      Severity: Minor
                      Found in app/assets/javascripts/components/dropdown.js - About 35 mins to fix

                        Function easeOutSine has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            easeOutSine: function (x, t, b, c, d) {
                        Severity: Minor
                        Found in app/assets/javascripts/components/dropdown.js - About 35 mins to fix

                          Function swing has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              swing: function (x, t, b, c, d) {
                          Severity: Minor
                          Found in app/assets/javascripts/components/dropdown.js - About 35 mins to fix

                            Method load_photos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def load_photos(_tag)
                                photos ||= InstagramCache.get(_tag)
                                if photos.blank?
                                  photos = load_from_instagram(_tag)
                                  InstagramCache.store(_tag, photos) unless photos.blank?
                            Severity: Minor
                            Found in lib/instagram_service.rb - About 25 mins 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 create_user_from_omniauth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def create_user_from_omniauth(_kind)
                                  auth = request.env["omniauth.auth"]
                            
                                  @user = User.from_omniauth!(auth)
                            
                            
                            Severity: Minor
                            Found in app/controllers/users/omniauth_controller.rb - About 25 mins 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 showImageOnLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function showImageOnLoad($imageInput, $image, onLoadCallback) {
                              if (!$imageInput) {
                                return;
                              }
                            
                            
                            Severity: Minor
                            Found in app/assets/javascripts/image_show.js - About 25 mins 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