diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh
index 4e1211b2657cf1c9f99646604e95610b0470e4d2..1c0742a63e050cf7463528f82a88e51b1cfea8e7 100755
--- a/core/scripts/dev/commit-code-check.sh
+++ b/core/scripts/dev/commit-code-check.sh
@@ -107,10 +107,17 @@
 
 TOP_LEVEL=$(git rev-parse --show-toplevel)
 
+# This variable will be set to one when the file core/phpcs.xml.dist is changed.
+PHPCS_XML_DIST_FILE_CHANGED=0
+
 # Build up a list of absolute file names.
 ABS_FILES=
 for FILE in $FILES; do
   ABS_FILES="$ABS_FILES $TOP_LEVEL/$FILE"
+
+  if [[ $FILE == "core/phpcs.xml.dist" ]]; then
+    PHPCS_XML_DIST_FILE_CHANGED=1;
+  fi;
 done
 
 # Exit early if there are no files.
@@ -163,6 +170,20 @@
 printf -- '-%.0s' {1..100}
 printf "\n"
 
+# When the file core/phpcs.xml.dist has been changed, then PHPCS must check all files.
+if [[ $PHPCS_XML_DIST_FILE_CHANGED == "1" ]]; then
+  # Test all files with phpcs rules.
+  vendor/bin/phpcs -ps --runtime-set installed_paths "$TOP_LEVEL/vendor/drupal/coder/coder_sniffer" --standard="$TOP_LEVEL/core/phpcs.xml.dist"
+  PHPCS=$?
+  if [ "$PHPCS" -ne "0" ]; then
+    # If there are failures set the status to a number other than 0.
+    FINAL_STATUS=1
+    printf "\nPHPCS: ${red}failed${reset}\n"
+  else
+    printf "\nPHPCS: ${green}passed${reset}\n"
+  fi
+fi
+
 for FILE in $FILES; do
   STATUS=0;
   # Print a line to separate spellcheck output from per file output.
@@ -199,7 +220,7 @@
   ############################################################################
   ### PHP AND YAML FILES
   ############################################################################
-  if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.(inc|install|module|php|profile|test|theme|yml)$ ]]; then
+  if [[ -f "$TOP_LEVEL/$FILE" ]] && [[ $FILE =~ \.(inc|install|module|php|profile|test|theme|yml)$ ]] && [[ $PHPCS_XML_DIST_FILE_CHANGED == "0" ]]; then
     # Test files with phpcs rules.
     vendor/bin/phpcs "$TOP_LEVEL/$FILE" --runtime-set installed_paths "$TOP_LEVEL/vendor/drupal/coder/coder_sniffer" --standard="$TOP_LEVEL/core/phpcs.xml.dist"
     PHPCS=$?