rubyforgood/casa

View on GitHub
app/javascript/controllers/casa_nested_form_controller.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function addAndCreate has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  addAndCreate (e) {
    this.add(e)
    const items = this.element.querySelectorAll(this.wrapperSelectorValue)
    const addedItem = items[items.length - 1]
    // childIndex will be 0,1,... for items at page load, timestamps for items added to form.
Severity: Minor
Found in app/javascript/controllers/casa_nested_form_controller.js - About 1 hr to fix

    Function destroyAndRemove has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      destroyAndRemove (e) {
        const wrapper = e.target.closest(this.wrapperSelectorValue)
        const recordId = this.getRecordId(wrapper)
        if (wrapper.dataset.newRecord === 'false' && (recordId.length > 0)) {
          fetch(`${this.routeValue}/${recordId}`, {
    Severity: Minor
    Found in app/javascript/controllers/casa_nested_form_controller.js - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status