rauversion/rauversion-ror

View on GitHub

Showing 89 of 89 total issues

Function uploadFile has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  uploadFile() {
    this.totalUploads = this.inputTarget.files.length;  // Set the total number of files to be uploaded
    this.maxSizeValue = 200 * 1024 * 1024  // 200 MB in bytes

    if(this.totalUploads > 5){
Severity: Major
Found in app/javascript/controllers/audio_upload_controller.js - About 2 hrs to fix

    Function initWave has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initWave() {
        this.peaks = this.peaksValue
        this.url = this.urlValue
    
        console.log("OELLELE", this.playerTarget)
    Severity: Major
    Found in app/javascript/controllers/player_controller.js - About 2 hrs to fix

      Function uploadFile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        uploadFile() {
          this.totalUploads = this.inputTarget.files.length;  // Set the total number of files to be uploaded
          this.maxSizeValue = 10 * 1024 * 1024  // 10 MB in bytes
      
          if(this.totalUploads > 5){
      Severity: Minor
      Found in app/javascript/controllers/upload_controller.js - About 1 hr to fix

        Method new_with_session has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def new_with_session(params, session)
              super.tap do |user|
                if data = session["devise.omniauth_data"]
        
                  user.email = data["email"] if user.email.blank? && data["email"].present?
        Severity: Minor
        Found in app/models/user/omni_auth_extension.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 connect has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          connect() {
            const wrapper = this.element;
            const selectWrapper = wrapper.querySelector(".select-wrapper")
            const root = createRoot(selectWrapper);
            const selectElement = this.element.querySelector("select")
        Severity: Minor
        Found in app/javascript/controllers/select_controller.jsx - About 1 hr to fix

          Method handle_stripe_session has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def handle_stripe_session
              # @purchase.errors.add(:base, "hahahaha")
              account = @track.user.oauth_credentials.find_by(provider: "stripe_connect")
              Stripe.stripe_account = account.uid unless account.blank?
          
          
          Severity: Minor
          Found in app/controllers/track_purchases_controller.rb - About 1 hr to fix

            Method genres has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.genres
                [
                  "Alternative Rock",
                  "Ambient",
                  "Classical",
            Severity: Minor
            Found in app/models/category.rb - About 1 hr to fix

              Method perform has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def perform(track_id: nil, playlist_id: nil)
                  if track_id
                    track = Track.find_by(id: track_id)
                    return unless track
                    track_zip(track)
              Severity: Minor
              Found in app/jobs/zipper_job.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 handle_stripe_session has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def handle_stripe_session
                  # @purchase.errors.add(:base, "hahahaha")
                  account = @event.user.oauth_credentials.find_by(provider: "stripe_connect")
                  Stripe.stripe_account = account.uid
              
              
              Severity: Minor
              Found in app/controllers/event_purchases_controller.rb - About 1 hr to fix

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

                  def create
                    if params[:form_models_artist_form]
                      resource_params = params.require(:form_models_artist_form).permit(
                        :password, :username, :hide, :request_access, :email, :search, :first_name, :last_name, :logo
                      )
                Severity: Minor
                Found in app/controllers/account_connections_controller.rb - About 1 hr to fix

                  Method change has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def change
                      create_table :events do |t|
                        t.string :title
                        t.text :description
                        t.string :slug
                  Severity: Minor
                  Found in db/migrate/20230726200555_create_events.rb - About 1 hr to fix

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

                      create_table "event_tickets", force: :cascade do |t|
                        t.string "title"
                        t.decimal "price"
                        t.decimal "early_bird_price"
                        t.decimal "standard_price"
                    Severity: Major
                    Found in db/schema.rb and 1 other location - About 1 hr to fix
                    db/schema.rb on lines 388..402

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

                    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

                      create_table "tickets", force: :cascade do |t|
                        t.string "title"
                        t.decimal "price"
                        t.decimal "early_bird_price"
                        t.decimal "standard_price"
                    Severity: Major
                    Found in db/schema.rb and 1 other location - About 1 hr to fix
                    db/schema.rb on lines 113..127

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

                    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

                    Method show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def show
                        remote_ip = request.remote_ip
                    
                        location_data = Geocoder.search(remote_ip).first
                        city = location_data&.city || nil
                    Severity: Minor
                    Found in app/controllers/tracking_events_controller.rb - About 1 hr to fix

                      Method handle_tbk_session has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def handle_tbk_session
                          ### TRANSBANK ###
                          commerce_code = ENV["TBK_MALL_ID"]
                          api_key = ENV["TBK_API_KEY"]
                      
                      
                      Severity: Minor
                      Found in app/controllers/event_purchases_controller.rb - About 1 hr to fix

                        Method change has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def change
                            # Use Active Record's configured type for primary and foreign keys
                            primary_key_type, foreign_key_type = primary_and_foreign_key_types
                        
                            create_table :active_storage_blobs, id: primary_key_type do |t|

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

                            handleDrop(e) {
                              this.preventDefaults(e);
                              let files = e.dataTransfer.files;
                              this.inputTarget.files = files;
                              this.uploadFile();
                          Severity: Major
                          Found in app/javascript/controllers/audio_upload_controller.js and 1 other location - About 1 hr to fix
                          app/javascript/controllers/upload_controller.js on lines 144..149

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

                          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

                            handleDrop(e) {
                              this.preventDefaults(e);
                              let files = e.dataTransfer.files;
                              this.inputTarget.files = files;
                              this.uploadFile();
                          Severity: Major
                          Found in app/javascript/controllers/upload_controller.js and 1 other location - About 1 hr to fix
                          app/javascript/controllers/audio_upload_controller.js on lines 147..152

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

                          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

                              this._wave.on('pause', function () {
                                _this.playiconTarget.style.display = 'none'
                                _this.pauseiconTarget.style.display = 'block'
                              })
                          Severity: Major
                          Found in app/javascript/controllers/audio_controller.js and 1 other location - About 1 hr to fix
                          app/javascript/controllers/footer_player_controller.js on lines 62..65

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

                          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

                              this._wave.on('pause', function () {
                                _this.playiconTarget.style.display = 'none'
                                _this.pauseiconTarget.style.display = 'block'
                              })
                          Severity: Major
                          Found in app/javascript/controllers/footer_player_controller.js and 1 other location - About 1 hr to fix
                          app/javascript/controllers/audio_controller.js on lines 73..76

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

                          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