Showing 5 of 2,423 total issues
File language-colors.ts
has 1378 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Taken from: https://github.com/ozh/github-colors/blob/master/colors.json
export default {
"1C Enterprise": {
"color": "#814CCC",
File browser.ts
has 734 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Function init
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
export function render(element: any): any {
if (typeof element === 'string' || typeof element === 'number') {
return document.createTextNode(String(element));
}
- 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
Avoid too many return
statements within this function. Open
Open
return el;