Showing 98 of 283 total issues
Function fromCID
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async fromCID({ accountDID, dependencies, cid, permissions }: {
accountDID: string
dependencies: Dependencies
cid: CID
permissions?: Permissions
Function symlink
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
async symlink(args: {
at: Path.Directory<Partitioned<Partition>>
referringTo: {
path: Path.Distinctive<Partitioned<Partition>>
username?: string
Function validatePermissions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function validatePermissions(
repo: Repository<Ucan.Ucan>,
{ app, fs, raw }: Permissions.Permissions
): Maybe<Ucan.Ucan> {
let ucan
- 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 implementation
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function implementation(
getIpfs: () => Promise<{ ipfs: IPFS, repo: IPFSRepo }>
): Promise<Implementation> {
return {
Function monitorBitswap
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function monitorBitswap(dependencies: Dependencies, ipfs: IPFS, peersUrl: string, verbose: boolean): Promise<void> {
const cidCount: { [ k: string ]: number } = {}
const seen: string[] = []
const peers = await listPeers(dependencies.storage, peersUrl)
Function handleMessage
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleMessage = async (event: MessageEvent): Promise<void> => {
const { data } = event
const message = data.arrayBuffer ? new TextDecoder().decode(await data.arrayBuffer()) : data
switch (ls.step) {
Function handleSessionKey
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handleSessionKey = async (
crypto: Crypto.Implementation,
temporaryRsaPrivateKey: CryptoKey,
data: string
): Promise<Result<Uint8Array, Error>> => {
Function session
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function session(
components: Components,
authedUsername: Maybe<string>,
config: Configuration,
eventEmitters: { fileSystem: Events.Emitter<Events.FileSystem>; session: Events.Emitter<Events.Session<Session>> }
Function handleSessionKey
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const handleSessionKey = async (
crypto: Crypto.Implementation,
temporaryRsaPrivateKey: CryptoKey,
data: string
): Promise<Result<Uint8Array, Error>> => {
- 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 loadShare
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async loadShare({ shareId, sharedBy }: { shareId: string; sharedBy: string }): Promise<UnixTree> {
const ourExchangeDid = await DID.exchange(this.dependencies.crypto)
const theirRootDid = await this.dependencies.reference.didRoot.lookup(sharedBy)
// Share key
Function getClassifiedViaPostMessage
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getClassifiedViaPostMessage(
endpoints: Fission.Endpoints,
crypto: Crypto.Implementation
): Promise<LobbyClassifiedInfo> {
const didExchange = await DID.exchange(crypto)
Function getRecurse
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async getRecurse(
nodeInfo: PrivateSkeletonInfo | SoftLink,
parts: string[]
): Promise<PrivateTree | PrivateFile | null> {
const [ head, ...rest ] = parts
- 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 fromCID
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
static async fromCID({ accountDID, dependencies, cid, permissions }: {
accountDID: string
dependencies: Dependencies
cid: CID
permissions?: Permissions
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const linkDevice = async (
auth: Auth.Implementation<Components>,
crypto: Crypto.Implementation,
sessionKey: Uint8Array,
username: string,
Function build
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function build({
addSignature = true,
audience,
dependencies,
facts = [],
- 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 loadShare
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async loadShare({ shareId, sharedBy }: { shareId: string; sharedBy: string }): Promise<UnixTree> {
const ourExchangeDid = await DID.exchange(this.dependencies.crypto)
const theirRootDid = await this.dependencies.reference.didRoot.lookup(sharedBy)
// Share key
- 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 session
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function session(
components: Components,
authedUsername: Maybe<string>,
config: Configuration,
eventEmitters: { fileSystem: Events.Emitter<Events.FileSystem>; session: Events.Emitter<Events.Session<Session>> }
- 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 request
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function request(
endpoints: Fission.Endpoints,
dependencies: Dependencies,
options: RequestOptions = {}
): Promise<void> {
Function addPrivateLogEntry
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async addPrivateLogEntry(depot: Depot.Implementation, cid: CID): Promise<void> {
const log = [ ...this.privateLog ]
let idx = Math.max(0, log.length - 1)
// get last chunk
Function putLinks
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const putLinks = async (
depot: Depot.Implementation,
links: Links | SimpleLinks
): Promise<Depot.PutResult> => {
const dagLinks = Object