features/links/routes.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    if ($res["status"] == Links::ERROR) {
        $app->response->status(400);
    } else {
        $app->response->status(201);
        $forum_links = Links::get_forum_links_for_event($id);
Severity: Major
Found in features/links/routes.php and 2 other locations - About 1 hr to fix
features/images/routes.php on lines 20..32
htdocs/index.php on lines 497..509

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 120.

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

$app->get('/events/:id/forum_links', function($id) use ($app) {
    header("Content-Type: application/json");
    $forum_links = Links::get_forum_links_for_event($id);
    if ($forum_links["status"] == Links::ERROR) {
        $app->response->status(404);
Severity: Major
Found in features/links/routes.php and 1 other location - About 1 hr to fix
features/images/routes.php on lines 3..13

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 112.

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 4 locations. Consider refactoring.
Open

$app->delete('/events/:id/forum_links/:forum_link', function($id, $forum_link) use ($app) {
    header("Content-Type: application/json");
    $res = Links::delete_forum_link($forum_link);
    if ($res["status"] == Links::ERROR) {
        $app->response->status(500);
Severity: Major
Found in features/links/routes.php and 3 other locations - About 1 hr to fix
features/images/routes.php on lines 45..54
features/irc/routes.php on lines 45..55
features/jira/routes.php on lines 49..59

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 106.

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 4 locations. Consider refactoring.
Open

$app->get('/events/:id/forum_links/:forum_link', function($id, $forum_link) use ($app) {
    header("Content-Type: application/json");
    $forum_link = Links::get_forum_link($img); //need to find this function
    if ($forum_link["status"] == Links::ERROR) {
        $app->response->status(404);
Severity: Major
Found in features/links/routes.php and 3 other locations - About 45 mins to fix
features/images/routes.php on lines 34..44
features/irc/routes.php on lines 34..44
features/jira/routes.php on lines 38..48

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 96.

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

Expected 1 space after FUNCTION keyword; 0 found
Open

$app->post('/events/:id/forum_links', function($id) use ($app) {
Severity: Minor
Found in features/links/routes.php by phpcodesniffer

Expected 1 space after FUNCTION keyword; 0 found
Open

$app->get('/events/:id/forum_links/:forum_link', function($id, $forum_link) use ($app) {
Severity: Minor
Found in features/links/routes.php by phpcodesniffer

Expected 1 space after FUNCTION keyword; 0 found
Open

$app->get('/events/:id/forum_links', function($id) use ($app) {
Severity: Minor
Found in features/links/routes.php by phpcodesniffer

Expected 1 space after FUNCTION keyword; 0 found
Open

$app->delete('/events/:id/forum_links/:forum_link', function($id, $forum_link) use ($app) {
Severity: Minor
Found in features/links/routes.php by phpcodesniffer

There are no issues that match your filters.

Category
Status