lib/provider/browser.js
Function constructor
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor() {
function serviceUp(service) {
logger(`serviceup: ${service.type.name}`, service);
if (service.type.name !== "leaf") {
logger('ignoring service, service name not leaf');
Function constructor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
constructor() {
function serviceUp(service) {
logger(`serviceup: ${service.type.name}`, service);
if (service.type.name !== "leaf") {
logger('ignoring service, service name not leaf');
- 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 get
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get(name, ver) {
let time = new Date();
// think of a way to refactor this into a generator, so we can just store that as a cache and yield everytime
// hopeful usage would be:
// var service = cache[service@version].next();
Function resolver
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resolver() {
logger("looping through browser caches");
// keep trying for a specific amount of time, now hard coded, 1s
if (new Date() - time > 2000) {
logger("timeout");
Function serviceUp
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function serviceUp(service) {
logger(`serviceup: ${service.type.name}`, service);
if (service.type.name !== "leaf") {
logger('ignoring service, service name not leaf');
return;
TODO found Open
Open
// TODO: handle cases where it is not found
- Exclude checks