Showing 1,422 of 1,422 total issues
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
$app->get('/events/:id/images/:img', function($id, $img) use ($app) {
header("Content-Type: application/json");
$image = Images::get_image($img);
if ($image["status"] == Images::ERROR) {
$app->response->status(404);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
$app->get('/events/:id/why_surprised', function($id) use ($app) {
$event = Postmortem::get_event($id);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
$app->get('/events/:id/channels/:channel', function($id, $channel) use ($app) {
header("Content-Type: application/json");
$chan = Irc::get_channel($channel);
if ($chan["status"] == Irc::ERROR) {
$app->response->status(404);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function store_array
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static function store_array($table_name, $assoc_column, $values, $postmortem_id, $conn) {
try {
foreach ($values as $value) {
$select_sql = 'SELECT postmortem_id, id, deleted ' .
' FROM ' . $table_name .
- Read upRead up
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
Each class must be in a file by itself Open
class JiraClient {
- Exclude checks
Function get_channel_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_channel_data(url, params, channels, success_callback, error_callback) {
Method get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function get($url, array $params = null, $user_pass = null, $proxy = null,
$timeout = 10) {
Function confirm_delete
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function confirm_delete(message, insert, context, onConfirm, onDisappear) {
Method store_array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
static function store_array($table_name, $assoc_column, $values, $postmortem_id, $conn) {
Method name "ContactTest::test_getUrlForUser_lookupDefined" is not in camel caps format Open
public function test_getUrlForUser_lookupDefined() {
- Exclude checks
Function delete_tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static function delete_tag($tag_id, $event_id = null, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
if (is_null($conn)) {
return array("status" => self::ERROR,
"error" => "Couldn't get connection object.");
- Read upRead up
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
Opening brace of a class must be on the line after the definition Open
class ContactTest extends \PHPUnit\Framework\TestCase {
- Exclude checks
Function get_configuration
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static function get_configuration($name = null) {
$enviroment = getenv('MORGUE_ENVIRONMENT') ?: 'development';
$configfile = dirname(__FILE__).'/../config/'.$enviroment.'.json';
$config = json_decode(file_get_contents($configfile), true);
if (is_null($name)) {
- Read upRead up
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 name "ContactTest::test_getHtmlForUser_lookupDefined" is not in camel caps format Open
public function test_getHtmlForUser_lookupDefined() {
- Exclude checks
Method name "ContactTest::test_getUrlForUser_nolookupDefined" is not in camel caps format Open
public function test_getUrlForUser_nolookupDefined() {
- Exclude checks
Method name "ContactTest::test_getHtmlForUser_nolookupDefined" is not in camel caps format Open
public function test_getHtmlForUser_nolookupDefined() {
- Exclude checks
Function undelete_tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static function undelete_tag($tag_id, $event_id = null, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
if (is_null($conn)) {
return array("status" => self::ERROR,
"error" => "Couldn't get connection object.");
- Read upRead up
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 get_slack_channels_list
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_slack_channels_list() {
if (function_exists("morgue_get_slack_channels_list")) {
return morgue_get_slack_channels_list();
} else {
$queryParam = array(
- Read upRead up
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
Opening brace of a class must be on the line after the definition Open
class CurlClientTest extends \PHPUnit\Framework\TestCase {
- Exclude checks