Alecaddd/awps

View on GitHub

Showing 27 of 27 total issues

Function edit has 167 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    edit( { attributes, className, setAttributes } ) {
        const {
            title,
            body,
            backgroundImage,
Severity: Major
Found in assets/src/scripts/blocks/cta.js - About 6 hrs to fix

    Method custom_post_type has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function custom_post_type()
        {
            /**
             * Add the post types and their details
             */
    Severity: Major
    Found in inc/Custom/PostTypes.php - About 3 hrs to fix

      File cta.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const { registerBlockType } = wp.blocks;
      const {
          PlainText,
          RichText,
          MediaUpload,
      Severity: Minor
      Found in assets/src/scripts/blocks/cta.js - About 2 hrs to fix

        Method register has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function register( $wp_customize ) 
            {
                $wp_customize->add_section( 'awps_header_section' , array(
                    'title' => __( 'Header', 'awps' ),
                    'description' => __( 'Customize the Header' ),
        Severity: Major
        Found in inc/Api/Customizer/Header.php - About 2 hrs to fix

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

                                  <div
                                      style={ {
                                          marginTop: '20px',
                                          marginBottom: '40px',
                                      } }
          Severity: Major
          Found in assets/src/scripts/blocks/cta.js and 1 other location - About 2 hrs to fix
          assets/src/scripts/blocks/cta.js on lines 156..169

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

          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

                                  <div
                                      style={ {
                                          marginTop: '20px',
                                          marginBottom: '40px',
                                      } }
          Severity: Major
          Found in assets/src/scripts/blocks/cta.js and 1 other location - About 2 hrs to fix
          assets/src/scripts/blocks/cta.js on lines 123..136

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

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

              function mix($path, $manifestDirectory = '')
              {
                  if (! $manifestDirectory) {
                      //Setup path for standard AWPS-Folder-Structure
                      $manifestDirectory = "assets/dist/";
          Severity: Minor
          Found in inc/Helpers.php - About 2 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 save has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              save( { attributes } ) {
                  const {
                      title,
                      body,
                      titleColor,
          Severity: Minor
          Found in assets/src/scripts/blocks/cta.js - About 1 hr to fix

            Method start_el has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
                {
                    $indent = ($depth) ? str_repeat("\t", $depth) : '';
            
                    $li_attributes = '';
            Severity: Minor
            Found in inc/Core/WalkerNav.php - About 1 hr to fix

              Function display_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
                  {
                      if (!$element) {
                          return;
                      }
              Severity: Minor
              Found in inc/Core/WalkerNav.php - About 1 hr 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 register has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function register( $wp_customize ) 
                  {
                      $wp_customize->add_section( 'awps_footer_section' , array(
                          'title' => __( 'Footer', 'awps' ),
                          'description' => __( 'Customize the Footer' ),
              Severity: Minor
              Found in inc/Api/Customizer/Footer.php - About 1 hr to fix

                Function admin_scripts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function admin_scripts( $hook )
                    {
                        // dd( $hook );
                        $this->enqueue_on_pages = ( !empty( $this->enqueue_on_pages ) ) ? $this->enqueue_on_pages : array( $hook );
                
                
                Severity: Minor
                Found in inc/Api/Settings.php - About 1 hr 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 gutenberg_init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function gutenberg_init()
                    {
                        add_theme_support( 'gutenberg', array(
                            // Theme supports responsive video embeds
                            'responsive-embeds' => true,
                Severity: Minor
                Found in inc/Api/Gutenberg.php - About 1 hr to fix

                  Method display_element has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
                      {
                          if (!$element) {
                              return;
                          }
                  Severity: Minor
                  Found in inc/Core/WalkerNav.php - About 1 hr to fix

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

                                            <RichText
                                                key="editable"
                                                tagName="p"
                                                className={ className }
                                                placeholder="Your CTA Description"
                    Severity: Major
                    Found in assets/src/scripts/blocks/cta.js and 1 other location - About 1 hr to fix
                    assets/src/scripts/blocks/cta.js on lines 197..205

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

                    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

                                            <RichText
                                                key="editable"
                                                tagName="h3"
                                                className={ className }
                                                placeholder="Your CTA title"
                    Severity: Major
                    Found in assets/src/scripts/blocks/cta.js and 1 other location - About 1 hr to fix
                    assets/src/scripts/blocks/cta.js on lines 207..215

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

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

                        public function setup()
                        {
                            /*
                             * You can activate this if you're planning to build a multilingual theme
                             */
                    Severity: Minor
                    Found in inc/Setup/Setup.php - About 1 hr to fix

                      Method mix has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function mix($path, $manifestDirectory = '')
                          {
                              if (! $manifestDirectory) {
                                  //Setup path for standard AWPS-Folder-Structure
                                  $manifestDirectory = "assets/dist/";
                      Severity: Minor
                      Found in inc/Helpers.php - About 1 hr to fix

                        Function entry_footer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function entry_footer()
                            {
                        
                                // Hide category and tag text for pages.
                                if ('post' === get_post_type()) {
                        Severity: Minor
                        Found in inc/Core/Tags.php - About 55 mins 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

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

                                const {
                                    title,
                                    body,
                                    titleColor,
                                    bodyColor,
                        Severity: Minor
                        Found in assets/src/scripts/blocks/cta.js and 1 other location - About 55 mins to fix
                        assets/src/scripts/blocks/cta.js on lines 62..72

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language