Showing 21 of 21 total issues
Function default
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, tokenAuth, sendHttpProblem) {
/**
* A user may request a to use a new email address, by supplying it to this endpoint
* which will generate a token that is sent to the new address.
*/
Function default
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, tokenAuth, sendHttpProblem) {
app.post('/api/password-change', function (req, res) {
Promise
.try(() => {
let schema = Joi.object().keys({
Function tokenRoutes
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const tokenRoutes = (app, config, tokenAuth, jsonld, sendHttpProblem) => {
app.post('/api/token/verify', (req, res) => Promise
.try(() => {
const match = req.headers.authorization && req.headers.authorization.match(/^Bearer (.+)/)
if (!match[1]) return res.status(400).send()
Function rheactorjsExpressBaseConfig
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const rheactorjsExpressBaseConfig = (environment, mimeType, app) => {
StringType(environment, ['rheactorjsServerExpressBaseConfiguration', 'environment:String'])
StringType(mimeType, ['rheactorjsServerExpressBaseConfiguration', 'mimeType:String'])
replaceWithFastURLParser()
Function sendHttpProblem
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export const sendHttpProblem = (environment, res, err) => {
let status = 500
let punish = false
let punishTime = environment === 'production' ? 1000 : 0
if (err.name === 'TokenExpiredError' || err.name === AccessDeniedError.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 sendHttpProblem
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const sendHttpProblem = (environment, res, err) => {
let status = 500
let punish = false
let punishTime = environment === 'production' ? 1000 : 0
if (err.name === 'TokenExpiredError' || err.name === AccessDeniedError.name) {
Function action
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
action: (backend, email, author, options) => Promise
.join(
backend.repositories.user.getByEmail(new EmailValue(email)),
backend.repositories.user.getByEmail(new EmailValue(author))
)
- 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 default
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (config, redis) {
const environment = config.get('environment')
// Generate RSA keys for JWT
return Promise
.join(
Function applyEvent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static applyEvent (event, user) {
const {name, data: {email, firstname, lastname, password, isActive, avatar, preferences, property, value}, createdAt, aggregateId} = event
switch (name) {
case UserCreatedEvent:
return new UserModel(new EmailValue(email), firstname, lastname, password, isActive, avatar ? new URIValue(avatar) : undefined, {}, undefined, undefined, false, new AggregateMeta(aggregateId, 1, createdAt))
Function default
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, sendHttpProblem) {
/**
* Register a new account, needs to be activated afterwards
*/
app.post('/api/registration', (req, res) => Promise
Function rheactorjsExpressConfig
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function rheactorjsExpressConfig (app, config, webConfig, repositories, emitter, transformer = transform, jsonld = undefined, tokenParsers = []) {
const apiHost = new URIValue(config.get('api_host'))
if (!jsonld) {
jsonld = JSONLD(apiHost)
}
Function createPaginationLinks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const createPaginationLinks = (result, urlTemplate) => {
PaginatedResultType(result)
URIValueType(urlTemplate)
let links = []
links.push(new Link(
Function rheactorjsExpressConfig
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function rheactorjsExpressConfig (app, config, webConfig, repositories, emitter, transformer = transform, jsonld = undefined, tokenParsers = []) {
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, tokenAuth, sendHttpProblem) {
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, tokenAuth, sendHttpProblem) {
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, tokenAuth, sendHttpProblem) {
Function rheactorjsCommandHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function rheactorjsCommandHandler (repos, emitter, config, webConfig, templateMailerClient) {
Function default
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export default function (app, config, emitter, userRepository, sendHttpProblem) {
TODO found Open
Open
# TODO
- Exclude checks
TODO found Open
Open
* TODO: support search my (partial) name and email
- Exclude checks