dopecodez/Wikipedia

View on GitHub

Showing 5 of 27 total issues

File page.ts has 495 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Minor
Found in source/page.ts - About 7 hrs to fix

    File index.ts has 368 lines of code (exceeds 250 allowed). Consider refactoring.
    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
    Severity: Minor
    Found in source/index.ts - About 4 hrs to fix

      File resultTypes.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      export interface wikiSearchResult {
        results: any[],
        suggestion: string
      }
      
      
      Severity: Minor
      Found in source/resultTypes.ts - About 3 hrs to fix

        Function page has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        wiki.page = async (title: string, pageOptions?: pageOptions): Promise<Page> => {
            try {
                if (pageOptions?.autoSuggest) {
                    title = await setTitleForPage(title);
                }
        Severity: Minor
        Found in source/index.ts - About 1 hr to fix

          Function page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          wiki.page = async (title: string, pageOptions?: pageOptions): Promise<Page> => {
              try {
                  if (pageOptions?.autoSuggest) {
                      title = await setTitleForPage(title);
                  }
          Severity: Minor
          Found in source/index.ts - About 45 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language