Function updateFileAsync
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
async updateFileAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'updateFileAsync')
const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!file) {
- 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 merge.js
has 702 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @module core/merge
* @flow
*/
Function putFolderAsync
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
async putFolderAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'putFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!folder) {
- 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 moveFileAsync
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
async moveFileAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */
) /*: Promise<*> */ {
- 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 updateFileAsync
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateFileAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'updateFileAsync')
const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!file) {
Function moveFolderRecursivelyAsync
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
async moveFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
- 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 moveFolderAsync
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async moveFolderAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
- 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 deleteFolderAsync
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
async deleteFolderAsync(side /*: SideName */, doc /*: SavedMetadata */) {
log.debug({ path: doc.path }, 'deleteFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.byIdMaybe(doc._id)
if (!folder) {
- 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 putFolderAsync
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
async putFolderAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'putFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!folder) {
Function moveFileAsync
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFileAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */
) /*: Promise<*> */ {
Function moveFolderAsync
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFolderAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
Function moveFolderRecursivelyAsync
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
Function putFolderRecursivelyAsync
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async putFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */
) {
- 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 trashFileAsync
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async trashFileAsync(
side /*: SideName */,
trashed /*: SavedMetadata */,
doc /*: Metadata */
) /*: Promise<void> */ {
- 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 deleteFolderAsync
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async deleteFolderAsync(side /*: SideName */, doc /*: SavedMetadata */) {
log.debug({ path: doc.path }, 'deleteFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.byIdMaybe(doc._id)
if (!folder) {
Function doTrash
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async doTrash(
side /*: SideName */,
was /*: SavedMetadata */,
doc /*: Metadata */
) /*: Promise<void> */ {
Function doTrash
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async doTrash(
side /*: SideName */,
was /*: SavedMetadata */,
doc /*: Metadata */
) /*: Promise<void> */ {
- 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 trashFileAsync
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async trashFileAsync(
side /*: SideName */,
trashed /*: SavedMetadata */,
doc /*: Metadata */
) /*: Promise<void> */ {
Function putFolderRecursivelyAsync
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async putFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */
) {
Avoid deeply nested control flow statements. Open
if (localWasVersioned) {
// We make sure Sync will overwrite the local update with the remote
// content.
metadata.markSide('remote', file, file)
file.local = doc.local
Avoid deeply nested control flow statements. Open
if (localWasVersioned) {
// We make sure Sync will overwrite the local update with the remote
// content.
metadata.markSide('remote', doc, file)
return this.save(doc)
Avoid deeply nested control flow statements. Open
if (!file.sides.remote) {
// When the updated side is missing on the existing record, it means
// we're simply linking two equivalent existing folders so we can
// mark the record as up-to-date.
metadata.markAsUpToDate(doc)
Avoid deeply nested control flow statements. Open
if (!folder.sides.remote) {
// When the updated side is missing on the existing record, it means
// we're simply linking two equivalent existing folders so we can
// mark the record as up-to-date.
metadata.markAsUpToDate(doc)
Avoid deeply nested control flow statements. Open
if (outdated) {
// In case a change was merged but not applied, we want to make sure
// Sync will compare the current record version with the correct
// "previous" version (i.e. the one before the actual change was
// merged and not the one before we merged the new local metadata).
Avoid deeply nested control flow statements. Open
if (localWasVersioned) {
doc.overwrite = file.overwrite || file
await this.pouch.eraseDocument(file)
return this.save(doc)
}
Avoid deeply nested control flow statements. Open
if (dstChild.overwrite) delete dstChild.overwrite
Avoid deeply nested control flow statements. Open
if (file.path === doc.path) {
doc.overwrite = file.overwrite || file
await this.pouch.eraseDocument(file)
}
Avoid deeply nested control flow statements. Open
if (outdated) {
// In case a change was merged but not applied, we want to make sure
// Sync will compare the current record version with the correct
// "previous" version (i.e. the one before the actual change was
// merged and not the one before we merged the new local metadata).
Function addFileAsync
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async addFileAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'addFileAsync')
const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (file) {
- 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 this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return this.doTrash(side, was, doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.moveFolderRecursivelyAsync(side, doc, was, newRemoteRevs)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(dst)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(file)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.addFileAsync(side, doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(file)
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return this.save(file)
Avoid too many return
statements within this function. Open
return
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return this.save(doc)
Avoid too many return
statements within this function. Open
return
Function deleteFileAsync
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async deleteFileAsync(side /*: SideName */, doc /*: SavedMetadata */) {
log.debug({ path: doc.path }, 'deleteFileAsync')
const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!file) {
- 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 (metadata.equivalent(doc, file)) {
log.info({ path: doc.path }, 'up to date')
if (side === 'local' && !metadata.sameLocal(file.local, doc.local)) {
if (!file.sides.local) {
// When the updated side is missing on the existing record, it means
- 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 298.
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
if (metadata.equivalent(folder, doc)) {
log.info({ path: doc.path }, 'up to date')
if (side === 'local' && !metadata.sameLocal(folder.local, doc.local)) {
if (!folder.sides.local) {
// When the updated side is missing on the existing record, it means
- 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 298.
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
if (folder.trashed) {
// If the existing record was marked for deletion, we only keep the
// PouchDB attributes that will allow us to overwrite it.
doc._id = folder._id
doc._rev = folder._rev
- 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 203.
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
if (file.trashed) {
// If the existing record was marked for deletion, we only keep the
// PouchDB attributes that will allow us to overwrite it.
doc._id = file._id
doc._rev = file._rev
- 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 203.
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
if (!was) {
log.debug(
{ path: oldpath },
'moved file missing from PouchDB. Adding at destination'
)
- 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 82.
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
if (!was) {
log.debug(
{ path: oldpath },
'moved folder missing from PouchDB. Adding at destination'
)
- 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 82.
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
if (file.remote) {
// In this case we can dissociate the local record from its remote
// counterpart that was just renamed and will be fetched later.
metadata.dissociateRemote(file)
// We make sure Sync will detect and propagate the local update
- 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 61.
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
if (file.local) {
// In this case we can dissociate the remote record from its local
// counterpart that was just renamed and will be merged later.
metadata.dissociateLocal(file)
// We make sure Sync will detect and propagate the remote update
- 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 61.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (movedChild.docType === metadata.FILE) {
await this.updateFileAsync(side, movedChild)
} else {
await this.putFolderAsync(side, movedChild)
}
- 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 51.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (movedChild.docType === metadata.FILE) {
await this.updateFileAsync(side, movedChild)
} else {
await this.putFolderAsync(side, movedChild)
}
- 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 51.
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
Identical blocks of code found in 4 locations. Consider refactoring. Open
if (idConflict) {
log.warn({ idConflict }, IdConflict.description(idConflict))
return this.resolveConflictAsync(side, doc)
}
- 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 45.
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
Identical blocks of code found in 4 locations. Consider refactoring. Open
if (idConflict) {
log.warn({ idConflict }, IdConflict.description(idConflict))
return this.resolveConflictAsync(side, doc)
}
- 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 45.
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
Identical blocks of code found in 4 locations. Consider refactoring. Open
if (idConflict) {
log.warn({ idConflict }, IdConflict.description(idConflict))
return this.resolveConflictAsync(side, doc)
}
- 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 45.
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
Identical blocks of code found in 4 locations. Consider refactoring. Open
if (idConflict) {
log.warn({ idConflict }, IdConflict.description(idConflict))
return this.resolveConflictAsync(side, doc)
}
- 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 45.
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