jackmellis/vuenit

View on GitHub
lib/component/augment.js

Summary

Maintainability
C
1 day
Test Coverage

Function find has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

function find(q, options, first) {
  var result = [];

  if (typeof q === 'object'){
    q = q.name;
Severity: Minor
Found in lib/component/augment.js - About 5 hrs 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 find has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function find(q, options, first) {
  var result = [];

  if (typeof q === 'object'){
    q = q.name;
Severity: Major
Found in lib/component/augment.js - About 2 hrs to fix

    Function augment has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function augment(instance) {
      if (!hasOwn(instance, '$name')){
        defineGetter(instance, '$name', function () {
          return (this.$options && this.$options.name) || (isElement(this) && this.tagName.toLowerCase()) || '';
        }, true);
    Severity: Minor
    Found in lib/component/augment.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 augment has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function augment(instance) {
      if (!hasOwn(instance, '$name')){
        defineGetter(instance, '$name', function () {
          return (this.$options && this.$options.name) || (isElement(this) && this.tagName.toLowerCase()) || '';
        }, true);
    Severity: Minor
    Found in lib/component/augment.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                switch(component.$options.name){
                case q:
                case deCamelCased:
                case reCamelCased:
                case reUpperCased:
      Severity: Major
      Found in lib/component/augment.js - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

          if (!hasOwn(instance, '$text')){
            defineGetter(instance, '$text', function () {
              var element = this.$el || (isElement(this) && this);
              return element && (element.textContent || element.innerText) || '';
            });
        Severity: Major
        Found in lib/component/augment.js - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status