rauversion/rauversion-ror

View on GitHub

Showing 89 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

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

        this.validFiles.forEach((validFile) => {
          const {file, index} = validFile
          const identifier = Math.floor(Math.random() * Date.now()).toString(16)
          const progressBar = this.add_template(identifier, file) //this.createProgressBar(identifier);
    
    
    Severity: Major
    Found in app/javascript/controllers/upload_controller.js and 1 other location - About 1 day to fix
    app/javascript/controllers/audio_upload_controller.js on lines 57..89

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

    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.validFiles.forEach((validFile) => {
          const {file, index} = validFile
          const identifier = Math.floor(Math.random() * Date.now()).toString(16)
          const progressBar = this.add_template(identifier, file) //this.createProgressBar(identifier);
    
    
    Severity: Major
    Found in app/javascript/controllers/audio_upload_controller.js and 1 other location - About 1 day to fix
    app/javascript/controllers/upload_controller.js on lines 54..86

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

    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 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.1].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

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

            createProgressBar(index) {
              const progressBar = document.createElement('div');
              progressBar.setAttribute("id", `progress-bar-${index}`);
              progressBar.style.width = "0%";
              progressBar.style.height = "20px";
          Severity: Major
          Found in app/javascript/controllers/audio_upload_controller.js and 1 other location - About 4 hrs to fix
          app/javascript/controllers/upload_controller.js on lines 96..107

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

          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

            createProgressBar(index) {
              const progressBar = document.createElement('div');
              progressBar.setAttribute("id", `progress-bar-${index}`);
              progressBar.style.width = "0%";
              progressBar.style.height = "20px";
          Severity: Major
          Found in app/javascript/controllers/upload_controller.js and 1 other location - About 4 hrs to fix
          app/javascript/controllers/audio_upload_controller.js on lines 100..111

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

          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

          export default class extends Controller {
            //static targets = ["container", "backdrop", "panel", "closeButton"];
          
            connect (){
              enter(this.element);
          Severity: Major
          Found in app/javascript/controllers/removals_controller.js and 1 other location - About 3 hrs to fix
          app/javascript/controllers/animate_controller.js on lines 5..25

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

          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

          export default class extends Controller {
            //static targets = ["container", "backdrop", "panel", "closeButton"];
          
            connect (){
              enter(this.element);
          Severity: Major
          Found in app/javascript/controllers/animate_controller.js and 1 other location - About 3 hrs to fix
          app/javascript/controllers/removals_controller.js on lines 5..24

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

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

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

              createHiddenBlobInput(blob) {
                const hiddenField = document.createElement("input");
                hiddenField.setAttribute("type", "hidden");
                hiddenField.setAttribute("value", blob.signed_id);
                hiddenField.name = this.inputTarget.name;
            Severity: Major
            Found in app/javascript/controllers/audio_upload_controller.js and 1 other location - About 2 hrs to fix
            app/javascript/controllers/upload_controller.js on lines 110..116

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

            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

              createHiddenBlobInput(blob) {
                const hiddenField = document.createElement("input");
                hiddenField.setAttribute("type", "hidden");
                hiddenField.setAttribute("value", blob.signed_id);
                hiddenField.name = this.inputTarget.name;
            Severity: Major
            Found in app/javascript/controllers/upload_controller.js and 1 other location - About 2 hrs to fix
            app/javascript/controllers/audio_upload_controller.js on lines 114..120

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

            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

            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

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

                    audioProcessPauseListeners(e) {
                      this.playiconTarget.style.display = 'none'
                      this.pauseiconTarget.style.display = 'block'
                      this.playing = false
                      this._wave.seekTo(e.detail.percent)
                  Severity: Major
                  Found in app/javascript/controllers/track_player_controller.js and 1 other location - About 2 hrs to fix
                  app/javascript/controllers/track_player_controller.js on lines 106..111

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

                  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

                    audioProcessPlayListeners(e) {
                      this.playiconTarget.style.display = 'block'
                      this.pauseiconTarget.style.display = 'none'
                      this.playing = true
                      this._wave.seekTo(e.detail.percent)
                  Severity: Major
                  Found in app/javascript/controllers/track_player_controller.js and 1 other location - About 2 hrs to fix
                  app/javascript/controllers/track_player_controller.js on lines 113..118

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

                  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