Showing 337 of 337 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
() => this.addAgent(ns.foaf('Agent').uri)
.then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))
.then(() => this.renderCleanup()))
- 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 69.
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 columnNumberFor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var columnNumberFor = function (x1) {
var xNT = x1.toNT() // xNT is a NT string
var col = null
// These are data columns (not headings)
for (var i = 0; i < columns.length; i++) {
Function registrationList
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function registrationList (context: AuthenticationContext, options: {
private?: boolean
public?: boolean
}): Promise<AuthenticationContext> {
const dom = context.dom as HTMLDocument
Function makeSelectForCategory
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
forms.makeSelectForCategory = function (
dom,
kb,
subject,
category,
Function loadMoreWhereNeeded
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function loadMoreWhereNeeded (event, fixScroll) {
if (lock) return
lock = true
const freeze = !fixScroll
const magicZone = 150
Function makeSelectForNestedCategory
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
forms.makeSelectForNestedCategory = function (
dom,
kb,
subject,
category,
Function selectorPanelRefresh
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
buttons.selectorPanelRefresh = function (
list,
dom,
kb,
type,
- 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 SubjectType
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SubjectType (type) {
this.type = type
this.columns = null
this.allColumns = null
this.useCount = 0
Function renderNumberSelector
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderNumberSelector (rows, columns, column) {
var result = doc.createElement('div')
var minSelector = doc.createElement('input')
minSelector.setAttribute('type', 'text')
Function renderValue
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderValue (obj, column) {
// hint
var hints = getHints(column)
var cellFormat = hints.cellFormat
if (cellFormat) {
Function adoptACLDefault
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function adoptACLDefault (
doc: $rdf.NamedNode,
aclDoc: $rdf.NamedNode,
defaultResource: $rdf.NamedNode,
defaultACLdoc: $rdf.NamedNode
Function removePart
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var removePart = function (part) {
var chunk = part.subject
if (!chunk) throw new Error('No chunk for line to be deleted!') // just in case
var prev = kb.any(undefined, PAD('next'), chunk)
var next = kb.any(chunk, PAD('next'))
Function loadIndex
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function loadIndex (
context: AuthenticationContext,
predicate: $rdf.NamedNode,
isPublic: boolean
): Promise<AuthenticationContext> {
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (
statement.predicate.termType === 'NamedNode' &&
statement.subject.termType === 'Variable'
) {
const variable = statement.subject.toString()
- 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 65.
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
if (
statement.predicate.termType === 'NamedNode' &&
statement.object.termType === 'Variable'
) {
var variable = statement.object.toString()
- 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 65.
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 renderPartipants
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
UI.pad.renderPartipants = function (dom, table, padDoc, subject, me, options) {
table.setAttribute('style', 'margin: 0.8em;')
var newRowForParticpation = function (parp) {
var person = kb.any(parp, ns.wf('participant'))
Function getACL
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getACL (
doc: $rdf.NamedNode,
callbackFunction: (
ok: boolean,
messageOrStatus: number | string,
Function createIfNotExists
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createIfNotExists (doc) {
return new Promise(function (resolve, reject) {
kb.fetcher.load(doc).then(
response => {
console.log('createIfNotExists doc exists, all good ' + doc)
Function syncMessages
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function syncMessages (about, messageTable) {
var displayed = {}
var ele, ele2
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
if (ele.AJAR_subject) {
Function makeNewSlot
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var makeNewSlot = function (item) {
var ele = dom.createElement(tabElement)
ele.subject = item
var div = ele.appendChild(dom.createElement('div'))
div.setAttribute('style', unselectedStyle)