Showing 22 of 34 total issues
Function createServer
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createServer (opts = {}) {
const eventsUrl = opts.eventsUrl || "/ilk/events";
const connections = {};
let nextConnectionID = 0;
Function handler
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = argv => {
const config = argv.config ? options.loadConfig(argv.config) : {};
const logger = options.getLogger(argv.verbose);
const compileOpts = options.getInterlockOpts(
Function server
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const server = http.createServer((req, res) => {
shouldRespond.then(() => { // eslint-disable-line max-statements
const acceptType = req.headers.accept;
let requestUrl = url.parse(req.url).pathname.toLowerCase();
if (!(requestUrl in dynamicResources)) {
Function createServer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function createServer (opts = {}) {
const eventsUrl = opts.eventsUrl || "/ilk/events";
const connections = {};
let nextConnectionID = 0;
- 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 transformModule
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default pluggable(function transformModule (module) {
if (module.type !== "javascript") {
throw new Error("Cannot transform non-JS module. Please activate appropriate plugin.");
}
const babelUserConfig = this.opts.babelConfig || {};
Function template
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function template (code) {
let stack;
try {
throw new Error();
} catch (error) {
Function parseModule
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default pluggable(function parseModule (module) {
if (module.type !== "javascript") {
throw new Error("Cannot parse non-JavaScript. Please configure appropriate plugin.");
}
Function watch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Interlock.prototype.watch = function (cb, opts = {}) {
const self = this;
let lastCompilation = null;
const absPathToModuleHash = Object.create(null);
Function validate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function validate (options, optionsDef) {
const cwd = process.cwd();
options = optionsDef.reduce((opts, option) => {
const hasKey = option.key in options;
Function resolve
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function resolve (requireStr, contextPath, ns, nsRoot, extensions, searchPaths = []) { // eslint-disable-line max-len,max-params
const resolvedSimple = resolveSimple(requireStr, contextPath, nsRoot, extensions);
if (resolvedSimple) {
return {
Function default
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function () {
let topLevelNode;
return {
visitor: {
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function () {
let topLevelNode;
return {
visitor: {
Function watch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Interlock.prototype.watch = function (cb, opts = {}) {
const self = this;
let lastCompilation = null;
const absPathToModuleHash = Object.create(null);
- 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 enter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
enter (path, replacements) {
let { node } = path;
if (node[TEMPLATE_SKIP]) { return path.skip(); }
if (t.isExpressionStatement(node)) { node = node.expression; }
- 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 resolve
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export default function resolve (requireStr, contextPath, ns, nsRoot, extensions, searchPaths = []) { // eslint-disable-line max-len,max-params
Function transformModule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default pluggable(function transformModule (module) {
if (module.type !== "javascript") {
throw new Error("Cannot transform non-JS module. Please activate appropriate plugin.");
}
const babelUserConfig = this.opts.babelConfig || {};
- 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 resolveDir
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function resolveDir (absPath, extensions) {
if (!isDir(absPath)) { return null; }
const packageJsonPath = path.join(absPath, "package.json");
if (isFile(packageJsonPath)) {
- 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 resolveModule
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function resolveModule (requireStr, contextPath, ns, nsRoot, extensions) {
Function sendEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function sendEvent (connections, id, eventName, data, retryTimeout) {
Avoid too many return
statements within this function. Open
return t.stringLiteral(val);