Showing 211 of 211 total issues
Function quill
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
quill () {
if (window.Quill) {
$('[data-toggle="quill"]').each(function () {
const selector = this
const options = $(selector).data()
Method data
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data
@data ||= begin
# TODO: update the multiplier strategy after all campaigns with a start_date before 2019-03-07 have completed
subregion_cpm_multipliers = YAML.safe_load(File.read(Rails.root.join("config/subregion_cpm_multipliers.yml")))
country_cpm_multipliers = YAML.safe_load(File.read(Rails.root.join("config/country_cpm_multipliers.yml")))
Similar blocks of code found in 2 locations. Consider refactoring. Open
xaxis: {
tickColor: isDarkSkin
? this.hexToRgba(colors.white, 0.08)
: this.hexToRgba(colors.black, 0.1),
color: isDarkSkin ? gray[400] : gray[600]
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
yaxis: {
tickColor: isDarkSkin
? this.hexToRgba(colors.white, 0.08)
: this.hexToRgba(colors.black, 0.1),
color: isDarkSkin ? gray[400] : gray[600]
- 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
Function flatpickr
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
flatpickr () {
if (window.flatpickr) {
flatpickr.defaultConfig.disableMobile = true
$('[data-toggle="flatpickr"]').each(function () {
Method perform
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(campaign_id, property_id, ip_address, user_agent, clicked_at_string)
ScoutApm::Transaction.ignore! if rand > (ENV["SCOUT_SAMPLE_RATE"] || 1).to_f
campaign = Campaign.find_by(id: campaign_id)
return unless campaign&.sponsor?
Function constructor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor () {
// looper color scheme refer from our _variable-bs-overrides.scss
this.colors = {
black: '#14141F',
brand: {
Function zxcvbn
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
zxcvbn () {
if (window.zxcvbn) {
$('.form-strength-meter').each(function () {
const input = this
const indicator = $(this).data('indicator')
Method render_pricing_table
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_pricing_table
@base = Money.new((params[:base] || ENV.fetch("BASE_ECPM", 400)).to_i, "USD")
@multiplier = params[:multiplier]
@regions = {}
Method perform
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
return unless ENV["PIPEDRIVE_SYNC_HOOK_URL"].present?
body = Campaign.premium.active.includes(:user, :organization).map { |campaign|
{
Method perform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def perform
ScoutApm::Transaction.ignore! if rand > (ENV["SCOUT_SAMPLE_RATE"] || 1).to_f
properties = []
Property.active.find_each do |property|
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
- 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 show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show
return head(:forbidden) unless valid_referer?
track_event :virtual_impression_initiated
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (adLength > 85 || ctaLength > 20) {
this.copyWrapperTarget.classList.add('over-limit')
this.copyWarningWrapperTarget.classList.remove('text-secondary')
this.copyWarningWrapperTarget.classList.add('text-danger')
} else {
- 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 perform
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def perform(id, campaign_id, property_id, creative_id, ad_template, ad_theme, ip_address, country_code, user_agent, displayed_at_string)
Method perform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def perform(*tags)
ScoutApm::Transaction.ignore! if rand > (ENV["SCOUT_SAMPLE_RATE"] || 1).to_f
@count = 0
@jobs = []
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
this.copyWrapperTarget.classList.remove('over-limit')
this.copyWarningWrapperTarget.classList.remove('text-danger')
this.copyWarningWrapperTarget.classList.add('text-secondary')
}
- 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 record_conversion
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def record_conversion(impression_id_param, conversion_referrer: nil, test: false, metadata: {})
impression = Impression.find_by(id: impression_id_param, organization_id: organization_id) if UUID.validate(impression_id_param)
logger.info "Pixel#record_conversion Unable to find an impression for impression_id='#{impression_id_param}' and organization_id='#{organization_id}'." unless impression
impression_attribute_names = %w[
advertiser_id
Method perform
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(id:, report_url:, recipients: [])
organization_report = OrganizationReport.find_by(id: id)
return unless organization_report
organization_report.update(status: "generating")
Function openMenu
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
openMenu (el, emiter = true) {
// prevent open on active item if not on compact mode
if (this._hasActive(el) && !this.isCompact()) return
const self = this
let blockedSlide = this._isLevelMenu(el) && this.isCompact()