wied03/karma-opal-rspec

View on GitHub

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;
Severity: Major
Found in lib/opalSourceMap.js - About 2 hrs to fix

    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');
    
    
    Severity: Minor
    Found in lib/sprocketsPreprocessor.js - About 1 hr to fix

      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);
          });
      Severity: Minor
      Found in lib/index.js - About 1 hr to fix

        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');
        Severity: Minor
        Found in lib/getMetadata.js - About 1 hr to fix

        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');
        Severity: Minor
        Found in lib/getMetadata.js - About 1 hr to fix

          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)
          Severity: Minor
          Found in lib/opal_processor_patch.rb - About 35 mins to fix

          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|
          Severity: Minor
          Found in lib/sprockets_metadata.rb - About 25 mins to fix

          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([])
          Severity: Minor
          Found in lib/sprockets_metadata.rb - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language