gerard2p/ember-cli-crudtable

View on GitHub

Showing 49 of 49 total issues

File actions.js has 482 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Ember from 'ember';
import modal from './modal';
import ComplexModel from '../privateclasses/complexmodel';
const exportData = function(component, format, joinchar) {
    let data = [];
Severity: Minor
Found in addon/privateclasses/actions.js - About 7 hrs to fix

Function confirm has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        confirm() {
            let validate = function() {
                try {
                    return document.querySelector("#crudatable-update-data").checkValidity();
                } catch (e) {
Severity: Major
Found in addon/privateclasses/actions.js - About 3 hrs to fix

`` has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

    actions: Ember.Object.create({
        internal_filterset() {
            this.filterset.init();
            this.set('filtercreation', true);
        },
Severity: Minor
Found in addon/privateclasses/actions.js - About 3 hrs to fix

Function init has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init: function() {
        component = this;
        component.set('paginator', component.get('paginator')());
        if (component.get('parent')) {
            var ct = component.get('parent').get('crud-table');
Severity: Major
Found in addon/components/crud-table.js - About 3 hrs to fix

Function dateFormat has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const dateFormat = (function () {
    let token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
        timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
        timezoneClip = /[^-+\dA-Z]/g,
        pad = function (val, len) {
Severity: Major
Found in addon/utils/dateformat.js - About 2 hrs to fix

Function internal_map has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        internal_map(record, kind) {

            if (google === undefined) {
                return;
            }
Severity: Major
Found in addon/privateclasses/actions.js - About 2 hrs to fix

Function TypeAdjustments has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TypeAdjustments = function (component, Type, field, data, cfield, row) {
    let fobj = component.get('fields')[field];
    switch (Type) {
    case 'check':
        if (fobj.Value) {
Severity: Minor
Found in addon/privateclasses/complexmodel.js - About 1 hr to fix

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

        confirm() {
            let validate = function() {
                try {
                    return document.querySelector("#crudatable-update-data").checkValidity();
                } catch (e) {
Severity: Minor
Found in addon/privateclasses/actions.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 generateLinks has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    generateLinks() {
        const slots = 1;
        const siblings = 3;
        let cur = this.get('current');
        let pages = this.get('pages');
Severity: Minor
Found in addon/mixins/pagination.js - About 1 hr to fix

Function generateLinks has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    generateLinks() {
        const slots = 1;
        const siblings = 3;
        let cur = this.get('current');
        let pages = this.get('pages');
Severity: Minor
Found in addon/mixins/pagination.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 default has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (model) {
    return Ember.Mixin.create({
        isEditing: false,
        actions: {
            FetchData:function(query,deferred){
Severity: Minor
Found in addon/mixins/crud-controller.js - About 1 hr to fix

Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init(component) {
        let that = this;
        this.target = $('#CrudTableDeleteRecordModal');
        $('#CrudTableDeleteRecordModal').on('shown.bs.modal', function () {
            that.promise.resolve();
Severity: Minor
Found in addon/privateclasses/modal.js - About 1 hr to fix

Function gen has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    gen() {
        const string = "abcdefghijklmnopqrstuvwxyz"; //to upper
        const numeric = '0123456789';
        let punctuation = '!@#$%^&*()_+~`|}{[]\:;?><,./-=';
        this.restrict_chars.forEach(function (char) {
Severity: Minor
Found in addon/privateclasses/passgen.js - About 1 hr to fix

Function update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    update(component) {
        const trytest = component.get('value').get('isLoaded') === true ? component.get('value') : component.get('value').get('content');
        let ComplexModel = [];
        trytest.forEach(function (row) {
            let CustomProperties = [];
Severity: Minor
Found in addon/privateclasses/complexmodel.js - About 1 hr to fix

Function TypeAdjustments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const TypeAdjustments = function (component, Type, field, data, cfield, row) {
    let fobj = component.get('fields')[field];
    switch (Type) {
    case 'check':
        if (fobj.Value) {
Severity: Minor
Found in addon/privateclasses/complexmodel.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 newCustomField has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let newCustomField = function (component, field, data,row) {
    return CustomField.create({
        PlaceHolder:component.fields[field].PlaceHolder || null,
        IsRequired:component.fields[field].IsRequired || false,
        Pattern:component.fields[field].Pattern || null,
Severity: Minor
Found in addon/privateclasses/complexmodel.js - About 1 hr to fix

Function toJSONObject has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        toJSONObject() {
            let data = [];
            this.get('ComplexModel').forEach(function(model) {
                let row = {};
                model.forEach(function(field) {
Severity: Minor
Found in addon/privateclasses/actions.js - About 1 hr to fix

Function exportData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const exportData = function(component, format, joinchar) {
    let data = [];
    let row = [];
    component.labels.forEach(function(field) {
        row.push(field.Display);
Severity: Minor
Found in addon/privateclasses/actions.js - About 1 hr to fix

Function internal_search has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        internal_search() {
            let component = this;
            let field = $("#SearchField").val();
            Object.keys(component.fields).forEach(function(fieldname) {
                if (component.fields[fieldname].Label === field) {
Severity: Minor
Found in addon/privateclasses/actions.js - About 1 hr to fix

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

    gen() {
        const string = "abcdefghijklmnopqrstuvwxyz"; //to upper
        const numeric = '0123456789';
        let punctuation = '!@#$%^&*()_+~`|}{[]\:;?><,./-=';
        this.restrict_chars.forEach(function (char) {
Severity: Minor
Found in addon/privateclasses/passgen.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

Severity
Category
Status
Source
Language