Showing 5 of 27 total issues
File page.ts
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { categoriesError, contentError, coordinatesError, htmlError, imageError, wikiError, pdfError,
infoboxError, introError, linksError, mediaError, preloadError, relatedError, summaryError, citationError } from './errors';
import request, { makeRestRequest, returnRestUrl } from './request';
import { coordinatesResult, imageResult, langLinksResult, notFound, pageResult, relatedResult, wikiMediaResult, wikiSummary } from './resultTypes';
import { setPageId, setPageIdOrTitleParam } from './utils';
File index.ts
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import request, { makeRestRequest, setAPIUrl, setUserAgent } from './request'
import { pageOptions, searchOptions, geoOptions, listOptions, eventOptions, fcOptions, randomFormats, pdfOptions, citationFormat, autocompletionOptions } from './optionTypes';
import Page, {
intro, images, html, content, categories, links, coordinates, langLinks,
references, infobox, tables, summary, related, media, mobileHtml, pdf, citation
File resultTypes.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
export interface wikiSearchResult {
results: any[],
suggestion: string
}
Function page
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
wiki.page = async (title: string, pageOptions?: pageOptions): Promise<Page> => {
try {
if (pageOptions?.autoSuggest) {
title = await setTitleForPage(title);
}
Function page
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
wiki.page = async (title: string, pageOptions?: pageOptions): Promise<Page> => {
try {
if (pageOptions?.autoSuggest) {
title = await setTitleForPage(title);
}
- 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"