Showing 201 of 626 total issues
Function get
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async get(address: string): Promise<Place | undefined> {
let place = this.cache.get(address)
if (!place) {
place = await this.create(address)
if (place) {
- 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 createInternal
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async createInternal(context: HtmlRR0SsgContext, href: string): Promise<Source> {
if (path.dirname(href).startsWith("/")) {
href = href.substring(1)
}
const hashPos = href.lastIndexOf("#")
- 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 createReplacer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer> {
return {
replace: async (itemEl: HTMLElement) => {
if (itemEl.getAttribute("itemtype") === "https://schema.org/QuantitativeValue") {
const propEls = Array.from(itemEl.querySelectorAll("*[itemprop]"))
Function createFromFullName
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
createFromFullName(fullName: string): People {
let lastName: string
let firstNames: string[]
let commaPos = fullName.indexOf(",")
if (commaPos > 0) {
Function map
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
map(context: HtmlRR0SsgContext, sourceCase: UrecatCase, sourceTime: Date): RR0CaseSummary {
const caseSource: Source = {
events: [], previousSourceRefs: [],
url: sourceCase.url, title: "cas n° " + sourceCase.id, authors: this.authors,
publication: {publisher: this.copyright, time: TimeContext.fromDate(sourceTime)}
Function gradientDescentStep
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
NN_trainer.prototype.gradientDescentStep = function (number_of_steps) {
// I probably shouldn't do this. I started doing feature normalization so we can keep to one learning rate.
// I decided to do it this way to maintain narrative continuity.
this.learningRate = 0.00000001;
Function aggregate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async aggregate(context: HtmlRR0SsgContext, element: HTMLUListElement) {
const existingCases: RR0CaseSummary[] = []
const casesToAdd: RR0CaseSummary[] = []
for (const mapping of this.mappings) {
const datasource = mapping.datasource
Function asyncFunctionWrapper
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function asyncFunctionWrapper (target, ...args) {
if (args.length < metadata.minArgs) {
throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`)
}
if (args.length > metadata.maxArgs) {
Function handleImage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleImage(context: HtmlRR0SsgContext, imageUrl: string) {
const inputFile = context.file.name
if (imageUrl) {
const isLocal = !imageUrl.startsWith("http")
if (isLocal) {
Function f
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
d3.f = function () {
var functions = arguments
//convert all string arguments into field accessors
var i = 0, l = functions.length
while (i < l) {
Function f
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
d3.f = function () {
var functions = arguments
//convert all string arguments into field accessors
var i = 0, l = functions.length
while (i < l) {
Function renderContent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderContent(context: HtmlRR0SsgContext, previousContext: RR0SsgContext, options: TimeRenderOptions,
renderOptions: Intl.DateTimeFormatOptions = this.textBuilder.options): {
result: HTMLElement,
replacement: HTMLElement
} {
Function createReplacer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer> {
const doc = context.file.document
return new class implements DomReplacer {
async replace(original: HTMLElement): Promise<HTMLElement> {
if (!original.hasChildNodes()) {
Function reluGraph
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
var reluGraph = function (containerElement, xStart, xEnd, xDefault, sliderElement, reluInputElement,
reluFormulaInputElement, reluResult, reluGraphResult) {
Function sigmoidGraph
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
var sigmoidGraph = function (containerElement, xStart, xEnd, xDefault, sliderElement, sigmoidInputElement,
sigmoidFormulaInputElement, sigmoidResult, sigmoidGraphResult) {
Function getInfoStr
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
getInfoStr(context: HtmlRR0SsgContext) {
const authors = context.file.meta.author
const authorsStr = authors && authors.length > 0 ? authors.join(" & ") : ""
let timeStr = ""
Function prev
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
prev(context: HtmlRR0SsgContext): Link | undefined {
let fileName = context.file.name
if (this.isTimeFile(fileName)) {
const pos = this.timeFiles.indexOf(fileName);
if (pos >= 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 removeIndent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected removeIndent(lines: string[]) {
let minIndent = Number.MAX_VALUE;
for (const line of lines) {
if (line.length > 0) {
let i = 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 createReplacer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<RegexReplacer> {
return {
replace: (_match: string, ..._args: any[]): string => {
const file = context.file
let authors = file.meta.author
- 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 createFromFullName
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
createFromFullName(fullName: string): People {
let lastName: string
let firstNames: string[]
let commaPos = fullName.indexOf(",")
if (commaPos > 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"