Showing 216 of 216 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
Object.keys(existingAttributes)
.filter((attr) => !attributes.hasOwnProperty(attr))
.forEach((attr) => {
// Remove missing
group.deleteAttribute(attr);
- 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 62.
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
Object.keys(currentAttributes)
.filter((attr) => !attributes.hasOwnProperty(attr))
.forEach((attr) => {
// Remove missing
vault.deleteAttribute(attr);
- 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 62.
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 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 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 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 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"
Further reading
Function changeMasterPassword
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async changeMasterPassword(
oldPassword: string,
newPassword: string,
meta: { [key: string]: any } = {}
) {
- 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 2 locations. Consider refactoring. Open
} else if (preference === EntryURLType.Login) {
const login = /login/i;
const aVal = login.test(a) ? 1 : 0;
const bVal = login.test(b) ? 1 : 0;
return bVal - aVal;
- 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 60.
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 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 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (preference === EntryURLType.General) {
const general = /^ur[li]$/i;
const aVal = general.test(a) ? 1 : 0;
const bVal = general.test(b) ? 1 : 0;
return bVal - aVal;
- 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 60.
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 smartStripRemovedAssets
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function smartStripRemovedAssets(history: History): History {
const deletedEntries: Set<string> = new Set([]);
const deletedGroups: Set<string> = new Set([]);
return history.filter((line) => {
const [command, ...args] = line.split(/\s/g);
Function getEntryURLs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getEntryURLs(
properties: { [key: string]: string },
preference: EntryURLType = EntryURLType.Any
): Array<string> {
const urlRef = Object.keys(properties)
Function _executeCommand
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_executeCommand(command: string) {
let currentCommand = command,
shareID = null;
if (SHARE_COMMAND_EXP.test(currentCommand)) {
const shareMatch =
Function different
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function different(object1: Object, object2: Object): boolean {
if (Array.isArray(object1) && Array.isArray(object2)) {
let differs = object1.some(function (item1) {
return !object2.some(function (item2) {
return different(item1, item2) === false;
Function interruptAutoUpdate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
interruptAutoUpdate(cb: InterruptedAutoUpdateFunction) {
return this.enqueueStateChange(NOOP).then(() =>
this._queue.channel("autoUpdateInterrupt").enqueue(() => {
const enabled = this._autoUpdateEnabled;
const delay = this._autoUpdateDelay;
Similar blocks of code found in 2 locations. Consider refactoring. Open
findGroupByID(id: GroupID): null | Group {
return this._groups.find((group) => group.id === id) || null;
}
- 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 59.
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
findEntryByID(id: EntryID): null | Entry {
return this._entries.find((entry) => entry.id === id) || null;
}
- 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 59.
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 consumeEntryFacade
has 29 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 extractEntries
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function extractEntries(
facade: VaultFacade,
memory: StorageInterface
): Promise<Array<ProcessedSearchEntry>> {
// Get scores