smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

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

    private function loadThreads()
    {
        $res = false;
        $threads = new Threads();
        if (Post::get('id') !== null) {
Severity: Minor
Found in lib/modules/Forums/Models/Process.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 insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function insert($form)
    {
        $object = new \stdClass();

        switch ($form) {
Severity: Minor
Found in lib/modules/Admin/Models/Process.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 isValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function isValid($value)
    {
        $this->_setValue($value);
        if (empty($value) || strlen($value) < 2 || strlen($value) > 20) {
            $this->_error(self::LENGTH);
Severity: Minor
Found in lib/modules/Core/Models/Validation/Username.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 validateForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateForm()
    {
        $validateMail = new Email();
        $validateUsername = new Username();
        $validatePassword = new Password();
Severity: Minor
Found in lib/modules/Register/Models/Register.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 verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function verify()
    {
        if (Get::get('x') === null || Get::get('x') === '') {
            throw new MissingParameter();
        }
Severity: Minor
Found in lib/modules/Register/Models/Process.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 login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function login()
    {
        if (Post::get('email') !== null) {
            if (Session::get('user')->email == Post::get('email') && Session::get('user')->password == sha1(Post::get('password').Session::get('user')->salt)) {
                Session::set('admin_loggedIn', true);
Severity: Minor
Found in lib/modules/Admin/Models/Login.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function delete($form)
    {
        $primary = 'id';
        $object = new \stdClass();

Severity: Minor
Found in lib/modules/Admin/Models/Process.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 assignErrors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function assignErrors(View $view, $error_messages)
    {
        if (!empty($this->errors)) {
            foreach ($this->errors as $error => $message) {
                if (!empty($message)) {
Severity: Minor
Found in lib/modules/Register/Models/Register.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function load()
    {
        $table = new Db\Table\Conversations();
        $userTable = new Users();
        $view = new \Cunity\Messages\View\Conversation();
Severity: Minor
Found in lib/modules/Messages/Models/Conversation.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 getFriendList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFriendList($status = '>1', $userid = 0)
    {
        if ($userid == 0) {
            $userid = Session::get('user')->userid;
        } else {
Severity: Minor
Found in lib/modules/Friends/Models/Db/Table/Relationships.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 getNewsfeed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNewsfeed($offset, $refresh = 0, $filter = [])
    {
        $subquery = new \Zend_Db_Expr($this->select()->from($this, 'wall_id')->where('(owner_id IN ('.$this->friendslistQuery.") OR owner_id = ?) AND owner_type = 'profile'", Session::get('user')->userid)
            ->orWhere("owner_type = 'event' AND owner_id IN (".$this->eventslistQuery.')'));
        $query = $this->getAdapter()->select()->from(['p' => $this->_dbprefix.'posts'])
Severity: Minor
Found in lib/modules/Newsfeed/Models/Db/Table/Walls.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 checkAutoLogin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkAutoLogin($autologin = true)
    {
        if (!isset($_COOKIE['cunity-login']) || !isset($_COOKIE['cunity-login-token'])) {
            return false;
        }
Severity: Minor
Found in lib/modules/Register/Models/Login.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function load()
    {
        $table = new Db\Table\Conversations();
        $conversations = $table->loadConversations(Session::get('user')->userid);
        $view = new View(true);
Severity: Minor
Found in lib/modules/Messages/Models/Process.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 handleRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleRequest()
    {
        if (Get::get('action') == 'cropImage') {
            $this->cropImage();
        } elseif (Post::get('edit') !== null && Post::get('edit') !== '') {
Severity: Minor
Found in lib/modules/Profile/Models/ProfileEdit.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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function upload()
    {
        $albums = new GalleryAlbums();
        $images = new GalleryImages();
        if (isset($_POST['newsfeed_post'])) {
Severity: Minor
Found in lib/modules/Gallery/Models/Process.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 findConversationUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function findConversationUser($details)
    {
        $userid = [];
        $id = null;

Severity: Minor
Found in lib/modules/Messages/Models/Process.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 changeLikeState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function changeLikeState($referenceId, $referenceName, $state)
    {
        $newState = 1;

        if ($state === 1) {
Severity: Minor
Found in lib/modules/Likes/Models/Db/Table/Likes.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