nmdantas/swt-framework

View on GitHub

Showing 5 of 5 total issues

Function authorize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function authorize(roles) {
    var authorizedRoles = Array.isArray(roles) ? roles : Array.prototype.slice.call(arguments);

    // Deve retornar este middleware para tratamento do framework Express
    return function middleware(req, res, next) {
Severity: Minor
Found in security/roles-authorization.js - About 1 hr 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 select has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Array.prototype.select = function (map) {
    var results = [];
    var complexMap = typeof map === 'object';
    
    // Percorre todas as chaves passadas na pesquisa e as procurara dentro da coleção
Severity: Minor
Found in common/linq.js - About 1 hr 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 any has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

Array.prototype.any = function (predicate) {
    // Caso o predicado passado for uma string utiliza a função nativa 'indexOf'
    if (typeof predicate === 'string' || typeof predicate === 'number') {
        return this.indexOf(predicate) > -1;
    }
Severity: Minor
Found in common/linq.js - About 45 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 checkAuthorization has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function checkAuthorization(req, res, next) {
    var authHeader = common.parseAuthHeader(req.headers.authorization);

    switch (authHeader.type) {
        case 'app':
Severity: Minor
Found in security/access-control.js - About 35 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 where has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Array.prototype.where = function (predicate) {
    var results = [];

    // Percorre todas as chaves passadas na pesquisa e as procurara dentro da coleção
    for (var i = 0; i < this.length; i++) {
Severity: Minor
Found in common/linq.js - 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

Severity
Category
Status
Source
Language