kilbot/WooCommerce-POS

View on GitHub
includes/i18n.php

Summary

Maintainability
C
1 day
Test Coverage

Method manual_update has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function manual_update() {
        ob_start();
        $locale = get_locale();
        $creds  = request_filesystem_credentials( $_GET['security'], '', false, false, null );

Severity: Minor
Found in includes/i18n.php - About 2 hrs to fix

    Function manual_update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function manual_update() {
            ob_start();
            $locale = get_locale();
            $creds  = request_filesystem_credentials( $_GET['security'], '', false, false, null );
    
    
    Severity: Minor
    Found in includes/i18n.php - 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

    Method update_check has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function update_check( $transient, $force = false ) {
            $locale = get_locale();
    
            // pre_set_site_transient_update_plugins is called twice
            // we only want to act on the second run
    Severity: Minor
    Found in includes/i18n.php - About 1 hr to fix

      Method get_external_library_locale_js has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static public function get_external_library_locale_js( $library = '', $version = '' ) {
              $cdnjs_url = $locale_js = '';
      
              switch ( $library ) {
                  case 'select2':
      Severity: Minor
      Found in includes/i18n.php - About 1 hr to fix

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

            static public function get_external_library_locale_js( $library = '', $version = '' ) {
                $cdnjs_url = $locale_js = '';
        
                switch ( $library ) {
                    case 'select2':
        Severity: Minor
        Found in includes/i18n.php - 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 too many return statements within this method.
        Open

                return $transient;
        Severity: Major
        Found in includes/i18n.php - About 30 mins to fix

          Function update_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function update_check( $transient, $force = false ) {
                  $locale = get_locale();
          
                  // pre_set_site_transient_update_plugins is called twice
                  // we only want to act on the second run
          Severity: Minor
          Found in includes/i18n.php - About 25 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

          There are no issues that match your filters.

          Category
          Status