Showing 4,240 of 4,240 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
plotLine(series.datapoints, Math.sin(angle) * (lw/2 + sw/4), Math.cos(angle) * (lw/2 + sw/4), series.xaxis, series.yaxis);
- 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 71.
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
it('implements disabled', async () => {
const wrapper = renderComponent(FormKit, {
...wrapperParameters,
props: {
...commonProps,
- 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 71.
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
it('implements disabled', async () => {
const wrapper = renderComponent(FormKit, {
...wrapperParameters,
props: {
...testProps,
- 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 71.
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 startTimeoutObservers
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
ZammadChat.prototype.startTimeoutObservers = function() {
this.idleTimeout = new Timeout({
logPrefix: 'idleTimeout',
debug: this.options.debug,
timeout: this.options.idleTimeout,
Function startTimeoutObservers
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
ZammadChat.prototype.startTimeoutObservers = function() {
this.idleTimeout = new Timeout({
logPrefix: 'idleTimeout',
debug: this.options.debug,
timeout: this.options.idleTimeout,
Function create
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(context) {
const IGNORE_STRING_PATTERNS = [
/^[^A-Z]/, // Only look at strings starting with upper case letters
/\$\{/, // Ignore strings with interpolation
]
Function showWidget
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
showWidget: function() {
if (this.isOpen) {
return;
}
Function data
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
Function leverageNative
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function leverageNative( el, type, expectSync ) {
// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
if ( !expectSync ) {
if ( dataPriv.get( el, type ) === undefined ) {
Method url_check
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def url_check
return if setup_done_response
# validate
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
Method link_account
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.link_account(_request_token, params)
# fail if request_token.params[:oauth_token] != params[:state]
external_credential = ExternalCredential.find_by(name: 'facebook')
raise Exceptions::UnprocessableEntity, __('No Facebook app configured!') if !external_credential
Function useObjectAttributeFormData
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useObjectAttributeFormData = (
objectAttributes: Map<string, ObjectManagerFrontendAttribute>,
values: FormValues,
) => {
const internalObjectAttributeValues: Record<string, FormFieldValue> = {}
Function handleError
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected handleError(error: ApolloError): void {
const options = this.handlerOptions
let triggerNotification = options.errorShowNotification
Function debugLink
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const debugLink = new ApolloLink((operation, forward) => {
if (log.getLevel() < log.levels.DEBUG) return forward(operation)
const requestContext = operation.getContext()
Function schema
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
definition.schema = (extensions) => {
let sectionSchemaExtension:
| FormKitSchemaCondition
| Partial<FormKitSchemaNode>
Method perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def perform(model)
model = model.safe_constantize
return if model.blank?
assets = {}
- 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 filter_matches?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.filter_matches?(mail, filter)
min_one_rule_exists = false
filter[:match].each do |key, meta|
- 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 attachments_for_search_index_attribute_lookup
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def attachments_for_search_index_attribute_lookup
# list ignored file extensions
attachments_ignore = Setting.get('es_attachment_ignore') || [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe' ]
# max attachment 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 assets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def assets(data)
app_model_trigger = Trigger.to_app_model
data[ app_model_trigger ] ||= {}
- 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 changed?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def changed?(object:, current_changes:, previous_changes: {})
changed = false
previous_changes ||= {}
current_changes.each do |attribute, value|
next if !object.attributes.key?(attribute.to_s)
- 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"