Showing 126 of 126 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
isDirty() {
if (!this.dirtyable) {
return false;
}
const currVal = new Date(this.fp.input.value);
- 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 83.
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
Class App
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class App < Sinatra::Base
include Trace
set :root, File.expand_path('../../../../..', __FILE__)
set :router_, WebClient::Router
set :bind, '0.0.0.0'
Function initLists
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function initLists(e) {
console.debug('\tLists');
let components = e.querySelectorAll('.mdc-list');
if (components.length === 0 && e.offsetParent && e.offsetParent.vComponent !== undefined) {
- 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 call
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
call(results) {
const targetId = this.targetId;
const action = this.params.action;
const delayAmt = this.event instanceof FocusEvent ? 500 : 0;
const elem = this.root.getElementById(targetId);
Class UserInterface
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class UserInterface
include DSL::Definer
include DSL::ProtectFromForgery
include Components::Mixins::Common
include Components::Mixins::Helpers
Method expand_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def expand_hash(h)
HashExt::Traverse.traverse(h.to_h) do |k,v|
if !v.is_a?(Array) && v.respond_to?(:to_h)
v = v.is_a?(OpenStruct) ? expand_hash(v.to_h) : v.to_h
elsif v.is_a?(Array)
- 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 next
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
MaterialStepper.prototype.next = function () {
/** @type {boolean} */
var moved;
/** @type {MaterialStepper.Steps_.collection<step>} */
var step;
Function onreadystatechange
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
httpRequest.onreadystatechange = (event) => {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
const contentType = httpRequest.getResponseHeader('content-type');
console.debug(httpRequest.status + ':' + contentType);
Function action_class
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
static action_class(action, event, root) {
const action_type = action[0];
const url = action[1];
const options = action[2];
const params = action[3];
Function getStepModel_
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
MaterialStepper.prototype.getStepModel_ = function (step, id) {
/** @type {Object} */
var model;
/** @type {string} */
var selectorActionsBack;
Function buildURL
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
buildURL(baseUrl) {
var url = baseUrl;
for (var i = 1; i < arguments.length; i++) {
var args = arguments[i];
if (Array.isArray(args)) {
- 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 vTimeout
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
nodeToReplace.vTimeout = setTimeout(function() {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
console.debug(httpRequest.status + ':' +
this.getResponseHeader('content-type'));
Function displayErrors
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
displayErrors(result) {
const {statusCode, contentType, content} = result;
let responseErrors = null;
Function initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initialize(root, setRoot) {
console.debug('Initializing components');
const start = performance.now();
Function initEvents
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function initEvents(e) {
console.debug('\tEvents');
for (const eventElem of getEventElements(e)) {
var eventsData = JSON.parse(eventElem.dataset.events);
Function promiseObj
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const promiseObj = new Promise(function(resolve) {
clearTimeout(elem.vTimeout);
elem.vTimeout = setTimeout(function() {
console.debug('Toggling visibility on: ' + targetId);
Identical blocks of code found in 2 locations. Consider refactoring. Open
constructor(options, params, event, root) {
this.target = options.target;
this.ids = params.ids;
this.event = event;
this.root = root;
- 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 64.
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
constructor(options, params, event, root) {
this.target = options.target;
this.ids = params.ids;
this.event = event;
this.root = root;
- 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 64.
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 visibilityObserverMixin
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export let visibilityObserverMixin = Base => class extends Base {
recalcWhenVisible(vComponent) {
vComponent.hidden_on_create = vComponent.element.offsetParent === null;
if (vComponent.hidden_on_create) {
- 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 back
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
MaterialStepper.prototype.back = function () {
/** @type {boolean} */
var moved;
/** @type {function} */
var moveStep;