MinnPost/object-sync-for-salesforce

View on GitHub
bin/wp-readme.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method wp_readme_visibility has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_readme_visibility( $string ) {
    // Remove github comment.
    $string = preg_replace( '#<!-- only:github/ -->(.*?)<!-- /only:github -->#us', '', $string );
    // Display WordPress comment.
    $string = preg_replace_callback(
Severity: Minor
Found in bin/wp-readme.php - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

        return $string;
    Severity: Major
    Found in bin/wp-readme.php - About 30 mins to fix

      Function wp_readme_find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function wp_readme_find( $target_dir = '.' ) {
          $target_dir = rtrim( $target_dir, DIRECTORY_SEPARATOR );
          if ( is_dir( $target_dir ) ) {
              foreach ( scandir( $target_dir ) as $file ) {
                  if ( in_array( $file, array( 'readme.md', 'README.md' ), true ) ) {
      Severity: Minor
      Found in bin/wp-readme.php - About 25 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

      Silencing errors is discouraged
      Open

          if ( ! @ file_put_contents( $new_file, $string ) ) {
      Severity: Minor
      Found in bin/wp-readme.php by phpcodesniffer

      Assignments must be the first block of code on a line
      Open

          if ( $var = getenv( 'WP_README_ENV' ) ) {
      Severity: Minor
      Found in bin/wp-readme.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status