Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295131

commit-code-check.sh gives unclear output when CSS is not properly rebuilt

$
0
0

Problem/Motivation

Discovered in #3206643-135: Project messaging channel in core (as experimental) . When there was a change to the CSS but it was not recompiled, the code quality checks failed without explicitly saying why. The testbot output was just:

----------------------------------------------------------------------------------------------------
Checking core/modules/announcements_feed/css/announcements_feed.toolbar.css

core/modules/announcements_feed/css/announcements_feed.toolbar.css passed

----------------------------------------------------------------------------------------------------
Checking core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css

yarn run v1.22.19
$ node ./scripts/css/postcss-build.js --check --file /var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css
[01:52:51] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is being checked.
[01:52:52] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is not updated.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
STYLELINT: core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css passed

In the verbose output from the testrunner, it said:

16:42:56 ----------------------------------------------------------------------------------------------------
16:42:56 Checking core/modules/announcements_feed/css/announcements_feed.toolbar.css
16:42:56 
16:42:56 core/modules/announcements_feed/css/announcements_feed.toolbar.css passed
16:42:56 
16:42:56 ----------------------------------------------------------------------------------------------------
16:42:56 Checking core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css
16:42:56 
16:42:56 yarn run v1.22.19
16:42:56 $ node ./scripts/css/postcss-build.js --check --file /var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css
16:42:57 [22:42:57] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is being checked.
16:42:58 [22:42:58] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is not updated.
16:42:58 error Command failed with exit code 1.
16:42:58 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
16:42:58 STYLELINT: core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css passed
16:42:58 
16:42:58 ---------------------------------------------------------------------------------------------------

...with no indication of what the error was.

I think the problem is around here:

    # PostCSS
    if [[ "$COMPILE_CHECK" == "1" ]] && [[ -f "$TOP_LEVEL/$BASENAME.pcss.css" ]]; then
      cd "$TOP_LEVEL/core"
      yarn run build:css --check --file "$TOP_LEVEL/$BASENAME.pcss.css"
      CORRECTCSS=$?
      if [ "$CORRECTCSS" -ne "0" ]; then
        # No need to write any output the yarn run command will do this for
        # us.
        STATUS=1
      fi
      cd $TOP_LEVEL
    fi
  fi

There is no code to print a message if $STATUS is 1. The inline comment indicates an overconfidence in the usefulness of the debug output from Yarn.

Proposed resolution

Change the script to output s clearer message, e.g.:

Checking core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css

yarn run v1.22.19
$ node ./scripts/css/postcss-build.js --check --file /var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css
[21:22:26] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is being checked.
[21:22:27] '/var/www/html/core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css' is not updated.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

ERROR: The compiled CSS from
       core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css
       does match its CSS file. Recompile the CSS with:
       yarn run build:css

STYLELINT: core/modules/announcements_feed/css/announcements_feed.toolbar.pcss.css passed

Remaining tasks

TBD

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 295131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>