Showing 4 of 21 total issues
Function RedisSession
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function RedisSession(options) {
var opts = options || {};
// 默认缓存时间30分钟
var expires = opts.expires || 30 * 60,
Function _redisSession3x
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function _redisSession3x(req, res, next) {
// 重写writeHead, 在响应时写cookie
var writeHead = res.writeHead;
res.writeHead = function() {
// 支持针对单独session定制过期时间
Function RedisSession
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
function RedisSession(options) {
var opts = options || {};
// 默认缓存时间30分钟
var expires = opts.expires || 30 * 60,
- 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 save
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
RSession.prototype.save = function(res, redisCluster, secret, expires, cb) {