Showing 131 of 347 total issues
Function getDefaultHTML
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDefaultHTML() {
return ` <div class="trix-button-row">
<span class="trix-button-group trix-button-group--text-tools" data-trix-button-group="text-tools">
<button type="button" class="trix-button trix-button--icon trix-button--icon-bold" data-trix-attribute="bold" data-trix-key="b" title="${lang.bold}" tabindex="-1">${lang.bold}</button>
<button type="button" class="trix-button trix-button--icon trix-button--icon-italic" data-trix-attribute="italic" data-trix-key="i" title="${lang.italic}" tabindex="-1">${lang.italic}</button>
Method scope_fields_for
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.scope_fields_for(year)
with_options edit_only: true do
divider 'Census Scope'
input :page_number, as: :integer, min: 0, max: 10_000, facet: false
input :page_side, as: :select, facet: false if year > 1870 && year < 1950
Function node_modules/@rails/actiontext/app/javascript/actiontext/attachment_upload.js
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
"node_modules/@rails/actiontext/app/javascript/actiontext/attachment_upload.js"() {
import_activestorage = __toESM(require_activestorage());
AttachmentUpload = class {
constructor(attachment, element) {
this.attachment = attachment;
Function insertFromPaste
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
}, insertFromPaste: function() {
var n2, i2, o2, r2, s3, a2, u2, c2, l2, h2, p2;
return n2 = this.event.dataTransfer, s3 = { dataTransfer: n2 }, (i2 = n2.getData("URL")) ? (this.event.preventDefault(), s3.type = "text/html", p2 = (r2 = n2.getData("public.url-name")) ? e.squishBreakableWhitespace(r2).trim() : i2, s3.html = this.createLinkHTML(i2, p2), (a2 = this.delegate) != null && a2.inputControllerWillPaste(s3), this.withTargetDOMRange(function() {
var t3;
return (t3 = this.responder) != null ? t3.insertHTML(s3.html) : void 0;
Function selectAttribute
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const selectAttribute = function(attribute: string, form: JQuery, config: AttributeFilterConfig) {
const scopeSelect = buildScopeSelector(form, config)
scopeSelect.on('change', function() {
const $input = valueBox.find('input');
Consider simplifying this complex logical expression. Open
if ((t3 != null ? t3.nodeType : void 0) === Node.TEXT_NODE && k(t3.data) && (n2 = t3.parentNode, i2 = t3.previousSibling, e2 = t3.nextSibling, (!C(n2.previousSibling) || this.isBlockElement(n2.previousSibling)) && !v(n2)))
return !i2 || this.isBlockElement(i2) || !e2 || this.isBlockElement(e2);
Consider simplifying this complex logical expression. Open
if ((!window.CustomEvent || i && typeof window.CustomEvent != "function") && (window.CustomEvent = function(t3, e3) {
e3 = e3 || {};
var n3 = document.createEvent("CustomEvent");
return n3.initCustomEvent(t3, Boolean(e3.bubbles), Boolean(e3.cancelable), e3.detail), n3;
}, window.CustomEvent.prototype = window.Event.prototype), !window.Event || i && typeof window.Event != "function") {
Function SelectionChangeObserver
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
t2 = e.getDOMRange, e.SelectionChangeObserver = function(e2) {
function o2() {
this.run = n(this.run, this), this.update = n(this.update, this), this.selectionManagers = [];
}
var s;
Function getFilterText
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getFilterText(predicate, criteria, config) {
const { type, scopes } = config
switch (type) {
case 'boolean':
- 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 AttachmentPiece
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
e.Piece.registerType("attachment", e.AttachmentPiece = function(n2) {
function i(t3) {
this.attachment = t3, i.__super__.constructor.apply(this, arguments), this.length = 1, this.ensureAttachmentExclusivelyHasAttribute("href"), this.attachment.hasContent() || this.removeProhibitedAttributes();
}
return t2(i, n2), i.fromJSON = function(t3) {
Function initBuildings
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
initBuildings() {
$('#building-question .btn-primary').on('click', function () {
$('#building-question').fadeOut()
$('#building-fields').fadeIn()
})
Function buildings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const buildings = function(state = {}, action) {
if (action.type === 'BUILDING_HIGHLIGHT') {
return {
...state,
highlighted: state.highlighted === action.id ? null : action.id
- 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 check_page_access
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_page_access
if @page.access_callback && respond_to?(@page.access_callback) && !public_send(@page.access_callback)
raise CanCan::AccessDenied
end
if @page.controller.present? && @page.action.present?
- 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 layers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const layers = function(state = {}, action) {
if (action.type === 'FORGE_INIT') {
const nextLayers = state.layers.map(layer => {
layer.selected = layerStorage.isSelected(layer);
return layer;
- 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 initPeople
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
initPeople() {
$('#person-question .btn-primary').on('click', function () {
$('#person-question').fadeOut()
$('#person-fields').fadeIn()
})
Function Object
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
e.Object = function(n2) {
function i() {
this.id = ++o;
}
var o;
Function ObjectGroup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
e.ObjectGroup = function() {
function t2(t3, e2) {
var n, i;
this.objects = t3 != null ? t3 : [], i = e2.depth, n = e2.asTree, n && (this.depth = i, this.objects = this.constructor.groupObjects(this.objects, { asTree: n, depth: this.depth + 1 }));
}
Function UTF16String
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
e.UTF16String = function(t3) {
function e2(t4, e3) {
this.ucs2String = t4, this.codepoints = e3, this.length = this.codepoints.length, this.ucs2Length = this.ucs2String.length;
}
return s(e2, t3), e2.box = function(t4) {
Function handleEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
}, handleEvent: function(t3) {
switch (t3.stopImmediatePropagation(), t3.type) {
case "DOMAttrModified":
var e3 = t3.attrName, n3 = t3.relatedNode.namespaceURI, i2 = t3.target, o2 = new c("attributes", i2);
o2.attributeName = e3, o2.attributeNamespace = n3;
Method probable_match
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def probable_match
return if possible_matches.blank?
record = @census_record
probables = []