Showing 67 of 185 total issues
Function readFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
readFile: (remotePath, options, callback) => {
const encrypt = getSharedAppEnv().getProperty("crypto/v1/encryptText");
const decrypt = getSharedAppEnv().getProperty("crypto/v1/decryptText");
const cb = typeof options === "function" ? options : callback;
const url = joinURL(BASE_URL, "/get/file");
Function consumeEntryFacade
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function consumeEntryFacade(entry: Entry, facade: EntryFacade) {
const facadeType = getEntryFacadeType(entry);
if (facade && facade.type) {
const properties = entry.getProperty();
const attributes = entry.getAttribute();
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 lock
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async lock() {
if (this.status !== VaultSource.STATUS_UNLOCKED) {
throw new Layerr(`Failed locking source: Source in invalid state (${this.status}): ${this.id}`);
}
await this._enqueueStateChange(async () => {
Function results
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const results = this._entries.reduce((output, entryItem) => {
let bestScore = Infinity;
const bestURL = entryItem.urls.reduce((best, next) => {
const thisDomain = extractDomain(next);
if (!thisDomain) return best;
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) {
throw new Error("Failed creating entry facade: Provided item is not an Entry");
}
const { type } = options;
- 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 valuesDiffer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function valuesDiffer(value1: FormatBValue, value2: FormatBValue): boolean {
for (const prop of ["value", "created", "updated"]) {
if (value1[prop] !== value2[prop]) return true;
}
if (value1.history.length !== value2.history.length) 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 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 moveTo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
moveTo(target: Group | Vault): this {
if (this.isTrash()) {
throw new Error("Trash group cannot be moved");
}
let targetVault, targetGroupID;
- 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 setEntryValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entry: Entry,
propertyType: EntryPropertyType,
property: string,
value: string,
valueType?: EntryPropertyValueType
Function executeSetEntryAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
entryID: EntryID,
attribute: string,
value: string
Function executeSetEntryProperty
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
entryID: EntryID,
property: string,
value: string
Function executeSetGroupAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
archive: FormatAVault,
opts: any,
groupID: GroupID,
attribute: string,
value: string
Function createFieldDescriptor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entry: Entry | null,
title: string,
entryPropertyType: EntryPropertyType,
entryPropertyName: string,
options: CreateFieldDescriptorOptions = {}
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
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
Avoid too many return
statements within this function. Open
return 0;
Avoid too many return
statements within this function. Open
return true;