Showing 49 of 101 total issues
Function readNextToken
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
readNextToken() {
if (this.pos >= this.str.length) return null;
let c = this.str.charAt(this.pos);
if (Lexer.isWhiteSpace(c)) return this.getWhiteSpace(c);
- 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 parser.js
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
function id(x) {return x[0]; }
var isNumber = function(x) {return x.constructor === Number || (typeof x== 'object'&&x.type == 'number')};
var tok_id = {test: function(x) {return typeof x === 'object' && x.type=='id'; }}
var entry_type_bib = {test: function(x) {return typeof x === 'object' && x.type=='@bib'; }}
Function renderPublicationDetailsToHtml
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function renderPublicationDetailsToHtml(item: BibliographyItem, plusChapterOrPageNumbers: boolean = false): string {
const parts: string[] = [];
if (item.address) {
parts.push(span("_bib_publication_address", htmlPropsPublicationLocation, item.address));
- 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 renderPublicationDetailsToHtml
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function renderPublicationDetailsToHtml(item: BibliographyItem, plusChapterOrPageNumbers: boolean = false): string {
const details: string[] = [];
if(item.address) {
details.push(span("_bib_publication_address", htmlPropsPublicationLocation, item.address));
- 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 pushJournalIssueDetails
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
let pushJournalIssueDetails = function (item: BibliographyItem, journalId: string | undefined, journalParts: string[]) {
const year = item['year'];
const volume = item['volume'];
const number = item['number'];
const pages = item['pages'];
- 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 pushJournalIssueDetails
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
let pushJournalIssueDetails = function (item: BibliographyItem, journalId: string | undefined, journalParts: string[]) {
const year = item['year'];
const volume = item['volume'];
const number = item['number'];
const pages = item['pages'];
- 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 resolveStringDeclarations
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static resolveStringDeclarations(referenceStack, wrapper, compiledSoFar, rawStrings) {
if (wrapper.type == 'quotedstringwrapper') {
return new StringValue({
type: wrapper.type,
data: wrapper.data.map((strObj) => {
- 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 computeUnicodeString
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
static computeUnicodeString(braceDepth, obj) {
//console.log(braceDepth, JSON.stringify(obj));
if (typeof obj === 'string') return obj;
else if (obj.constructor == Array) return obj.map(o => {
if (!o) throw new Error("Expected non-null elements in " + JSON.stringify(o));
- 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 renderAuthors
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
renderAuthors(obj) {
const children = [];
if (!obj.fields.author) throw new Error("Entry with id " + obj.id + " did not have author set.");
const authors = obj.fields.author.getAuthors();
- 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 readNextToken
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
readNextToken() {
if (this.pos >= this.str.length) return null;
let c = this.str.charAt(this.pos);
if (Lexer.isWhiteSpace(c)) return this.getWhiteSpace(c);
Function flatten
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function flatten(obj) {
if (typeof obj === 'object' &&
(obj.type == 'quotedstring' ||
obj.type == 'quotedstringwrapper' ||
obj.type == 'bracedstringwrapper')
- 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 stringifyLaTeXInner
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function stringifyLaTeXInner(tex: LaTeX | TeXArg, soFar: string[]): void {
if (isTeXComm(tex)) {
soFar.push("\\", tex.name);
tex.arguments.forEach(l => stringifyLaTeXInner(l, soFar));
}
- 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 vonLastJrFirst
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function vonLastJrFirst(authorTokens) {
let commaPos = -1;
for (let i = 0; i < authorTokens.length; i++)
if (authorTokens[i].type == ',') {
commaPos = i;
- 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 stringifyLaTeXInner
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stringifyLaTeXInner(tex: LaTeX | TeXArg, soFar: string[]): void {
if (isTeXComm(tex)) {
soFar.push("\\", tex.name);
tex.arguments.forEach(l => stringifyLaTeXInner(l, soFar));
}
Function getFirstLetter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const getFirstLetter = function (wordObj) {
if (typeof wordObj === 'string') {
if (wordObj.length > 1 && wordObj.charAt(0) == '/') return wordObj.charAt(1);
else if (wordObj.length > 0) return wordObj.charAt(0);
else return null;
- 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 vonLastJrFirst
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function vonLastJrFirst(authorTokens) {
let commaPos = -1;
for (let i = 0; i < authorTokens.length; i++)
if (authorTokens[i].type == ',') {
commaPos = i;
Function processSpecialChars
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processSpecialChars(words) {
return words.map(word=> {
if (word.constructor == Array) {
return word.map(wordSegment => {
if (wordSegment.type == 'braced'
Function computeUnicodeString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static computeUnicodeString(braceDepth, obj) {
//console.log(braceDepth, JSON.stringify(obj));
if (typeof obj === 'string') return obj;
else if (obj.constructor == Array) return obj.map(o => {
if (!o) throw new Error("Expected non-null elements in " + JSON.stringify(o));
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
const obj = this.props.entry;
const isEntry = obj instanceof Entry;
if (!isEntry) throw new Error("Object must be of type Entry: " + JSON.stringify(obj));
- 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 concatStrings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function concatStrings(array) {
const words = [];
for (let i = 0; i < array.length; i++) {
const obj = array[i];
if (obj == ',') words.push({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"