SpeciesFileGroup/taxonworks

View on GitHub
app/javascript/vue/tasks/data_attributes/field_synchronize/composables/useFieldSync.js

Summary

Maintainability
F
3 days
Test Coverage

Function useFieldSync has 367 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useFieldSync() {
  const attributes = ref([])
  const dataAttributes = ref([])
  const from = ref()
  const isLoading = ref(false)

    Function useFieldSync has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    export function useFieldSync() {
      const attributes = ref([])
      const dataAttributes = ref([])
      const from = ref()
      const isLoading = ref(false)

    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

    File useFieldSync.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { onBeforeMount, ref, computed, watch } from 'vue'
    import { Metadata, DataAttribute } from '@/routes/endpoints'
    import { DATA_ATTRIBUTE_INTERNAL_ATTRIBUTE } from '@/constants'
    import { QUERY_PARAMETER, PATTERN_TYPES } from '../constants'
    import {

      Function tableList has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const tableList = computed(() => {
          function getItemsFromObj(obj, property) {
            return property?.id
              ? obj.dataAttributes[property.id].map((item) => item.value)
              : [obj.attributes[property]]

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

          function loadAttributes(params) {
            const request = ajaxCall(
              'get',
              '/tasks/data_attributes/field_synchronize/values',
              {

          There are no issues that match your filters.

          Category
          Status