Showing 83 of 216 total issues
File VaultSource.ts
has 619 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import EventEmitter from "eventemitter3";
import { ChannelQueue } from "@buttercup/channel-queue";
import { Layerr } from "layerr";
import { Vault } from "./Vault.js";
import { Credentials } from "../credentials/Credentials.js";
File VaultFormatA.ts
has 483 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Layerr } from "layerr";
import { VaultFormat } from "./VaultFormat.js";
import { Vault } from "../core/Vault.js";
import { Credentials } from "../credentials/Credentials.js";
import {
VaultFormat
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VaultFormat extends EventEmitter {
static encodeRaw(rawContent: History, credentials: Credentials) {
notImplemented();
}
VaultFormatA
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VaultFormatA extends VaultFormat {
static async encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
const compress = getSharedAppEnv().getProperty("compression/v1/compressText");
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const masterPassword = getMasterPassword(credentials.id);
VaultFormatB
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VaultFormatB extends VaultFormat {
static encodeRaw(rawContent: History, credentials: Credentials): Promise<string> {
const compress = getSharedAppEnv().getProperty("compression/v2/compressText");
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const masterPassword = getMasterPassword(credentials.id);
File VaultFormatB.ts
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { ORPHANS_GROUP_TITLE, VaultFormat } from "./VaultFormat.js";
import { Vault } from "../core/Vault.js";
import { generateUUID } from "../tools/uuid.js";
import { getSharedAppEnv } from "../env/appEnv.js";
import { getMasterPassword } from "../credentials/memory/password.js";
Function consumeVaultFacade
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function consumeVaultFacade(
vault: Vault,
facade: VaultFacade,
options: ConsumeVaultFacadeOptions = {}
) {
VaultSource
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VaultSource extends EventEmitter {
static STATUS_LOCKED = VaultSourceStatus.Locked;
static STATUS_PENDING = VaultSourceStatus.Pending;
static STATUS_UNLOCKED = VaultSourceStatus.Unlocked;
Function describeVaultDataset
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function describeVaultDataset(
dataset: FormatAVault | FormatAGroup,
parentGroupID: GroupID
): History {
const isVault = typeof (<FormatAVault>dataset).format === "string";
Function buildClient
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function buildClient(token: string) {
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
return {
readdir: (remotePath, callback) => {
Function describeVaultDataset
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
export function describeVaultDataset(
dataset: FormatAVault | FormatAGroup,
parentGroupID: GroupID
): History {
const isVault = typeof (<FormatAVault>dataset).format === "string";
- 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 commands.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
findEntryByID,
findGroupByID,
findGroupContainingEntryID,
findGroupContainingGroupID,
Function unlock
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async unlock(vaultCredentials: Credentials, config: VaultSourceUnlockOptions = {}) {
if (!Credentials.isCredentials(vaultCredentials)) {
throw new Layerr(
`Failed unlocking source: Invalid credentials passed to source: ${this.id}`
);
File VaultManager.ts
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import EventEmitter from "eventemitter3";
import { Layerr } from "layerr";
import isPromise from "is-promise";
import { ChannelQueue } from "@buttercup/channel-queue";
import { MemoryStorageInterface } from "../storage/MemoryStorageInterface.js";
Function generateVaultInsights
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function generateVaultInsights(vault: Vault): VaultInsights {
let groupCount = 0,
entryCount = 0,
trashEntryCount = 0,
trashGroupCount = 0,
Vault
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Vault extends EventEmitter {
static Attribute = Object.freeze({
AttachmentsKey: "BC_ATTACHMENTS_KEY"
});
VaultManager
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VaultManager extends EventEmitter {
/**
* Key prefix for stored vaults
* @static
* @memberof VaultManager
Function mergeRawVaults
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mergeRawVaults(base: FormatBVault, incoming: FormatBVault): FormatBVault {
const newVault: FormatBVault = {
id: base.id,
a: mergeProperties(base.a, incoming.a, EntryPropertyType.Attribute),
g: [],
Function createCreditCardFields
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createCreditCardFields(entry: Entry): Array<EntryFacadeField> {
return [
...createBaseFields(entry),
createFieldDescriptor(entry, "Card Holder", EntryPropertyType.Property, "username"),
createFieldDescriptor(entry, "Card Number", EntryPropertyType.Property, "password", {
Function searchByURL
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
searchByURL(url: string): Array<SearchResult> {
const incomingDomain = extractDomain(url);
if (!incomingDomain) {
this._results = [];
return this._results;
- 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"