Showing 5 of 5 total issues
Function authenticate
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
Open
Strategy.prototype.authenticate = function (req, options) {
options = options || {};
var self = this;
if (req.query && req.query.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 authenticate
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Strategy.prototype.authenticate = function (req, options) {
options = options || {};
var self = this;
if (req.query && req.query.error) {
Function loaded
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function loaded(err, ok, state) {
if (err) { return self.error(err); }
if (!ok) {
return self.fail(state, 403);
}
Function userProfile
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
Strategy.prototype.userProfile = function(accessToken, done) {
this._oauth2.get(this._apiURL + this._userInfoURL, accessToken, function (err, body) {
if (err) {
return done(err);
}
- 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 userProfile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Strategy.prototype.userProfile = function(accessToken, done) {
this._oauth2.get(this._apiURL + this._userInfoURL, accessToken, function (err, body) {
if (err) {
return done(err);
}