jonshaffer/angular-data-table

View on GitHub
src/components/popover/PopoverDirective.js

Summary

Maintainability
D
2 days
Test Coverage

Showing 6 of 6 total issues

Function PopoverDirective has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
/**
* Loads a template from the template cache
* @param {string} template
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 7 hrs to fix

Function link has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

link($scope, $element, $attributes) {
$scope.popover = null;
 
$scope.options = {
alignment: $attributes.popoverAlignment || 'middle',
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 6 hrs to fix

Function PopoverDirective has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
/**
* Loads a template from the template cache
* @param {string} template
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 4 hrs to fix

Function positionPopover has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function positionPopover(triggerElement, popover, options) {
$timeout(() => {
const elDimensions = triggerElement[0].getBoundingClientRect();
const popoverDimensions = popover[0].getBoundingClientRect();
 
 
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix

Function addCaret has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addCaret(popoverEl, elDimensions, popoverDimensions) {
const caret = angular.element(`<span class="popover-caret caret-${$scope.options.placement}"></span>`);
popoverEl.append(caret);
const caretDimensions = caret[0].getBoundingClientRect();
 
 
Severity: Minor
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix

Function PopoverDirective has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

export default function PopoverDirective($animate, $compile, $document, $http,
$q, $templateCache, $timeout, PopoverRegistry, PositionHelper) {
Severity: Major
Found in src/components/popover/PopoverDirective.js - About 1 hr to fix
Category
Status