cattr-app/frontend-application

View on GitHub

Showing 33 of 4,835 total issues

Function setLoading has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const setLoading = value => {
    if (value) {
        if (pendingRequests === 0) Vue.prototype.$Loading.start();
        pendingRequests++;
    } else {
Severity: Minor
Found in app/core/helpers/httpInterceptor.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 timePerProject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    timePerProject: (state, getters) => {
        return Object.keys(getters.intervals).reduce((result, userID) => {
            const userEvents = getters.intervals[userID];
            if (!userEvents) {
                return result;
Severity: Minor
Found in app/core/modules/Dashboard/storeModule.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 render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            render: (h, data) => {
                if (!router.app.$store.getters['user/user'].is_admin) {
                    return h(
                        'ul',
                        {},
Severity: Minor
Found in app/core/modules/Tasks/module.init.js - About 1 hr to fix

    Function createStatusDialog has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createStatusDialog(type) {
        const statusTitles = {
            info: '信息',
            success: '成功',
            warning: '警告',
    Severity: Minor
    Found in app/core/components/global/CustomModal/dialog.js - About 1 hr to fix

      Function defultCallback has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const defultCallback = action => {
          if (currentModal) {
              const callback = currentModal.callback;
              if (typeof callback === 'function') {
                  if (instance.showInput) {
      Severity: Minor
      Found in app/core/components/global/CustomModal/dialog.js - About 1 hr to fix

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

        const showNextModal = () => {
            initInstance();
            instance.action = '';
        
            if (!instance.visible && modalQueue.length) {
        Severity: Minor
        Found in app/core/components/global/CustomModal/dialog.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

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

            ru: function (choice, choicesLength) {
                // this === VueI18n instance, so the locale property also exists here
        
                if (choice === 0) {
                    return 0;
        Severity: Minor
        Found in app/core/i18n/pluralizationRules.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

        Avoid deeply nested control flow statements.
        Open

                        } else if (action === 'cancel' && currentModal.reject) {
                            currentModal.reject(action);
                        }
        Severity: Major
        Found in app/core/components/global/CustomModal/dialog.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (instance.showInput) {
                                  currentModal.resolve({ value: instance.inputValue, action });
                              } else {
                                  currentModal.resolve(action);
                              }
          Severity: Major
          Found in app/core/components/global/CustomModal/dialog.js - About 45 mins to fix

            Function exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = (api, options) => {
                api.registerCommand('modules:compile', () => {
                    console.log('Reading modules config file...');
                    const p = api.resolve('app/etc/modules.config.json');
                    if (!fs.existsSync(api.resolve('app/generated'))) {
            Severity: Minor
            Found in app/compiler/index.js - About 45 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

            Function init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export function init(context, router) {
                const crud = context.createCrud('time_intervals.crud_title', 'time-intervals', TimeIntervalService);
                const crudNewRoute = crud.new.getNewRouteName();
            
                crud.new.addToMetaProperties('permissions', 'time-intervals/create', crud.new.getRouterConfig());
            Severity: Minor
            Found in app/core/modules/TimeIntervals/module.init.js - About 35 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

            Function responseErrorInterceptor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            const responseErrorInterceptor = error => {
                setLoading(false);
            
                if (!has(error, 'response.status') || (error.request.responseType === 'blob' && error.request.status === 404)) {
                    return Promise.reject(error);
            Severity: Minor
            Found in app/core/helpers/httpInterceptor.js - About 35 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

            Avoid too many return statements within this function.
            Open

                    return choicesLength < 4 ? 2 : 3;
            Severity: Major
            Found in app/core/i18n/pluralizationRules.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language