diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 554bc00..e5db90f 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -40,22 +40,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Determine the base branch for the file diff - id: base_branch - env: - BASE_REF: ${{ github.base_ref }} - run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - echo "NAME=$BASE_REF" >> $GITHUB_OUTPUT - echo "REF=origin/$BASE_REF" >> $GITHUB_OUTPUT - else - echo 'NAME=main' >> $GITHUB_OUTPUT - echo "REF=origin/main" >> $GITHUB_OUTPUT - fi - - - name: Fetch base branch - run: git fetch --no-tags --depth=1 origin ${{ steps.base_branch.outputs.NAME }} - - name: Install PHP uses: shivammathur/setup-php@v2 with: @@ -76,18 +60,12 @@ jobs: # Bust the cache at least once a month - output format: YYYY-MM. custom-cache-suffix: $(date -u "+%Y-%m") - # Check the codestyle of the files against a threshold of expected errors and warnings. - - name: Check PHP code style against the thresholds - run: composer check-cs-thresholds - - # Check the codestyle only of the files which were changed in the current branch. - # This step will only be executed if the threshold check exited with a failure status. - # The results of this CS check will be shown inline in the PR via the CS2PR tool. + # Check the codestyle of the files. + # The results of the CS check will be shown inline in the PR via the CS2PR tool. # @link https://github.com/staabm/annotate-pull-request-from-checkstyle/ - - name: Check PHP code style for the changes made in the branch only - if: ${{ failure() }} + - name: Check PHP code style id: phpcs - run: composer check-branch-cs -- ${{ steps.base_branch.outputs.REF }} + run: composer check-cs-warnings -- --no-cache --report-full --report-checkstyle=./phpcs-report.xml - name: Show PHPCS results in PR if: ${{ always() && steps.phpcs.outcome == 'failure' }} diff --git a/composer.json b/composer.json index 7aad5d8..f5ca1fe 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "Yoast\\WHIP\\Config\\Composer\\Actions::check_coding_standards" ], "check-cs-thresholds": [ - "@putenv YOASTCS_THRESHOLD_ERRORS=10", + "@putenv YOASTCS_THRESHOLD_ERRORS=0", "@putenv YOASTCS_THRESHOLD_WARNINGS=0", "Yoast\\WHIP\\Config\\Composer\\Actions::check_cs_thresholds" ], diff --git a/src/Configuration.php b/src/Configuration.php index 1d6fdc1..012dc57 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -13,14 +13,14 @@ class Configuration { /** * The configuration to use. * - * @var array + * @var array */ private $configuration; /** * Configuration constructor. * - * @param array $configuration The configuration to use. + * @param array $configuration The configuration to use. * * @throws InvalidType When the $configuration parameter is not of the expected type. */ diff --git a/src/Exceptions/InvalidVersionComparisonString.php b/src/Exceptions/InvalidVersionComparisonString.php index 0356fef..2456589 100644 --- a/src/Exceptions/InvalidVersionComparisonString.php +++ b/src/Exceptions/InvalidVersionComparisonString.php @@ -6,6 +6,8 @@ /** * Exception for an invalid version comparison string. + * + * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- Name should be descriptive and was historically (before namespacing) already set to this. */ class InvalidVersionComparisonString extends Exception { diff --git a/src/Facades/wordpress.php b/src/Facades/wordpress.php index e5adc44..dbb1df9 100644 --- a/src/Facades/wordpress.php +++ b/src/Facades/wordpress.php @@ -15,7 +15,7 @@ /** * Facade to quickly check if version requirements are met. * - * @param array $requirements The requirements to check. + * @param array $requirements The requirements to check. * * @return void */ diff --git a/src/Messages/InvalidVersionRequirementMessage.php b/src/Messages/InvalidVersionRequirementMessage.php index db30012..f3e4959 100644 --- a/src/Messages/InvalidVersionRequirementMessage.php +++ b/src/Messages/InvalidVersionRequirementMessage.php @@ -7,6 +7,8 @@ /** * Class Whip_InvalidVersionMessage. + * + * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded -- Name should be descriptive and was historically (before namespacing) already set to this. */ class InvalidVersionRequirementMessage implements Message { diff --git a/src/MessagesManager.php b/src/MessagesManager.php index 939c7ac..eee0abb 100644 --- a/src/MessagesManager.php +++ b/src/MessagesManager.php @@ -44,7 +44,7 @@ public function hasMessages() { /** * Lists the messages that are currently available. * - * @return array The messages that are currently set. + * @return array The messages that are currently set. */ public function listMessages() { return $GLOBALS['whip_messages']; @@ -79,9 +79,9 @@ public function getLatestMessage() { /** * Sorts the list of messages based on the version number. * - * @param array $messages The list of messages to sort. + * @param array $messages The list of messages to sort. * - * @return array The sorted list of messages. + * @return array The sorted list of messages. */ private function sortByVersion( array $messages ) { \uksort( $messages, 'version_compare' ); diff --git a/src/RequirementsChecker.php b/src/RequirementsChecker.php index 73f491b..70bd275 100644 --- a/src/RequirementsChecker.php +++ b/src/RequirementsChecker.php @@ -16,7 +16,7 @@ class RequirementsChecker { /** * Requirements the environment should comply with. * - * @var array + * @var array */ private $requirements; @@ -44,8 +44,8 @@ class RequirementsChecker { /** * RequirementsChecker constructor. * - * @param array $configuration The configuration to check. - * @param string $textdomain The text domain to use for translations. + * @param array $configuration The configuration to check. + * @param string $textdomain The text domain to use for translations. * * @throws InvalidType When the $configuration parameter is not of the expected type. */