Showing 79 of 148 total issues
Function getExecutableArch
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getExecutableArch(
exeBytes: Uint8Array,
platform: string,
): string | undefined {
switch (platform) {
Function findUpgradeApp
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function findUpgradeApp(upgradeFrom: string): UpgradeAppInfo | null {
const searchDir = dirExists(upgradeFrom)
? upgradeFrom
: path.dirname(upgradeFrom);
log.debug(`Looking for old options file in ${searchDir}`);
Function _logger
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function _logger(
logFunc: (...args: unknown[]) => void,
level: loglevel.LogLevelNumbers,
...args: unknown[]
): void {
- 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 getLatestSafariVersion
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function getLatestSafariVersion(
url = SAFARI_VERSIONS_HISTORY_URL,
): Promise<SafariVersion> {
try {
log.debug('Grabbing apple version data from', url);
- 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 getDefaultWindowOptions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getDefaultWindowOptions(
options: WindowOptions,
): BrowserWindowConstructorOptions {
const browserwindowOptions: BrowserWindowConstructorOptions = {
...options.browserwindowOptions,
Function prepend
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepend: (actions: contextMenu.Actions, params: ContextMenuParams) => {
log.debug('contextMenu.prepend', { actions, params });
const items = [];
if (params.linkURL && window) {
items.push({
Function findSync
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findSync(
pattern: RegExp,
basePath: string,
limitSearchToDirectories = false,
): string[] {
Function getInfoPListOptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getInfoPListOptions(
appResourcesDir: string,
priorOptions: NativefierOptions,
): NativefierOptions {
if (!fileExists(path.join(appResourcesDir, '..', '..', 'Info.plist'))) {
- 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 createMainWindow
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export async function createMainWindow(
nativefierOptions: OutputOptions,
setDockBadge: (value: number | string, bounce?: boolean) => void,
): Promise<BrowserWindow> {
const options = { ...nativefierOptions };
- 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 prepareElectronApp
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function prepareElectronApp(
src: string,
dest: string,
options: AppOptions,
): Promise<void> {
Function submenu
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
bookmarksMenuConfig.bookmarks.map((bookmark) => {
switch (bookmark.type) {
case 'link':
if (!('title' in bookmark && 'url' in bookmark)) {
throw new Error(
Function injectCSSIntoResponse
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function injectCSSIntoResponse(
details: OnResponseStartedListenerDetails,
cssToInject: string,
): Promise<string | undefined> {
const contentType =
Function getChromeVersionForElectronVersion
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function getChromeVersionForElectronVersion(
electronVersion: string,
url = ELECTRON_VERSIONS_URL,
): Promise<string> {
if (!electronVersion || electronVersion === DEFAULT_ELECTRON_VERSION) {
Function findSyncRecurse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function findSyncRecurse(base): void {
let children: string[];
try {
children = fs.readdirSync(base);
} catch (err: unknown) {
Function linkIsInternal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function linkIsInternal(
currentUrl: string,
newUrl: string,
internalUrlRegex: string | RegExp | undefined,
isStrictInternalUrlsEnabled: boolean | undefined,
Function isUrlShellSafe
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function isUrlShellSafe(
urlToGo: string,
): { blocked: false } | { blocked: true; reason: string } {
let url: URL;
try {
Function injectCSS
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function injectCSS(browserWindow: BrowserWindow): void {
const cssToInject = getCSSToInject();
if (!cssToInject) {
return;
Function setupScreenSharePickerElement
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupScreenSharePickerElement(
id: string,
sources: Electron.DesktopCapturerSource[],
): void {
const selectionElem = document.createElement('div');
Function copyIconsIfNecessary
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function copyIconsIfNecessary(
options: AppOptions,
appPath: string,
): Promise<void> {
log.debug('Copying icons if necessary');
Function setupCloseEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupCloseEvent(options: OutputOptions, window: BrowserWindow): void {
window.on('close', (event: Event) => {
log.debug('mainWindow.close', event);
if (window.isFullScreen()) {
if (nativeTabsSupported()) {