Showing 1,356 of 1,356 total issues
Function format
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
public static format(...args: unknown[]): unknown[] {
if (args.length < 1) {
return args;
}
const firstArg = args.shift();
- 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 sync
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public async sync(): Promise<void> {
const [syncedIdentitiesData, syncedIdentityMap, identities] = await Promise.all([
this._syncedIdentitiesStorage.getAll(),
this._syncedIdentityMapStorage.getValue(),
contextualIdentityFactory.getAll(),
- 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 constructor
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor() {
super();
this.attachShadow({ mode: 'open' });
if (!this.shadowRoot) {
throw new Error('Shadow root is null');
Function constructor
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(contextualIdentity?: ContextualIdentity, parentTabGroupId?: string) {
super();
this._contextualIdentity = contextualIdentity;
this.attachShadow({ mode: 'open' });
if (!this.shadowRoot) {
Function sync
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async sync(): Promise<void> {
const [syncedIdentitiesData, syncedIdentityMap, identities] = await Promise.all([
this._syncedIdentitiesStorage.getAll(),
this._syncedIdentityMapStorage.getValue(),
contextualIdentityFactory.getAll(),
Function resetIndexTabs
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const resetIndexTabs = async (browserWindows: browser.Windows.Window[]) => {
const indexTabOption = await config['tab.groups.indexOption'].getValue();
if (indexTabOption == 'never') return;
const indexTabIds = new Set<number>();
const existingIndexTabIds = await indexTabService.getIndexTabIds();
- 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
File panel-windows.ts
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* -*- indent-tabs-mode: nil; tab-width: 2; -*- */
/* vim: set ts=2 sw=2 et ai : */
/**
Container Tab Groups
Copyright (C) 2023 Menhera.org
Function setupUaOverrides
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setupUaOverrides = (window: Window & typeof globalThis, navigatorPrototypeWrapped: any) => {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const windowWrapped = window.wrappedJSObject as any;
Similar blocks of code found in 2 locations. Consider refactoring. Open
element.addEventListener('dragover', (ev) => {
if (!ev.dataTransfer) return;
const json = ev.dataTransfer.getData('application/json');
if (!json) return;
const data = JSON.parse(json);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 122.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
tabElement.addEventListener('dragover', (ev) => {
if (!ev.dataTransfer) return;
const json = ev.dataTransfer.getData('application/json');
if (!json) return;
const data = JSON.parse(json);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 122.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function attachBrowserTab
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public async attachBrowserTab(tabId: number, attachInfo: browser.Tabs.OnAttachedAttachInfoType): Promise<void> {
if (null == this._params) return;
if (null == attachInfo.newWindowId) return;
const newWindowId = attachInfo.newWindowId;
let movedTab: browser.Tabs.Tab | null = null;
- 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 renderContainerWithTabs
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
public renderContainerWithTabs(windowId: number, displayedContainer: DisplayedContainer, tabs: CompatTab[], isPrivate = false, tabAttributeMap?: TabAttributeMap): MenulistContainerElement {
if (isPrivate && !displayedContainer.cookieStore.isPrivate) {
throw new Error('Cannot render container with tabs for private window with non-private container');
}
if (tabAttributeMap) {
Function getBrowserState
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public getBrowserState(params: BrowserStateConstructParams): BrowserStateDao {
const displayedContainers = [... params.displayedContainers];
params.tabGroupDirectorySnapshot.sortDisplayedContainers(displayedContainers);
const value: BrowserStateDao = {
currentWindowId: browser.windows.WINDOW_ID_NONE,
- 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 parse
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public parse(listing: string): PackageDirectory {
const JAR_SCHEME = 'jar:';
const lines = listing.split('\n').map(line => line.trim()).filter(line => line != '');
const packageDirectory: PackageDirectory = {
packageLocationUrl: "",
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
export const PrivateBrowsingButton = ({onClick}: {onClick?: () => void}) => {
const tooltipText = i18n.getMessage('privateBrowsing');
const iconUrl = '/img/firefox-icons/private-browsing-icon.svg';
return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={false}></Button>
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
export const CreateContainerButton = ({onClick}: {onClick?: () => void}) => {
const tooltipText = i18n.getMessage('buttonNewContainer');
const iconUrl = '/img/firefox-icons/plus.svg';
return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={true}></Button>
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
export const TemporatyContainerButton = ({onClick}: {onClick?: () => void}) => {
const tooltipText = i18n.getMessage('buttonNewTemporaryContainer');
const iconUrl = '/img/material-icons/timelapse.svg';
return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={true}></Button>
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 109.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File BrowserStateStore.ts
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* -*- indent-tabs-mode: nil; tab-width: 2; -*- */
/* vim: set ts=2 sw=2 et ai : */
/**
Container Tab Groups
Copyright (C) 2023 Menhera.org
Function build
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public build(): CtgFragmentElement {
const fragment = document.createElement('ctg-fragment') as CtgFragmentElement;
fragment.id = this.getFragmentId();
const helpBanner = new HelpBannerElement();
Function format
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static format(...args: unknown[]): unknown[] {
if (args.length < 1) {
return args;
}
const firstArg = args.shift();