rauversion/rauversion-ror

View on GitHub

Showing 40 of 89 total issues

Method icon_for has 392 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def icon_for(kind)
    case kind
    when :transbank
      <<-HTML
      <svg
Severity: Major
Found in app/helpers/application_helper.rb - About 1 day to fix

    Method all has 193 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.all
        [
          {
            "genre" => "Ambient",
            "subgenres" => [
    Severity: Major
    Found in app/models/category.rb - About 7 hrs to fix

      File schema.rb has 486 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ActiveRecord::Schema[7.0].define(version: 2024_05_06_041324) do
        # These are extensions that must be enabled in order to support this database
        enable_extension "plpgsql"
      
        create_table "active_storage_attachments", force: :cascade do |t|
      Severity: Minor
      Found in db/schema.rb - About 7 hrs to fix

        File application_helper.rb has 462 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ApplicationHelper
          ActionView::Base.default_form_builder = TailwindFormBuilder
        
          def gettext(text)
            text
        Severity: Minor
        Found in app/helpers/application_helper.rb - About 7 hrs to fix

          Method create has a Cognitive Complexity of 21 (exceeds 5 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 2 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

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

          export default class extends Controller {
            static targets = [
              "player", 
              "playicon", 
              "pauseicon", 
          Severity: Minor
          Found in app/javascript/controllers/player_controller.js - About 2 hrs to fix

            File category.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class Category < ApplicationRecord
              extend FriendlyId
              friendly_id :name, use: :slugged
            
              def self.genres
            Severity: Minor
            Found in app/models/category.rb - About 2 hrs to fix

              Method permission_definitions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.permission_definitions
                  [
                    {
                      name: :direct_download,
                      wrapper_class: "sm:col-span-2",
              Severity: Major
              Found in app/models/track.rb - About 2 hrs to fix

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

                  def attempt_oembed(card, url)
                    response = OEmbed::Providers.get(url)
                    card.type = response.type
                    card.title = response.respond_to?(:title) ? response.title : ""
                    card.author_name = response.respond_to?(:author_name) ? response.author_name : ""
                Severity: Minor
                Found in app/services/fetch_link_card_service.rb - About 2 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

                File track.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class Track < ApplicationRecord
                  extend FriendlyId
                  friendly_id :title, use: :slugged
                
                  belongs_to :user
                Severity: Minor
                Found in app/models/track.rb - About 2 hrs to fix

                  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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language