OpenMarshal/npm-WebDAV-Server

View on GitHub

Showing 90 of 107 total issues

Function autoLoad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function autoLoad(callback : SimpleCallback)
{
    const options : IAutoLoad = this.options.autoLoad || {};
    
    if(!options.treeFilePath)
Severity: Minor
Found in src/server/v2/webDAVServer/Persistence.ts - About 25 mins to fix

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 unserialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    unserialize(serializedData : any, callback : ReturnCallback<FileSystem>) : void
    {
        // tslint:disable-next-line:no-use-before-declare
        const fs = new VirtualFileSystem();

Severity: Minor
Found in src/manager/v2/instances/VirtualFileSystem.ts - About 25 mins to fix

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 parseRequestBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function parseRequestBody(ctx : HTTPRequestContext, data : Buffer) : PropertyRule
{
    const allTrue : PropertyRule = {
        leftElements: [],
        mustDisplay: () => true,
Severity: Minor
Found in src/server/v2/commands/Propfind.ts - About 25 mins to fix

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 evalPropValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    evalPropValue(value : ResourcePropertyValue) : number
    {
        if(!value)
            return 0;
        if(value.constructor === String)
Severity: Minor
Found in src/manager/v2/fileSystem/StorageManager.ts - About 25 mins to fix

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 can has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    can(_fullPath : Path | string, resource : Resource, _privilege : BasicPrivilege | string | BasicPrivilege[] | string[], callback : PrivilegeManagerCallback) : void
    {
        const user = resource.context.user;
        if(resource.context.overridePrivileges || user && user.isAdministrator)
            return callback(null, true);
Severity: Minor
Found in src/user/v2/privilege/PrivilegeManager.ts - About 25 mins to fix

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 findBestAccept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    findBestAccept(defaultType : string = 'xml') : string
    {
        const accepts = this.find('Accept', 'text/xml').split(',');
        const regex = {
            'xml': /[^a-z0-9A-Z]xml$/,
Severity: Minor
Found in src/server/v2/RequestContext.ts - About 25 mins to fix

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 checkIfHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    checkIfHeader(_fs : FileSystem | Resource, _path : Path | (() => void), _callback ?: () => void)
    {
        const fs = _callback ? _fs as FileSystem : null;
        const path = _callback ? _path as Path : null;
        let resource = _callback ? null : _fs as Resource;
Severity: Minor
Found in src/server/v2/RequestContext.ts - About 25 mins to fix

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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    find(name : string, defaultValue : string = null) : string
    {
        name = name.replace(/(-| )/g, '').toLowerCase();

        for(const k in this.headers)
Severity: Minor
Found in src/server/v2/RequestContext.ts - About 25 mins to fix

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 setRights has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    setRights(user : IUser, path : string, rights : BasicPrivilege[] | string[])
    {
        if(!user)
            throw Errors.IllegalArguments;
        
Severity: Minor
Found in src/user/v2/privilege/SimplePathPrivilegeManager.ts - About 25 mins to fix

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

Calls to 'console.error' are not allowed.
Open

                console.error(e);
Severity: Minor
Found in src/server/v2/RequestContext.ts by tslint

Rule: no-console

Bans the use of specified console methods.

Rationale

In general, console methods aren't appropriate for production code.

Config

A list of method names to ban. If no method names are provided, all console methods are banned.

Examples
"no-console": true,log,error
Schema
{
  "type": "array",
  "items": {
    "type": "string"
  }
}

For more information see this page.

Severity
Category
Status
Source
Language