PrivateBin/PrivateBin

View on GitHub

Showing 33 of 775 total issues

Function PrivateBin has 2826 lines of code (exceeds 250 allowed). Consider refactoring.
Open

jQuery.PrivateBin = (function($, RawDeflate) {
    'use strict';

    /**
     * zlib library interface
Severity: Major
Found in js/privatebin.js - About 1 wk to fix

    Function PrivateBin has a Cognitive Complexity of 906 (exceeds 550 allowed). Consider refactoring.
    Open

    jQuery.PrivateBin = (function($, RawDeflate) {
        'use strict';
    
        /**
         * zlib library interface
    Severity: Minor
    Found in js/privatebin.js - About 1 wk 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 privatebin.js has 2852 lines of code (exceeds 2000 allowed). Consider refactoring.
    Open

    /**
     * PrivateBin
     *
     * a zero-knowledge paste bin
     *
    Severity: Major
    Found in js/privatebin.js - About 2 days to fix

      Function TopNav has 482 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

          const TopNav = (function (window, document) {
              const me = {};
      
              let createButtonsDisplayed = false,
                  viewButtonsDisplayed = false,
      Severity: Major
      Found in js/privatebin.js - About 1 day to fix

        Function AttachmentViewer has 269 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

            const AttachmentViewer = (function () {
                const me = {};
        
                let $attachmentLink,
                    $attachmentPreview,
        Severity: Major
        Found in js/privatebin.js - About 1 hr to fix

          Function CryptTool has 260 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

              const CryptTool = (function () {
                  const me = {};
          
                  /**
                   * base58 encoder & decoder
          Severity: Major
          Found in js/privatebin.js - About 1 hr to fix

            Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function __construct(ConnectionInterface $connection, $name, $bucket, $generation = null, array $info = array(), $encryptionKey = null, $encryptionKeySHA256 = null)
            Severity: Major
            Found in tst/Bootstrap.php - About 50 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (!unlink($path . $file)) {
                                          throw new Exception('Error deleting file "' . $path . $file . '".');
                                      }
              Severity: Major
              Found in tst/Bootstrap.php - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                        if (
                            (array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) &&
                                $_SERVER['HTTP_X_REQUESTED_WITH'] == 'JSONHttpRequest') ||
                            ($hasAcceptHeader &&
                                strpos($acceptHeader, self::MIME_JSON) !== false &&
                Severity: Major
                Found in lib/Request.php - About 40 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return false;
                  Severity: Major
                  Found in lib/FormatV2.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $n % 10 === 1 && $n % 100 !== 11 ? 0 : (($n % 10 >= 2 && $n % 100 < 10 || $n % 100 >= 20) ? 1 : 2);
                    Severity: Major
                    Found in lib/I18n.php - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return me.showPaste();
                      Severity: Major
                      Found in js/privatebin.js - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return 0;
                        Severity: Major
                        Found in lib/I18n.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return false;
                          Severity: Major
                          Found in lib/FormatV2.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return false;
                            Severity: Major
                            Found in lib/FormatV2.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $n === 1 ? 0 : (($n === 0 || ($n % 100 > 0 && $n % 100 < 20)) ? 1 : 2);
                              Severity: Major
                              Found in lib/I18n.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return $n % 10 === 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2);
                                Severity: Major
                                Found in lib/I18n.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return false;
                                  Severity: Major
                                  Found in lib/FormatV2.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return true;
                                    Severity: Major
                                    Found in lib/FormatV2.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                      return $this->_return_message(1, $e->getMessage());
                                      Severity: Major
                                      Found in lib/Controller.php - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language