smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (!$(".livesearch-popover").is(e.target) && $(".livesearch-popover").has(e.target).length === 0)
Severity: Minor
Found in lib/modules/Search/styles/javascript/livesearch.js and 1 other location - About 35 mins to fix
lib/modules/Notifications/styles/javascript/notifications.js on lines 11..11

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    if (Math.ceil(citepost.postcount / 20) != currentPage)
        loadThread(Math.ceil(citepost.postcount / 20));
Severity: Minor
Found in lib/modules/Forums/styles/javascript/thread.js and 1 other location - About 35 mins to fix
lib/modules/Forums/styles/javascript/thread.js on lines 157..158

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

jQuery.fn.show = function () {
    $(this).removeClass("hidden");
    return origShow.apply(this, arguments);
};
Severity: Minor
Found in lib/modules/Core/styles/javascript/cunity-core.js and 1 other location - About 35 mins to fix
lib/modules/Core/styles/javascript/cunity-core.js on lines 6..9

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

jQuery.fn.hide = function () {
    $(this).addClass("hidden");
    return origHide.apply(this, arguments);
};
Severity: Minor
Found in lib/modules/Core/styles/javascript/cunity-core.js and 1 other location - About 35 mins to fix
lib/modules/Core/styles/javascript/cunity-core.js on lines 2..5

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            d.size === n ? d.percent = f.length > 0 ? Math.ceil(d.uploaded / f.length * 100) : 0 : (d.bytesPerSec = Math.ceil(d.loaded / ((+(new Date) - p || 1) / 1e3)), d.percent = d.size > 0 ? Math.ceil(d.loaded / d.size * 100) : 0)
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 2 other locations - About 35 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 3305..3305
lib/plugins/plupload/js/plupload.full.min.js on lines 3312..3312

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (!$(".notification-popover").is(e.target) && $(".notification-popover").has(e.target).length === 0 && !$(".mini-profile-notification-bar").is(e.target) && $(".mini-profile-notification-bar").has(e.target).length === 0)
Severity: Minor
Found in lib/modules/Notifications/styles/javascript/notifications.js and 1 other location - About 35 mins to fix
lib/modules/Search/styles/javascript/livesearch.js on lines 31..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    case KEY.DOWN:
                        this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
                        killEvent(e);
                        return;
Severity: Minor
Found in lib/plugins/select2/select2.js and 1 other location - About 35 mins to fix
lib/plugins/select2/select2.js on lines 2794..2797

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    public function __construct($receiver, array $text)
    {
        parent::__construct();
        if ((!isset($receiver['name']) ||
                !isset($receiver['email'])) &&
Severity: Minor
Found in lib/modules/Core/View/Mail/TextMail.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 listFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function listFiles($userid = null)
    {
        if ($userid === null) {
            $userid = Session::get('user')->userid;
        }
Severity: Minor
Found in lib/modules/Filesharing/Models/Db/Table/Files.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($options)
    {
        $options = parent::__construct($options);

        if (isset($options['x1'])) {
Severity: Minor
Found in lib/Skoch/Filter/File/Crop.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($options)
    {
        $options = parent::__construct($options);

        if (!isset($options['width']) && !isset($options['height'])) {
Severity: Minor
Found in lib/Skoch/Filter/File/Resize.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 canWrite has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function canWrite()
    {
        $directory = new \RecursiveDirectoryIterator(__DIR__.'/../../../');
        $iterator = new \RecursiveIteratorIterator($directory);

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

    public function uploadImage($albumid, $newsfeed_post = false, $uploader_data = [])
    {
        if (isset($_FILES) && isset($_FILES['file']) && $albumid > 0) {
            $uploader = new Uploader();
            $file = $uploader->upload($albumid.sha1(Session::get('user')->userhash.time()).rand());
Severity: Minor
Found in lib/modules/Gallery/Models/Db/Table/GalleryImages.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 validateForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateForm()
    {
        $validateAlpha = new Zend_Validate_Alpha();
        $validateMail = new Email();
        $validateUsername = new Zend_Validate();
Severity: Minor
Found in lib/modules/Admin/Models/Register.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 evaluateAdapter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function evaluateAdapter($options)
    {
        if (isset($options['adapter'])) {
            if ($options['adapter'] instanceof
                AbstractAdapter
Severity: Minor
Found in lib/Skoch/Filter/File/AbstractFile.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 show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function show()
    {
        if (Login::loggedIn() && Get::get('m') !== 'admin') {
            $this->registerScript('search', 'livesearch');
            $this->registerScript('messages', 'message-modal');
Severity: Minor
Found in lib/modules/Core/View/View.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 isValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function isValid($value)
    {
        $this->_setValue($value);
        if (!is_array($value) || empty($value['month']) || empty($value['day']) || empty($value['year'])) {
            $this->_error(self::INVALID);
Severity: Minor
Found in lib/modules/Core/Models/Validation/Birthday.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 loadEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadEvent()
    {
        $events = new Events();
        if (Get::get('x') == 'edit') {
            $eventData = $events->getEventData(intval(Get::get('action')));
Severity: Minor
Found in lib/modules/Events/Models/Process.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 loadData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadData()
    {
        $langIterator = new \DirectoryIterator('modules/Core/languages');
        $designIterator = new \DirectoryIterator('../style');
        foreach ($designIterator as $design) {
Severity: Minor
Found in lib/modules/Admin/Models/Pages/Settings.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 addGuests has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function addGuests($eventid, $users, $status = 0, $invitation = false)
    {
        if (is_array($users) && !empty($users)) {
            foreach ($users as $user) {
                $this->insert(['userid' => intval($user), 'eventid' => intval($eventid), 'status' => $status]);
Severity: Minor
Found in lib/modules/Events/Models/Db/Table/Guests.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

Severity
Category
Status
Source
Language