wikimedia/mediawiki-core

View on GitHub
resources/lib/vuex/vuex.global.js

Summary

Maintainability
F
2 wks
Test Coverage

Function Vuex has 1130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Vuex = (function (vue) {
  'use strict';

  var storeKey = 'store';

Severity: Major
Found in resources/lib/vuex/vuex.global.js - About 5 days to fix

    Function Vuex has a Cognitive Complexity of 220 (exceeds 5 allowed). Consider refactoring.
    Open

    var Vuex = (function (vue) {
      'use strict';
    
      var storeKey = 'store';
    
    
    Severity: Minor
    Found in resources/lib/vuex/vuex.global.js - About 4 days 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

    File vuex.global.js has 1133 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * vuex v4.0.2
     * (c) 2021 Evan You
     * @license MIT
     */
    Severity: Major
    Found in resources/lib/vuex/vuex.global.js - About 2 days to fix

      Function addDevtools has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function addDevtools (app, store) {
          setupDevtoolsPlugin(
            {
              id: 'org.vuejs.vuex',
              app: app,
      Severity: Major
      Found in resources/lib/vuex/vuex.global.js - About 5 hrs to fix

        Function dispatch has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Store.prototype.dispatch = function dispatch (_type, _payload) {
              var this$1$1 = this;
        
            // check object-style dispatch
            var ref = unifyObjectStyle(_type, _payload);
        Severity: Major
        Found in resources/lib/vuex/vuex.global.js - About 2 hrs to fix

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

            function createLogger (ref) {
              if ( ref === void 0 ) ref = {};
              var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true;
              var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; };
              var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; };
          Severity: Minor
          Found in resources/lib/vuex/vuex.global.js - About 1 hr to fix

            Function makeLocalContext has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function makeLocalContext (store, namespace, path) {
                var noNamespace = namespace === '';
            
                var local = {
                  dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
            Severity: Minor
            Found in resources/lib/vuex/vuex.global.js - About 1 hr to fix

              Function installModule has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function installModule (store, rootState, path, module, hot) {
                  var isRoot = !path.length;
                  var namespace = store._modules.getNamespace(path);
              
                  // register in namespace map
              Severity: Minor
              Found in resources/lib/vuex/vuex.global.js - About 1 hr to fix

                Function Store has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var Store = function Store (options) {
                    var this$1$1 = this;
                    if ( options === void 0 ) options = {};
                
                    {
                Severity: Minor
                Found in resources/lib/vuex/vuex.global.js - About 1 hr to fix

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

                    Store.prototype.commit = function commit (_type, _payload, _options) {
                        var this$1$1 = this;
                  
                      // check object-style commit
                      var ref = unifyObjectStyle(_type, _payload, _options);
                  Severity: Minor
                  Found in resources/lib/vuex/vuex.global.js - About 1 hr to fix

                    Function installModule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      function installModule (store, rootState, path, module, hot) {
                    Severity: Minor
                    Found in resources/lib/vuex/vuex.global.js - About 35 mins to fix

                      Function makeAssertionMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        function makeAssertionMessage (path, key, type, value, expected) {
                      Severity: Minor
                      Found in resources/lib/vuex/vuex.global.js - About 35 mins to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          var mapMutations = normalizeNamespace(function (namespace, mutations) {
                            var res = {};
                            if (!isValidMap(mutations)) {
                              console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
                            }
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 1 day to fix
                        resources/lib/vuex/vuex.global.js on lines 1285..1313

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 281.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          var mapActions = normalizeNamespace(function (namespace, actions) {
                            var res = {};
                            if (!isValidMap(actions)) {
                              console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
                            }
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 1 day to fix
                        resources/lib/vuex/vuex.global.js on lines 1216..1244

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 281.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                if (!options || !options.root) {
                                  type = namespace + type;
                                  if (!store._actions[type]) {
                                    console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
                                    return
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 2 hrs to fix
                        resources/lib/vuex/vuex.global.js on lines 271..277

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 75.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                if (!options || !options.root) {
                                  type = namespace + type;
                                  if (!store._mutations[type]) {
                                    console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
                                    return
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 2 hrs to fix
                        resources/lib/vuex/vuex.global.js on lines 254..260

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 75.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                              var res = handler.call(store, {
                                dispatch: local.dispatch,
                                commit: local.commit,
                                getters: local.getters,
                                state: local.state,
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 1 hr to fix
                        resources/lib/qunitjs/qunit.js on lines 3019..3026

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 56.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                          Module.prototype.forEachMutation = function forEachMutation (fn) {
                            if (this._rawModule.mutations) {
                              forEachValue(this._rawModule.mutations, fn);
                            }
                          };
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 2 other locations - About 55 mins to fix
                        resources/lib/vuex/vuex.global.js on lines 738..742
                        resources/lib/vuex/vuex.global.js on lines 744..748

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 54.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                          Module.prototype.forEachGetter = function forEachGetter (fn) {
                            if (this._rawModule.getters) {
                              forEachValue(this._rawModule.getters, fn);
                            }
                          };
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 2 other locations - About 55 mins to fix
                        resources/lib/vuex/vuex.global.js on lines 744..748
                        resources/lib/vuex/vuex.global.js on lines 750..754

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 54.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                          Module.prototype.forEachAction = function forEachAction (fn) {
                            if (this._rawModule.actions) {
                              forEachValue(this._rawModule.actions, fn);
                            }
                          };
                        Severity: Major
                        Found in resources/lib/vuex/vuex.global.js and 2 other locations - About 55 mins to fix
                        resources/lib/vuex/vuex.global.js on lines 738..742
                        resources/lib/vuex/vuex.global.js on lines 750..754

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 54.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            Object.keys(obj).forEach(function (key) {
                              copy[key] = deepCopy(obj[key], cache);
                            });
                        Severity: Minor
                        Found in resources/lib/vuex/vuex.global.js and 1 other location - About 30 mins to fix
                        resources/lib/qunitjs/qunit.js on lines 3888..3890

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 45.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status