vijos/openvj

View on GitHub

Showing 76 of 103 total issues

Method sendMailAction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sendMailAction()
    {
        $email = $this->request->request->get('email');
        if ($email === null) {
            throw new MissingArgumentException('email');
Severity: Minor
Found in src/Controller/RegistrationController.php - About 1 hr to fix

    Method parse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse($markdown)
        {
            if (!is_string($markdown)) {
                throw new InvalidArgumentException('markdown', 'type_invalid');
            }
    Severity: Minor
    Found in src/MarkdownParser.php - About 1 hr to fix

      Method vote has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function vote(\MongoCollection $collection, array $query, $uid, $value)
          {
              if ($value !== 1 && $value !== -1) {
                  throw new InvalidArgumentException('value', 'value_invalid');
              }
      Severity: Minor
      Found in src/Vote/VoteUtil.php - About 1 hr to fix

        Method onEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function onEvent(GenericEvent $event, $eventName)
            {
                if (!$this->enforceHttps) {
                    return;
                }
        Severity: Minor
        Found in src/EventListener/HttpsRedirectionService.php - About 1 hr to fix

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

              public function onEvent(GenericEvent $event, $eventName)
              {
                  if (!$this->enforceHttps) {
                      return;
                  }
          Severity: Minor
          Found in src/EventListener/HttpsRedirectionService.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

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

              public static function createReply(\MongoId $commentId, $ref, $owner, $markdown)
              {
                  if (!is_string($ref)) {
                      throw new InvalidArgumentException('ref', 'type_invalid');
                  }
          Severity: Minor
          Found in src/Comment/CommentUtil.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 verify has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function verify($password, $salt, $hash)
              {
                  $component = explode('|', $hash);
                  if (count($component) < 2) {
                      return false;
          Severity: Minor
          Found in src/User/PasswordEncoder.php - About 1 hr to fix

            Method deleteReply has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function deleteReply(\MongoId $commentId, $ref, \MongoId $replyId)
                {
                    if (!is_string($ref)) {
                        throw new InvalidArgumentException('ref', 'type_invalid');
                    }
            Severity: Minor
            Found in src/Comment/CommentUtil.php - About 1 hr to fix

              Method testBatchQueryTopic has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testBatchQueryTopic()
                  {
                      $cursor = [
                          ['topicId' => new \MongoId('5063114bd386d8fadbd6b004'), '_id' => 1],
                          ['topicId' => new \MongoId('5063114bd386d8fadbd6b005'), '_id' => 2],
              Severity: Minor
              Found in src/Test/Discussion/TopicUtilTest.php - About 1 hr to fix

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

                    private static function initConfig()
                    {
                        if (file_exists(self::$CONFIG_DIRECTORY . '/config.yml')) {
                            // config file exists
                            $cachePath = self::$CACHE_DIRECTORY . '/config.php';
                Severity: Minor
                Found in src/Core/Application.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

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

                    public function checkPasswordCredential($field, $password, $secretly = false)
                    {
                        if (Validator::email()->validate($field)) {
                            $user = UserUtil::getUserObjectByEmail($field);
                        } else {
                Severity: Minor
                Found in src/User/UserCredential.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

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

                    public static function createProblem($uid, $title, array $visibleDomains)
                    {
                        if (!Validator::int()->validate($uid)) {
                            throw new InvalidArgumentException('uid', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Problem/ProblemUtil.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

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

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        $helper = $this->getHelper('question');
                
                        if ($input->getOption('type') !== 'vijos') {
                Severity: Minor
                Found in tools/UserImportCommand.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

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

                    public function __construct($category, $subCategory = null)
                    {
                        if (!is_string($category)) {
                            throw new InvalidArgumentException('category', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Problem/Tag/CategoryTag.php - 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 modifyReply has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function modifyReply(\MongoId $commentId, $ref, \MongoId $replyId, $markdown)
                    {
                        if (!is_string($ref)) {
                            throw new InvalidArgumentException('ref', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Comment/CommentUtil.php - 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 modifyComment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function modifyComment(\MongoId $commentId, $ref, $markdown)
                    {
                        if (!is_string($ref)) {
                            throw new InvalidArgumentException('ref', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Comment/CommentUtil.php - 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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handle()
                    {
                        if (!$this->isAjaxRequest()) {
                            return Handler::DONE;
                        }
                Severity: Minor
                Found in src/Core/ExceptionHandler/JsonResponseHandler.php - 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 encode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function encode($password, $salt, $type, $username = null)
                    {
                        if (strlen($salt) < 22) {
                            throw new InvalidArgumentException('salt', 'too_short');
                        }
                Severity: Minor
                Found in src/User/PasswordEncoder.php - 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

                Method onEvent has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function onEvent(GenericEvent $event, $eventName, $type, $user, $field = null, $password = null)
                Severity: Minor
                Found in src/EventListener/VJCredentialUpgradeService.php - About 45 mins to fix

                  Method generate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function generate($purpose, $identifier, $expireAt, $data = null, $length = 30)
                  Severity: Minor
                  Found in src/Security/TokenManager.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language