vijos/openvj

View on GitHub

Showing 76 of 103 total issues

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

    private function send($type, array $to, $subject, $template, $params)
Severity: Minor
Found in src/Mail/Sender.php - About 35 mins to fix

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

        public static function createDiscussion(\MongoId $topicId, $owner, $title, $markdown)
        {
            if (!Validator::int()->validate($owner)) {
                throw new InvalidArgumentException('owner', 'type_invalid');
            }
    Severity: Minor
    Found in src/Discussion/DiscussionUtil.php - 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

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

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

        public function joinDomainById($uid, \MongoId $domainId)
        {
            if (!Validator::int()->validate($uid)) {
                throw new InvalidArgumentException('uid', 'type_invalid');
            }
    Severity: Minor
    Found in src/User/DomainManager.php - 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 method.
    Open

                    return false;
    Severity: Major
    Found in src/User/PasswordEncoder.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return VJ::slowEquals($hash, $targetHash);
      Severity: Major
      Found in src/User/PasswordEncoder.php - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return;
        Severity: Major
        Found in web/gulpfile.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return;
          Severity: Major
          Found in web/gulpfile.js - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return false;
            Severity: Major
            Found in src/User/PasswordEncoder.php - About 30 mins to fix

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

                  public function done()
                  {
                      $this->queryValues = array_values(array_unique($this->queryValues));
                      $this->postprocessValues();
              
              
              Severity: Minor
              Found in src/DeferredResolver.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

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

                  protected function execute(InputInterface $input, OutputInterface $output)
                  {
                      $helper = $this->getHelper('question');
              
                      // ask fields
              Severity: Minor
              Found in tools/CertificateGenerateCommand.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

              Function parse has a Cognitive Complexity of 6 (exceeds 5 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 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

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

                  public function find($purpose, $token)
                  {
                      if (!is_string($purpose)) {
                          throw new InvalidArgumentException('purpose', 'type_invalid');
                      }
              Severity: Minor
              Found in src/Security/TokenManager.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

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

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

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

                  public function createRememberMeToken($uid, $ip, $userAgent, $expireAt)
                  {
                      if (!Validator::int()->validate($uid)) {
                          throw new InvalidArgumentException('uid', 'type_invalid');
                      }
              Severity: Minor
              Found in src/User/UserCredential.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

              Severity
              Category
              Status
              Source
              Language