noomorph/github-user-rank-extension

View on GitHub

Showing 5 of 2,423 total issues

File language-colors.ts has 1378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Taken from: https://github.com/ozh/github-colors/blob/master/colors.json

export default {
    "1C Enterprise": {
        "color": "#814CCC", 
Severity: Major
Found in src/language-colors.ts - About 3 days to fix

    File browser.ts has 734 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Type definitions for WebExtensions
    // Project: https://developer.mozilla.org/en-US/Add-ons/WebExtensions
    // Definitions by: Yaroslav Serhieiev <https://github.com/noomorph>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    
    Severity: Major
    Found in src/external/browser.ts - About 1 day to fix

      Function init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function init(browser: Browser) {
          const queue = new Map<number, QueueItem>();
      
          browser.runtime.onMessage.addListener(function (message: messages.GUREBackgroundMessage, sender: browser.runtime.MessageSender /*, sendResponse: (response: any) => void */) {
              const item = queue.get(message.thread);
      Severity: Minor
      Found in src/content/utils/rpc.ts - About 1 hr to fix

        Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export function render(element: any): any {
            if (typeof element === 'string' || typeof element === 'number') {
                return document.createTextNode(String(element));
            }
        
        
        Severity: Minor
        Found in src/content/utils/h.ts - About 35 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

        Avoid too many return statements within this function.
        Open

            return el;
        Severity: Major
        Found in src/content/utils/h.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language