ThatGerber/dfp-ads

View on GitHub

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/'));
Severity: Major
Found in gulpfile.js and 1 other location - About 1 hr to fix
gulpfile.js on lines 22..27

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

Further Reading

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/'));
Severity: Major
Found in gulpfile.js and 1 other location - About 1 hr to fix
gulpfile.js on lines 30..35

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

Further Reading

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>
Severity: Minor
Found in includes/admin/Input.php - About 1 hr to fix

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 {

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
Severity: Minor
Found in plugin.php by phpcodesniffer

Method name "DFP_Ads::set_account_id" is not in camel caps format
Open

    public function set_account_id( $id ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Method name "DFP_Ads::set_asynchronous_loading" is not in camel caps format
Open

    public function set_asynchronous_loading( $val ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces between argument "$val" and closing bracket; 1 found
Open

    public function set_asynchronous_loading( $val ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces between argument "$id" and closing bracket; 1 found
Open

    public function set_account_id( $id ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces between opening bracket and argument "$id"; 1 found
Open

    public function set_account_id( $id ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces between opening bracket and argument "$val"; 1 found
Open

    public function set_asynchronous_loading( $val ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Method name "DFP_Ads::set_targeting" is not in camel caps format
Open

    public function set_targeting() {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        if ( $wp->request != null ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

Class DFP_Ads {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( count( $url_parts ) >= 2 ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Method name "DFP_Ads::get_tag_targeting" is not in camel caps format
Open

    protected function get_tag_targeting() {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

PHP keywords must be lowercase; expected "class" but found "Class"
Open

Class DFP_Ads {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            if ( $tags ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

                foreach ( $tags as $tag ) {
Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer

Blank line found at end of control structure
Open


Severity: Minor
Found in includes/DFP_Ads.php by phpcodesniffer
Severity
Category
Status
Source
Language