Showing 211 of 211 total issues
Method perform
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(*tags)
ScoutApm::Transaction.ignore! if rand > (ENV["SCOUT_SAMPLE_RATE"] || 1).to_f
@count = 0
@jobs = []
Function tribute
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
tribute () {
if (window.Tribute) {
$('[data-toggle="tribute"]').each(function () {
const selector = this
const options = $(selector).data()
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init (element) {
jQuery(element).daterangepicker({
ranges: {
'Next 30 Days': [moment(), moment().add(29, 'days')],
'This Month': [moment().startOf('month'), moment().endOf('month')],
Function perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
perform () {
if (!this.visible) {
console.log(
`CodeFund container element not visible! Please verify an element exists (and is visible) that matches the CSS selector "${this.selector}"`
)
Method user_params
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def user_params
params.require(:user).permit(
:address_1,
:address_2,
:avatar,
Function fetchResults
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchResults () {
const query = this.inputTarget.value.trim()
if (!query) {
this.resultsTarget.hidden = true
return
Similar blocks of code found in 2 locations. Consider refactoring. Open
def index
@summary = @campaign.summary(@start_date, @end_date)
reports = @campaign.daily_summary_reports_by_creative(@start_date, @end_date).unscope(:order)
@pagy, @reports = pagy(reports)
- 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 52.
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
def index
@summary = @campaign.summary(@start_date, @end_date)
daily_summaries = @campaign.daily_summaries_by_day(@start_date, @end_date).unscope(:order)
@pagy, @daily_summaries = pagy(daily_summaries)
- 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 52.
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 objectFitFallback
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
objectFitFallback () {
if (this.isIE() || this.isEdge()) {
const selectors = [
'.user-avatar img',
'.tile > img',
Method property_report
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def property_report(start = nil, stop = nil)
rows = []
rows << [
"ID",
"Name",
Function constructor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor (options) {
/**
* The StackedMenu options.
* @type {Object}
* @property {Boolean} compact=false - Transform StackedMenu items (except item childs) to small size.
- 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 noty_flash
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def noty_flash
flash_messages = []
flash.each do |type, message|
next unless message.is_a? String
type = "success" if type == "notice"
- 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
def index
@summary = @campaign.summary(@start_date, @end_date)
reports = @campaign.daily_summary_reports_by_property(@start_date, @end_date)
@pagy, @reports = pagy_arel(reports)
- 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 50.
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
def index
@summary = @campaign.summary(@start_date, @end_date)
reports = @campaign.daily_summary_reports_by_country_code(@start_date, @end_date)
@pagy, @reports = pagy_arel(reports)
- 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 50.
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 updateProvinceCodeOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateProvinceCodeOptions (event) {
if (event && event.type === 'keyup' && event.key !== 'Enter') return
if (
event &&
event.type === 'cf:select:changed' &&
Function publisher
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
publisher () {
$(document)
.on('focusin', '.publisher .form-control', function () {
const $publisher = $(this).parents('.publisher')
Method job_posting_params
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def job_posting_params
params.require(:job_posting).permit(
:company_name,
:company_url,
:company_email,
Function closeMenu
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
closeMenu (el, emiter = true) {
const self = this
let blockedSlide = this._isLevelMenu(el) && this.isCompact()
// open menu
if (this.isHoverable() || blockedSlide) {
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if params[:manage_scope]
job_postings = JobPosting.where(user: current_user).order(start_date: :desc)
else
job_postings = JobPosting.active.ranked_by_source.order(start_date: :desc)
Method campaign_params
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def campaign_params
return advertiser_campaign_params if !authorized_user.can_admin_system? && @campaign.fixed_ecpm
return extended_advertiser_campaign_params unless authorized_user.can_admin_system?
sanitize_params(:campaign, params).require(:campaign).permit(
:daily_budget,