Function unpackTicketInfo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function unpackTicketInfo($ticket_info, $fields) {
$ticket = array();
foreach($fields as $k => $v) {
# set a default value
$ticket[$k] = "";
- 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 merge_jira_tickets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static function merge_jira_tickets($tickets, $curl = null) {
if (empty($tickets)) {
return 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
Similar blocks of code found in 4 locations. Consider refactoring. Open
static function get_jira_tickets_for_event($event_id, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
$columns = array('id', 'ticket');
$table = 'jira';
$where = array(
- 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 125.
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 3 locations. Consider refactoring. Open
static function save_jira_tickets_for_event($event_id, $tickets, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
$table_name = 'jira';
$assoc_column = 'ticket';
if (is_null($conn)) {
- 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 101.
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
static function get_ticket($theid, $conn = null) {
$conn = $conn ?: Persistence::get_database_object();
$columns = array('id', 'ticket');
$table_name = 'jira';
if (is_null($conn)) {
- 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 101.
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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class JiraClient {
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Jira {
- Exclude checks
Each class must be in a file by itself Open
class JiraClient {
- Exclude checks
Method name "Jira::get_ticket" is not in camel caps format Open
static function get_ticket($theid, $conn = null) {
- Exclude checks
Method name "Jira::save_jira_tickets_for_event" is not in camel caps format Open
static function save_jira_tickets_for_event($event_id, $tickets, $conn = null) {
- Exclude checks
Method name "Jira::delete_ticket" is not in camel caps format Open
static function delete_ticket($theid, $conn = null) {
- Exclude checks
Method name "Jira::merge_jira_tickets" is not in camel caps format Open
static function merge_jira_tickets($tickets, $curl = null) {
- Exclude checks
The closing brace for the class must go on the next line after the body Open
}
- Exclude checks
Method name "Jira::get_jira_tickets_for_event" is not in camel caps format Open
static function get_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Visibility must be declared on method "get_jira_tickets_for_event" Open
static function get_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Method name "Jira::delete_jira_tickets_for_event" is not in camel caps format Open
static function delete_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Visibility must be declared on method "get_ticket" Open
static function get_ticket($theid, $conn = null) {
- Exclude checks
Opening brace of a class must be on the line after the definition Open
class Jira {
- Exclude checks
Visibility must be declared on method "merge_jira_tickets" Open
static function merge_jira_tickets($tickets, $curl = null) {
- Exclude checks
Opening brace of a class must be on the line after the definition Open
class JiraClient {
- Exclude checks
Visibility must be declared on method "save_jira_tickets_for_event" Open
static function save_jira_tickets_for_event($event_id, $tickets, $conn = null) {
- Exclude checks
Visibility must be declared on method "delete_jira_tickets_for_event" Open
static function delete_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Method name "Jira::undelete_ticket" is not in camel caps format Open
static function undelete_ticket($theid, $conn = null) {
- Exclude checks
Visibility must be declared on method "getJiraApiResponse" Open
function getJiraApiResponse($jira_key_input, $fields) {
- Exclude checks
Visibility must be declared on method "delete_ticket" Open
static function delete_ticket($theid, $conn = null) {
- Exclude checks
Function closing brace must go on the next line following the body; found 1 blank lines before brace Open
}
- Exclude checks
Visibility must be declared on method "undelete_ticket" Open
static function undelete_ticket($theid, $conn = null) {
- Exclude checks
Space found before comma in function call Open
$response = $this->curl_client->get($this->getJiraBaseUrl() . '/rest/api/2/search' , $params, $this->username . ':' . $this->password, $this->proxy);
- Exclude checks
Visibility must be declared on method "__construct" Open
function __construct($curl_client, $config = null) {
- Exclude checks
Function closing brace must go on the next line following the body; found 1 blank lines before brace Open
}
- Exclude checks
Visibility must be declared on method "getJiraTickets" Open
function getJiraTickets($jira_key_input, $api_response = null) {
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
return Persistence::store_array($table_name, $assoc_column, $tickets,
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$event_id, $conn);
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
return Persistence::store_array($table_name, $assoc_column, $tickets,
- Exclude checks
Opening brace should be on a new line Open
static function delete_ticket($theid, $conn = null) {
- Exclude checks
Opening brace should be on a new line Open
static function get_ticket($theid, $conn = null) {
- Exclude checks
Opening brace should be on a new line Open
static function get_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Opening brace should be on a new line Open
static function delete_jira_tickets_for_event($event_id, $conn = null) {
- Exclude checks
Opening brace should be on a new line Open
static function merge_jira_tickets($tickets, $curl = null) {
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($tickets as $k => $v) {
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 40 Open
$event_id, $conn);
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
$event_id, $conn);
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
return Persistence::store_array($table_name, $assoc_column, $tickets,
- Exclude checks
Opening brace should be on a new line Open
function __construct($curl_client, $config = null) {
- Exclude checks
Opening brace should be on a new line Open
public function unpackTicketInfo($ticket_info, $fields) {
- Exclude checks
Opening brace should be on a new line Open
public function getAdditionalIssueFields() {
- Exclude checks
Opening brace should be on a new line Open
static function undelete_ticket($theid, $conn = null) {
- Exclude checks
Expected 1 space after FOREACH keyword; 0 found Open
foreach($fields as $k => $v) {
- Exclude checks
Opening brace should be on a new line Open
static function save_jira_tickets_for_event($event_id, $tickets, $conn = null) {
- Exclude checks
Opening brace should be on a new line Open
function getJiraApiResponse($jira_key_input, $fields) {
- Exclude checks
A closing tag is not permitted at the end of a PHP file Open
?>
- Exclude checks
Opening brace should be on a new line Open
public function getJiraBaseUrl() {
- Exclude checks
Opening brace should be on a new line Open
function getJiraTickets($jira_key_input, $api_response = null) {
- Exclude checks