Showing 83 of 216 total issues
Function consumeGroupFacade
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function consumeGroupFacade(group: Group, facade: GroupFacade) {
const { id, title, type, attributes } = facade;
const existingAttributes = group.getAttribute();
if (type !== "group") {
throw new Error(`Failed consuming group facade: Invalid facade type: ${type}`);
Function historiesDiffer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function historiesDiffer(historyA: History, historyB: History) {
const vaultA = inflateHistory(historyA);
const vaultB = inflateHistory(historyB);
if (vaultA.e.length !== vaultB.e.length) return true;
if (vaultA.g.length !== vaultB.g.length) return true;
Function createEntryFacade
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function createEntryFacade(
entry?: Entry,
options: CreateEntryFacadeOptions = {}
): EntryFacade {
if (entry && entry instanceof Entry !== true) {
- 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 findGroupByCheck
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function findGroupByCheck(groups, checkFn) {
for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
if (checkFn(groups[i]) === true) {
return groups[i];
}
- 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 executeSetGroupAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
groupID: GroupID,
attribute: string,
value: string
Function executeSetEntryAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
entryID: EntryID,
attribute: string,
value: string
Function setEntryValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entry: Entry,
propertyType: EntryPropertyType,
property: string,
value: string,
valueType?: EntryPropertyValueType
Function createFieldDescriptor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entry: Entry | null,
title: string,
entryPropertyType: EntryPropertyType,
entryPropertyName: string,
options: CreateFieldDescriptorOptions = {}
Function executeSetEntryProperty
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
entryID: EntryID,
property: string,
value: string
Function fromSecureString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static async fromSecureString(content: string, masterPassword: string): Promise<Credentials> {
const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
const decryptedContent = await decrypt(unsignEncryptedContent(content), masterPassword);
const credentialsData = JSON.parse(decryptedContent);
// Handle compatibility updates for legacy credentials
- 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 flatten
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
flatten(force: boolean = false): boolean {
const history = this.format.history;
const preservedLines = [];
const tempFormat = new VaultFormatA();
let availableLines = history.length - Flattener.PRESERVE_LINES;
- 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 findGroupContainingGroupID
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function findGroupContainingGroupID(group: FormatAGroup | FormatAVault, id: GroupID) {
const groups = group.groups || [];
for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
if (groups[i].id === id) {
return {
- 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 getEntryFacadePath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getEntryFacadePath(entryID: EntryID, facade: VaultFacade): Array<GroupID> {
const entry = facade.entries.find((entry) => entry.id === entryID);
if (!entry) {
throw new Error(`No entry facade found for ID: ${entryID}`);
}
- 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
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return 0;
Avoid too many return
statements within this function. Open
return true;
Function prepare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async prepare(): Promise<void> {
this._entries = [];
this._scores = {};
for (const target of this._targets) {
// Get scores
- 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 buildClient
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function buildClient(token: string) {
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
return {
readdir: (remotePath, callback) => {
- 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"