Showing 98 of 283 total issues
Function getDirectChild
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getDirectChild(name: string): Promise<Child | null> {
let child = null
if (this.children[ name ]) {
return this.children[ name ]
- 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 privateNode
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
crypto: Crypto.Implementation,
depot: Depot.Implementation,
manners: Manners.Implementation,
reference: Reference.Implementation,
rootTree: RootTree,
Function findBareNameFilter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function findBareNameFilter(
crypto: Crypto.Implementation,
storage: Storage.Implementation,
accountDID: string,
map: Record<string, PrivateNode>,
- 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 linkDevice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const linkDevice = async (
auth: Auth.Implementation<Components>,
crypto: Crypto.Implementation,
sessionKey: Uint8Array,
username: 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
Function getNode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
crypto: Crypto.Implementation,
depot: Depot.Implementation,
manners: Manners.Implementation,
reference: Reference.Implementation,
mmpt: MMPT,
Function findLatestRevision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const findLatestRevision = async (
crypto: Crypto.Implementation,
mmpt: MMPT,
bareName: BareNameFilter,
key: Uint8Array,
- 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 getDirectChild
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getDirectChild(name: string): Promise<PrivateTree | PrivateFile | null> {
let child = null
if (this.children[ name ]) {
return this.children[ name ]
- 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 deeply nested control flow statements. Open
if (ls.sessionKey) {
await declineDelegation(dependencies.crypto, ls.sessionKey, finishDelegation)
} else {
handleLinkingError(new LinkingError("Producer missing session key when declining account delegation"))
}
Function sharePrivate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async sharePrivate(paths: Path.Distinctive<Path.PartitionedNonEmpty<Path.Private>>[], { sharedBy, shareWith }: { sharedBy?: SharedBy; shareWith: string | string[] }): Promise<ShareDetails> {
const verifiedPaths = paths.filter(path => {
return Path.isOnRootBranch(Path.RootBranch.Private, path)
})
- 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 deeply nested control flow statements. Open
if (ls.sessionKey) {
await delegateAccount(
dependencies.auth,
dependencies.crypto,
ls.sessionKey,
Function request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function request(
endpoints: Fission.Endpoints,
dependencies: Dependencies,
options: RequestOptions = {}
): 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 findBareNameFilter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
crypto: Crypto.Implementation,
storage: Storage.Implementation,
accountDID: string,
map: Record<string, PrivateNode>,
path: DistinctivePath<Path.Segments>
Function createAndConnect
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dependencies: Dependencies,
pkg: IPFSPackage,
peersUrl: string,
repoName: string,
logging: boolean
Function decodeCID
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function decodeCID(val: CID | object | string): CID {
const cid = CID.asCID(val)
if (cid) return cid
// String format
- 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 rmRecurse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async rmRecurse(path: Path, onUpdate: Maybe<UpdateCallback>): Promise<this> {
const [ head, ...nextPath ] = path
if (!head) {
throw new Error("Invalid path: empty")
- 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 report
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function report(peer: Multiaddr, status: Status): void {
peerConnections = peerConnections
.filter(connection => connection.peer !== peer)
.concat({ peer, status })
- 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 child
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
if (!check.isPrivateTreeInfo(reloadedNode)) return null
Avoid too many return
statements within this function. Open
if (nextChild !== undefined) return this.getRecurse(nextChild, rest)