Showing 83 of 216 total issues
File tools.ts
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { encodeStringValue } from "../../tools/encoding.js";
import { generateUUID } from "../../tools/uuid.js";
import {
EntryLegacyHistoryItem,
EntryID,
Entry
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class Entry extends VaultItem {
static Attributes = Object.freeze({
AttachmentPrefix: "BC_ENTRY_ATTACHMENT:",
FacadeType: "BC_ENTRY_FACADE_TYPE",
FieldTypePrefix: "BC_ENTRY_FIELD_TYPE:",
Function findEntryByID
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function findEntryByID(groups: Array<FormatAGroup>, id: EntryID) {
for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
const group = groups[i];
if (group.entries) {
for (let j = 0, entriesLen = group.entries.length; j < entriesLen; j += 1) {
- 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 findGroupContainingEntryID
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function findGroupContainingEntryID(groups: Array<FormatAGroup>, id: EntryID) {
for (let i = 0, groupsLen = groups.length; i < groupsLen; i += 1) {
const group = groups[i];
if (group.entries) {
for (var j = 0, entriesLen = group.entries.length; j < entriesLen; j += 1) {
- 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 vault.ts
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { consumeEntryFacade, createEntryFacade } from "./entry.js";
import { idSignifiesNew } from "./tools.js";
import { FACADE_VERSION } from "./symbols.js";
import { Entry } from "../core/Entry.js";
import { Group } from "../core/Group.js";
Function searchByURL
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
searchByURL(url: string): Array<SearchResult> {
const incomingDomain = extractDomain(url);
if (!incomingDomain) {
this._results = [];
return this._results;
Function calculateCommonRecentCommand
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function calculateCommonRecentCommand(
historyA: History,
historyB: History
): CommonRecentCommandResult | null {
const getCommandType = (fullCommand) =>
- 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 changeMasterPassword
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async changeMasterPassword(
oldPassword: string,
newPassword: string,
meta: { [key: string]: any } = {}
) {
Function valuesDiffer
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function valuesDiffer(value1: FormatBValue, value2: FormatBValue): boolean {
if ((!value1 && value2) || (value1 && !value2)) return true;
for (const prop of ["value", "created", "updated"]) {
if (value1[prop] !== value2[prop]) return 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 createEntryFacade
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createEntryFacade(
entry?: Entry,
options: CreateEntryFacadeOptions = {}
): EntryFacade {
if (entry && entry instanceof Entry !== true) {
Function setAttachment
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async setAttachment(
entry: Entry,
attachmentID: string,
attachmentData: Buffer | ArrayBuffer,
name: string,
Function optimise
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
optimise() {
// Initialise first
this.initialise();
// Clean up orphans
{
- 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 mergeRawVaults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function mergeRawVaults(base: FormatBVault, incoming: FormatBVault): FormatBVault {
const newVault: FormatBVault = {
id: base.id,
a: mergeProperties(base.a, incoming.a, EntryPropertyType.Attribute),
g: [],
- 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 optimise
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
optimise() {
// Initialise first
this.initialise();
// Clean up orphans
{
Function save
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async save(config: VaultSourceSaveOptions = {}) {
const { storeOfflineCopy = true } = config;
await this._enqueueStateChange(async () => {
if (await this.localDiffersFromRemote()) {
await this.mergeFromRemote();
Function localDiffersFromRemote
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
localDiffersFromRemote(): Promise<boolean> {
if (this.status !== VaultSource.STATUS_UNLOCKED) {
return Promise.reject(
new Layerr(
`Failed diffing source: Source not unlocked (${this.status}): ${this.id}`
Function writeFile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
writeFile: (remotePath, data, options, callback) => {
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const cb = typeof options === "function" ? options : callback;
if (typeof data !== "string") {
throw new Error("Failed writing file: Expected data to be of type string");
Function findEntriesByTag
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
findEntriesByTag(tag: string, exact: boolean = true): Array<Entry> {
const tagLower = tag.toLowerCase();
if (!exact) {
const entryIDs = new Set<string>();
for (const [currentTag, currentIDs] of this._tagMap.entries()) {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
findGroupContainingGroupID(id: GroupID): FormatAGroup {
const searchGroups = (groups: Array<FormatAGroup>): FormatAGroup => {
for (const group of groups) {
if (group.id === id) return null;
const children = group.groups || [];
- 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 consumeVaultFacade
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function consumeVaultFacade(
vault: Vault,
facade: VaultFacade,
options: ConsumeVaultFacadeOptions = {}
) {
- 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"