felixarntz/plugin-lib

View on GitHub

Showing 821 of 821 total issues

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

<?php
/**
 * Translations for the Post_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-post-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

<?php
/**
 * Translations for the User_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-user-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41

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

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

<?php
/**
 * Translations for the Error_Handler class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-error-handler.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

<?php
/**
 * Translations for the Term_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-term-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

<?php
/**
 * Translations for the Site_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-site-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

<?php
/**
 * Translations for the Network_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-network-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-comment-manager.php on lines 1..41
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

        public function sanitize_statuses( $statuses, $request, $parameter ) {
            $capabilities = $this->manager->capabilities();

            $public_statuses = $this->manager->statuses()->get_public();

Severity: Major
Found in src/db-objects/rest-models-controller.php and 1 other location - About 4 hrs to fix
src/db-objects/rest-models-controller.php on lines 1171..1194

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

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

<?php
/**
 * Translations for the Comment_Manager class
 *
 * @package Leaves_And_Love\Plugin_Lib
Severity: Major
Found in src/translations/translations-comment-manager.php and 6 other locations - About 4 hrs to fix
src/translations/translations-error-handler.php on lines 1..48
src/translations/translations-network-manager.php on lines 1..41
src/translations/translations-post-manager.php on lines 1..41
src/translations/translations-site-manager.php on lines 1..41
src/translations/translations-term-manager.php on lines 1..41
src/translations/translations-user-manager.php on lines 1..41

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

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

        public function sanitize_types( $types, $request, $parameter ) {
            $capabilities = $this->manager->capabilities();

            $public_types = $this->manager->types()->get_public();

Severity: Major
Found in src/db-objects/rest-models-controller.php and 1 other location - About 4 hrs to fix
src/db-objects/rest-models-controller.php on lines 1136..1159

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

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 enqueue has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function enqueue() {
            if ( ! $this->enqueued( '_core' ) ) {
                $this->library_assets()->register_style(
                    'fields',
                    'assets/dist/css/fields.css',
Severity: Major
Found in src/fields/field-manager.php - About 4 hrs to fix

    Manager has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

        abstract class Manager extends Service {
            use Container_Service_Trait, Hook_Service_Trait, Translations_Service_Trait;
    
            /**
             * The model class name.
    Severity: Minor
    Found in src/db-objects/manager.php - About 4 hrs to fix

      Function to_json has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              public function to_json( $current_value ) {
                  $this->maybe_resolve_dependencies();
      
                  if ( $this->is_repeatable() ) {
                      $current_value = (array) $current_value;
      Severity: Minor
      Found in src/fields/field.php - About 4 hrs to fix

      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 enqueue has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

              public function enqueue() {
                  if ( ! $this->enqueued( '_core' ) ) {
                      $this->library_assets()->register_style(
                          'fields',
                          'assets/dist/css/fields.css',
      Severity: Minor
      Found in src/fields/field-manager.php - About 4 hrs to fix

      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 get_item_schema has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function get_item_schema() {
                  $schema = array(
                      '$schema'    => 'http://json-schema.org/schema#',
                      'title'      => $this->manager->get_singular_slug(),
                      'type'       => 'object',
      Severity: Major
      Found in src/db-objects/rest-models-controller.php - About 4 hrs to fix

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

                protected function do_settings_sections( $page ) {
                    global $wp_settings_sections, $wp_settings_fields;
        
                    if ( ! isset( $wp_settings_sections[ $page ] ) ) {
                        return;
        Severity: Major
        Found in src/components/settings-page.php and 1 other location - About 4 hrs to fix
        src/components/tabbed-settings-page.php on lines 340..365

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

        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

                protected function do_settings_sections( $page ) {
                    global $wp_settings_sections, $wp_settings_fields;
        
                    if ( ! isset( $wp_settings_sections[ $page ] ) ) {
                        return;
        Severity: Major
        Found in src/components/tabbed-settings-page.php and 1 other location - About 4 hrs to fix
        src/components/settings-page.php on lines 344..369

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

        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

        Function list_ has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                public function list_( $args, $assoc_args ) {
                    $formatter = $this->get_formatter( $assoc_args );
        
                    $query_args = array_merge( array( 'number' => -1 ), $assoc_args );
                    $query_args = self::process_csv_arguments_to_arrays( $query_args );
        Severity: Minor
        Found in src/db-objects/cli-models-command.php - About 3 hrs to fix

        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

        DB has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

            class DB extends Service {
                use Hook_Service_Trait, Container_Service_Trait, Translations_Service_Trait;
        
                /**
                 * WordPress database abstraction object.
        Severity: Minor
        Found in src/db.php - About 3 hrs to fix

          Method maybe_route_request has 94 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  protected function maybe_route_request( $parse_request, $wp, $extra_query_vars ) {
                      if ( is_admin() || ! $parse_request ) {
                          return $parse_request;
                      }
          
          
          Severity: Major
          Found in src/router.php - About 3 hrs to fix

            Function __set has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function __set( $property, $value ) {
                        if ( $property === $this->manager->get_primary_property() ) {
                            return;
                        }
            
            
            Severity: Minor
            Found in src/db-objects/model.php - About 3 hrs to fix

            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

            Severity
            Category
            Status
            Source
            Language