Showing 4,240 of 4,240 total issues
Method organization
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.organization(domain)
raise Exceptions::UnprocessableEntity, 'no domain given' if domain.blank?
return if Rails.env.test? && DISABLE_IN_TEST_ENV
Method after_update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.after_update(record)
# return if we run import mode
return true if Setting.get('import_mode')
Method selectors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.selectors(index, selectors = nil, options = {}, aggs_interval = nil)
raise 'no selectors given' if !selectors
url = build_url(type: index, action: '_search', with_pipeline: false, with_document_type: false)
return if url.blank?
Method initialize_article_types
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize_article_types
@article_types = {
'email-external' => {
type_id: article_type_id_lookup('email'),
internal: false
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
if !@session || !@session['id']
return {
event: 'who_am_i',
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
return super if super
return if !permission_check('chat.agent', 'chat')
# find chat session
Method time_max
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.time_max(data)
query, bind_params, tables = Ticket.selector2sql(data[:condition])
ticket_list = Ticket.where('tickets.created_at >= ? AND tickets.created_at <= ?', data[:start], data[:end])
.where(query, *bind_params).joins(tables)
time_max = 0
Method load
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load
# get whole collection
index_and_lists = nil
local_overview_changed = overview_changed?
Method time_min
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.time_min(data)
query, bind_params, tables = Ticket.selector2sql(data[:condition])
ticket_list = Ticket.where('tickets.created_at >= ? AND tickets.created_at <= ?', data[:start], data[:end])
.where(query, *bind_params).joins(tables)
time_min = 0
Function mockOnlineNotification
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const mockOnlineNotification = (
id: Scalars['ID']['output'],
mockNotification: Partial<OnlineNotificationNode>,
): OnlineNotificationNode => {
return {
Function addStaticFloatingLabel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addStaticFloatingLabel = (classes: Classes = {}): Classes => {
return extendClasses(classes, {
outer: clean(`
focus-within:bg-blue-highlight relative flex flex-col
px-2
Function addFloatingTextareaLabel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addFloatingTextareaLabel = (classes: Classes = {}) => {
return extendClasses(classes, {
outer: clean(`
floating-textarea relative px-2
`),
Function setPopulatedOnWebkitAutofill
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setPopulatedOnWebkitAutofill = (node: FormKitNode) => {
let autofillField = false
const onAnimationstart = (e?: AnimationEvent) => {
if (
Function formUpdaterTrigger
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const formUpdaterTrigger = (
defaultTrigger: FormUpdaterTrigger = 'direct',
defaultTriggerDelay = 300,
) => {
return (node: FormKitNode) => {
Function getArticleAttachmentsLinks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getArticleAttachmentsLinks = (
attachment: Attachment,
config: ConfigList,
) => {
const buildBaseUrl = () => {
Function messageText
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const messageText = (
type: string,
authorName: string,
metaObject?: DataPrivacyTask,
): Maybe<string> => {
Similar blocks of code found in 2 locations. Consider refactoring. Open
def extract_from_string(string, filename)
return if string.empty?
# display: '...'
literal_string_regex = %r{('|")(.+?)(?<!\\)\1}
- 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 48.
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 extract_from_string(string, filename)
return if string.empty?
# title: '...'
# scrollHint: '...'
- 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 48.
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 resizeImage
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
ZammadChat.prototype.resizeImage = function(dataURL, x, y, sizeFactor, type, quallity, callback, force) {
Function plotPoints
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol) {