Showing 2,743 of 2,743 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
gulp.task('dfp-scripts', function() {
return gulp.src('./assets/js/dfp-ads.js')
.pipe(rename('dfp-ads.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./assets/js/'));
- Read upRead up
- Create a ticketCreate a ticket
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 66.
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
gulp.task('ads-scripts', function() {
return gulp.src('./assets/js/google-ads.js')
.pipe(rename('google-ads.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./assets/js/'));
- Read upRead up
- Create a ticketCreate a ticket
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 66.
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
Method create_input
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create_input(){
global $post;
?>
<tr>
<td><label for="<?php echo $this->id; ?>" class="dfp-row-title"><?php printf( __( $this->label, 'dfp-ads' ) ); ?></label></td>
- Create a ticketCreate a ticket
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class DFP_Ads_Widget extends WP_Widget {
- Create a ticketCreate a ticket
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 48 and the first side effect is on line 25. Open
<?php
- Create a ticketCreate a ticket
- Exclude checks
Method name "DFP_Ads::set_account_id" is not in camel caps format Open
public function set_account_id( $id ) {
- Create a ticketCreate a ticket
- Exclude checks
Method name "DFP_Ads::set_asynchronous_loading" is not in camel caps format Open
public function set_asynchronous_loading( $val ) {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces between argument "$val" and closing bracket; 1 found Open
public function set_asynchronous_loading( $val ) {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces between argument "$id" and closing bracket; 1 found Open
public function set_account_id( $id ) {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces between opening bracket and argument "$id"; 1 found Open
public function set_account_id( $id ) {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces between opening bracket and argument "$val"; 1 found Open
public function set_asynchronous_loading( $val ) {
- Create a ticketCreate a ticket
- Exclude checks
Method name "DFP_Ads::set_targeting" is not in camel caps format Open
public function set_targeting() {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( $wp->request != null ) {
- Create a ticketCreate a ticket
- Exclude checks
Opening brace of a class must be on the line after the definition Open
Class DFP_Ads {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( count( $url_parts ) >= 2 ) {
- Create a ticketCreate a ticket
- Exclude checks
Method name "DFP_Ads::get_tag_targeting" is not in camel caps format Open
protected function get_tag_targeting() {
- Create a ticketCreate a ticket
- Exclude checks
PHP keywords must be lowercase; expected "class" but found "Class" Open
Class DFP_Ads {
- Create a ticketCreate a ticket
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if ( $tags ) {
- Create a ticketCreate a ticket
- Exclude checks
Space found before closing bracket of FOREACH loop Open
foreach ( $tags as $tag ) {
- Create a ticketCreate a ticket
- Exclude checks