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
Method all
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.all
[
{
"genre" => "Ambient",
"subgenres" => [
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|
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
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
)
- Read upRead up
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",
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
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",
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 : ""
- Read upRead up
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
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){
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)
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){
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?
- Read upRead up
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")
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?
Method genres
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.genres
[
"Alternative Rock",
"Ambient",
"Classical",
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)
- Read upRead up
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
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
)