Showing 337 of 337 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
module.exports = function (dom, kb, subject, messageStore, options) {
kb = kb || UI.store
messageStore = messageStore.doc() // No hash
var ns = UI.ns
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
- 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 3070.
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
module.exports = function (dom, kb, subject, messageStore, options) {
kb = kb || UI.store
messageStore = messageStore.doc() // No hash
var ns = UI.ns
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
- 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 3070.
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 renderTableViewPane
has a Cognitive Complexity of 376 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function renderTableViewPane (doc, options) {
var sourceDocument = options.sourceDocument
var tableClass = options.tableClass
var givenQuery = options.query
- 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 renderTableViewPane
has 1064 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function renderTableViewPane (doc, options) {
var sourceDocument = options.sourceDocument
var tableClass = options.tableClass
var givenQuery = options.query
File forms.js
has 1645 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* F O R M S
*
* A Vanilla Dom implementation of the form language
*/
Function notepad
has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring. Open
UI.pad.notepad = function (dom, padDoc, subject, me, options) {
options = options || {}
var exists = options.exists
var table = dom.createElement('table')
var kb = UI.store
- 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 infiniteMessageArea
has a Cognitive Complexity of 181 (exceeds 5 allowed). Consider refactoring. Open
export function infiniteMessageArea (dom, kb, chatChannel, options) {
kb = kb || UI.store
const ns = UI.ns
const WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
const DCT = $rdf.Namespace('http://purl.org/dc/terms/')
- 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 infiniteMessageArea
has 584 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function infiniteMessageArea (dom, kb, chatChannel, options) {
kb = kb || UI.store
const ns = UI.ns
const WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
const DCT = $rdf.Namespace('http://purl.org/dc/terms/')
Function notepad
has 580 lines of code (exceeds 25 allowed). Consider refactoring. Open
UI.pad.notepad = function (dom, padDoc, subject, me, options) {
options = options || {}
var exists = options.exists
var table = dom.createElement('table')
var kb = UI.store
File table.js
has 1075 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Table Widget: Format an array of RDF statements as an HTML table.
//
// This can operate in one of three modes: when the class of object is given
// or when the source document from whuch data is taken is given,
// or if a prepared query object is given.
File authn.ts
has 1031 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* signin.js
*
* Signing in, signing up, profile and preferences reloading
* Type index management
File buttons.js
has 853 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* UI Widgets such as buttons
*/
/* global alert */
const $rdf = require('rdflib')
Function matrixForQuery
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
module.exports.matrixForQuery = function (
dom,
query,
vx,
vy,
- 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
File pad.js
has 742 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** **************
* Notepad Widget
*/
/** @module UI.pad
Function exports
has 307 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (dom, kb, subject, messageStore, options) {
kb = kb || UI.store
messageStore = messageStore.doc() // No hash
var ns = UI.ns
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
Function exports
has 307 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (dom, kb, subject, messageStore, options) {
kb = kb || UI.store
messageStore = messageStore.doc() // No hash
var ns = UI.ns
var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
File infinite.js
has 645 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Common code for a discussion are a of messages about something
// This version runs over a series of files for different time periods
//
// Parameters for the whole chat like its title are stred on
// index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
Function tabWidget
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
UI.tabs.tabWidget = function (options) {
var kb = UI.store
var subject = options.subject
var dom = options.dom
var orientation = parseInt(options.orientation || '0')
- 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 makeSelectForOptions
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
forms.makeSelectForOptions = function (
dom,
kb,
subject,
predicate,
- 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 tabWidget
has 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
UI.tabs.tabWidget = function (options) {
var kb = UI.store
var subject = options.subject
var dom = options.dom
var orientation = parseInt(options.orientation || '0')