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){
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
)
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
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"
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
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"]
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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'
})
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76