src/attach/attachPane.js
Function render
has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring. Open
Open
render: function (subject, context) {
const dom = context.dom
var kb = context.session.store
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
- 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 render
has 363 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function (subject, context) {
const dom = context.dom
var kb = context.session.store
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
File attachPane.js
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* Attachment Pane
**
** - Attach a document to a thing
** - View attachments
** - Look at all unattached Supporting Documents.
Function headerButtons
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var headerButtons = function (dom, labels, intial, callback) {
var head = dom.createElement('table')
var current = intial
head.setAttribute(
'style',
Function setAttachment
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var setAttachment = function (x, y, value, refresh) {
if (kb.holds(x, predicate, y) === value) return
var verb = value ? 'attach' : 'detach'
// complain("Info: starting to "+verb+" " + y.uri + " to "+x.uri+ ":\n")
var linkDone3 = function (uri, ok, body) {
Function getMembersAndSort
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var getMembersAndSort = function (subject) {
var sortBy = getSortKey(subject)
var u, x, key
var uriHash = kb.findMemberURIs(subject)
var pairs = []
Function showFiltered
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var showFiltered = function (mode) {
var filtered = mode === 0 ? objects : getFiltered()
// eslint-enable
UI.widgets.selectorPanelRefresh(
objectList,
Consider simplifying this complex logical expression. Open
Open
if (
t['http://www.w3.org/ns/pim/trip#Trip'] || // If in any subclass
subject.uri === 'http://www.w3.org/ns/pim/trip#Trip' ||
t['http://www.w3.org/2005/01/wf/flow#Task'] ||
t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] ||