crishellco/vue-hubble

View on GitHub

Showing 8 of 8 total issues

File directive.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export const CLOSING_COMMENT = '//';
export const NAMESPACE = 'vue-hubble';

const COPY_MESSAGE_RESET_TIMEOUT = 1000;

Severity: Minor
Found in plugin/src/directive.js - About 2 hrs to fix

    Function addTooltip has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const addTooltip = (target, id) => {
      const { top, left, width } = target.getBoundingClientRect();
      const selector = target.getAttribute(`${NAMESPACE}-selector`);
      const text = getTooltip(selector);
      const tooltip = document.createElement('span');
    Severity: Minor
    Found in plugin/src/directive.js - About 1 hr to fix

      Function install has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function install(Vue, options = {}) {
        const merged = Object.assign(defaultConfig, options);
        merged.environment = [].concat(merged.environment);
        Object.defineProperty(merged, 'NODE_ENV', { value: process.env['NODE_ENV'], writable: false });
      
      
      Severity: Minor
      Found in plugin/src/index.js - About 1 hr to fix

        Function getGenericSelector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getGenericSelector = (context, value) => {
          if (!value) return '';
        
          const namespaces = [value];
          let enableDeepNamespacing = context.$hubble.enableDeepNamespacing;
        Severity: Minor
        Found in plugin/src/directive.js - About 55 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

        Function handleInsertAndUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const handleInsertAndUpdate = async (element, { arg, value, oldValue }, { context }) => {
          if (!inCorrectEnvironment(context)) {
            if (element.hubbleMouseover) {
              document.removeEventListener('mouseover', element.hubbleMouseover);
              element.hubbleMouseover = undefined;
        Severity: Minor
        Found in plugin/src/directive.js - About 45 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

        Function handleHubbleSelector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export const handleHubbleSelector = ({ arg, element, oldSelector, newSelector, newQuerySelector }) => {
          switch (arg) {
            case 'class':
              oldSelector && element.classList.remove(oldSelector);
              if (newSelector) {
        Severity: Minor
        Found in plugin/src/directive.js - 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

        Function get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const get = (obj, path, defaultValue) => {
          const travel = (regexp) =>
            String.prototype.split
              .call(path, regexp)
              .filter(Boolean)
        Severity: Minor
        Found in plugin/src/directive.js - 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

        Function handleMouseover has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const handleMouseover = (context, element, id) => (event) => {
          const { target } = event;
          const oldTooltip = document.querySelector(`[${NAMESPACE}-tooltip-id="${id}"]`);
          const oldHighlight = document.querySelector(`[${NAMESPACE}-highlight-id="${id}"]`);
          const shouldRender = target === element || target === oldTooltip || element.contains(target);
        Severity: Minor
        Found in plugin/src/directive.js - 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