Showing 8 of 8 total issues
Function createOpalSourceMapMWare
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createOpalSourceMapMWare = function (config, logger) {
const log = logger.create('middleware:opal_sourcemap');
config.opal = config.opal || {};
config.opal.sourceMapsEnabled = true;
Function createSprocketsProcessor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createSprocketsProcessor = function (args, config, logger) {
config = config || {};
const log = logger.create('preprocessor.sprockets');
Function initOpal
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const initOpal = function (files, logger, config) {
const testPatterns = [];
files.forEach(function (file) {
testPatterns.push(file.pattern);
});
Function getMetadata
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const getMetadata = function (config, log) {
// Have to block here because we need the file list from Sprockets before Karma can start
var metadataResponse = null;
const opalConfig = config.opal;
log.info('Getting metadata from Sprockets, this can take a while the first time');
- 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 getMetadata
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getMetadata = function (config, log) {
// Have to block here because we need the file list from Sprockets before Karma can start
var metadataResponse = null;
const opalConfig = config.opal;
log.info('Getting metadata from Sprockets, this can take a while the first time');
Method process_requires
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_requires(requires, context)
requires.each do |required|
required = required.to_s.sub(sprockets_extnames_regexp, '')
# If other rolled up assets (besides opal code itself) do a "require 'opal'", we don't want to end up bundling a 2nd rolled up opal instance
if opal_originating_asset?(context) || !FILTER.include?(required)
- 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
Method get_metadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.get_metadata(dependency_graph, roll_up_list, watch)
dep_hash = {}
file_mapping = dependency_graph[:file_mapping]
file_mapping.each do |logical_path, filename|
roll_up = roll_up_list.any? do |roll_up_item|
- 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
Method get_dependency_graph
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.get_dependency_graph(sprockets_env, files, result = nil, current_dependency_chain = [])
unless result
result = {
file_mapping: {},
dependencies: Hash.new([])
- 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"