Problem/Motivation

Let's add a new library definition:

drupal.node:
  version: VERSION
  css:
    css/node.module.css: {}

... this looks reasonable, but in fact this is broken. You need to specify a category:

drupal.node:
  version: VERSION
  css:
    layout:
      css/node.module.css: {}

This is far from being obvious.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because Drupal needs to validate a requirement that isn't obvious.
Issue priority Normal because this change adds test coverage for libraries.yml
Unfrozen changes Unfrozen because it only changes tests.

Proposed resolution

Add some validation code in LibraryParser.php to ensure the "category" is right.

In case you use a path as category, throw an exception like:

You have to key the css files in the "$module.library.yml" file by category (css/node.module.css seems is a filename, allowed categories are ...)

In case someone actually uses a category, throw an exception like:

You use an invalid category "invalid_cateogry" in "module.libraries.yml". Allowed categories are ...

An example for such a library.yml file would be:



drupal.node:
  version: VERSION
  css:
    invalid_category:
      css/node.module.css: {}

Remaining tasks

Fix tests that are not using categories.

User interface changes

API changes

CommentFileSizeAuthor
#90 validate_the_css-2389203-90.patch7.86 KBhussainweb
#87 interdiff-2389203-81-86.txt1.86 KBlokapujya
#86 validate-the-CSS-categories-in-libraries.yml-files-2389203-86.patch7.91 KBdcmul
#6 validateCssCategories-2389203-1.patch2.89 KBnaiduharish
#10 validateCssCategories-2389203-2.patch2.19 KBnaiduharish
#13 2389203-13.patch3.38 KBlokapujya
#13 2389203-interdiff-13.txt2.74 KBlokapujya
#15 2389203-15.patch3.39 KBlokapujya
#15 interdiff-2389203-15.txt1.57 KBlokapujya
#18 2389203-18.patch4.57 KBlokapujya
#18 interdiff-2389203-18.txt1.18 KBlokapujya
#19 interdiff-18-19.txt2.26 KBhussainweb
#19 2389203-19.patch4.5 KBhussainweb
#22 2389203-22.patch4.57 KBlokapujya
#22 interdiff-2389203-21.txt560 byteslokapujya
#29 interdiff-22-29.txt4.87 KBhussainweb
#29 2389203-29.patch3.85 KBhussainweb
#31 2389203-31.patch4.29 KBlokapujya
#31 interdiff-2389203-31.txt721 byteslokapujya
#36 2389203-36.patch6.16 KBlokapujya
#36 interdiff-2389203-36.txt2.89 KBlokapujya
#39 2389203-39.patch6.3 KBsuntog
#39 interdiff-2389203-39.txt1.28 KBsuntog
#41 interdiff.txt3.25 KBhussainweb
#41 2389203-41.patch6.36 KBhussainweb
#52 2389203-52.patch7.42 KBlokapujya
#52 interdiff-2389203-52.patch2.2 KBlokapujya
#60 2389203-60.patch7.54 KBlokapujya
#60 interdiff-2389203-60.txt1.7 KBlokapujya
#63 interdiff-60-63.txt813 bytespjbaert
#63 2389203-63.patch7.52 KBpjbaert
#71 validate-the-CSS-categories-in-libraries.yml-files-2389203-71.patch5.84 KBdeepakaryan1988
#71 interdiff-2389203-63-71.txt4.03 KBdeepakaryan1988
#81 interdiff-2389203-81.txt682 bytesSivaji_Ganesh_Jojodae
#81 validate-the-CSS-categories-in-libraries.yml-files-2389203-81.patch7.47 KBSivaji_Ganesh_Jojodae
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Issue tags: +php-novice
zealfire’s picture

I am not sure whether i am going in right direction so writting a pseudo before actually submitting a patch:
if ($type == 'css' && !empty($library[$type])) {
foreach ($library[$type] as $category => $files) {
+if(empty($file)){
+ throw exception 1 as above
+}
+if(!empty($category) && $category not in valid categories ) {
+ throw exception 2 as above
+}
foreach ($files as $source => $options) {
if (!isset($options['weight'])) {
$options['weight'] = 0;
}
Please tell the correct way.
Thanks

Wim Leers’s picture

Yes, something like that is what we need. There's no need to feel afraid to post a patch, even if it's imperfect. We all post imperfect patches all the time — we all rely on the feedback from others will help get us there :)

naiduharish’s picture

Assigned: Unassigned » naiduharish
Issue tags: +sprint @SprintWeekend2015Queue

Working on it

Wim Leers’s picture

Issue tags: -sprint @SprintWeekend2015Queue +SprintWeekend2015

Thanks for working on this! Ping me on IRC if you have questions :)

naiduharish’s picture

I have made changes in LibraryDiscoveryparser.php and added the validations for invalid category.

naiduharish’s picture

Status: Active » Needs review
hussainweb’s picture

Status: Needs review » Needs work
  1. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -10,6 +10,8 @@
     use Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException;
     use Drupal\Core\Asset\Exception\InvalidLibraryFileException;
     use Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException;
    +use Drupal\Core\Asset\Exception\InvalidDefinationOfCssException;
    +use Drupal\Core\Asset\Exception\InvalidCssCategoryException;
    

    Nitpick: Please try to alphabetize the list.

  2. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -118,12 +120,21 @@ public function buildByExtension($extension) {
    +              throw new InvalidDefinationOfCssException(sprintf("You have to key the css files in the '%s'.library.yml file by category ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category));
    

    Putting single quotes around %s in '%s'.library.yml might be confusing. On that note, I think the filename will be .libraries.yml.

  3. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -118,12 +120,21 @@ public function buildByExtension($extension) {
    +              //Check if the category is valid or not and
    +              // apply the corresponding weight defined by CSS_* constants.
    

    Nitpick: There should be a space after //.

  4. +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php
    @@ -52,6 +52,7 @@ public function __construct($offset = 0)
    +        ¶
    

    Remove the extra whitespace.

The last submitted patch, 6: validateCssCategories-2389203-1.patch, failed testing.

naiduharish’s picture

Hi @hussaian,
Thanks for the feedback. I have corrected the issues mentioned above and resubmitting the patch.

naiduharish’s picture

Assigned: naiduharish » Unassigned
Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 10: validateCssCategories-2389203-2.patch, failed testing.

lokapujya’s picture

Status: Needs work » Needs review
FileSize
3.38 KB
2.74 KB

Define the exceptions.

Status: Needs review » Needs work

The last submitted patch, 13: 2389203-13.patch, failed testing.

lokapujya’s picture

Status: Needs work » Needs review
FileSize
3.39 KB
1.57 KB

Fixed.

Status: Needs review » Needs work

The last submitted patch, 15: 2389203-15.patch, failed testing.

lokapujya’s picture

Issue summary: View changes
lokapujya’s picture

Status: Needs work » Needs review
FileSize
4.57 KB
1.18 KB

We discovered 2 tests (including one that dynamically adds a library) that doesn't provide a category.

hussainweb’s picture

FileSize
2.26 KB
4.5 KB

It seems we were working on this at the same time. Anyway, I applied my remaining changes on top of your patch. Basically, I renamed the exception class to something slightly smaller and reformatted a block of code. Interdiff is attached.

lokapujya’s picture

Looks good to me. RTBC.

gvso’s picture

Status: Needs review » Needs work

I wonder why the test has the extension .js

 example:
   css:
-    css/example.js: {}
+    theme:
+      css/example.js: {}
lokapujya’s picture

Status: Needs work » Needs review
FileSize
4.57 KB
560 bytes

We could have kept it, since it shows that the file extension is not required to be the same as the category. But, I think it's just from a copy & paste.

dawehner’s picture

It is great to see that someone has picked this one up!

Note: Someone could write an additional test in LibraryDiscoveryParserTest to have that bit of extra coverage available.

  1. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -8,6 +8,8 @@
    +use Drupal\Core\Asset\Exception\InvalidCssCategoryException;
    +use Drupal\Core\Asset\Exception\InvalidDefinitionOfCssException;
    

    Not 100% sure whether we need 2 new exceptions here ... but well I don't have a strong opinion.

  2. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -122,12 +124,21 @@ public function buildByExtension($extension) {
    +              //Check if the category is valid or not and
    +              //  apply the corresponding weight defined by CSS_* constants.
    

    Nitpick: Always use 1 space after the "//".

hussainweb’s picture

It looks like the exception I renamed in #19 was not carried forward in #22. Any particular reason? There was no explanation in that comment.

I am not too comfortable with two exceptions either and think there might be a way to put it under an umbrella. They indicate two different things but they are very much related.

On first thought, I would think we could just use InvalidCssDefinitionException as that could indicate both a missing category and an invalid category. Thoughts?

hussainweb’s picture

Status: Needs review » Needs work

For #24.

lokapujya’s picture

" Any particular reason?" My mistake.

hussainweb’s picture

That's okay. Did you have a thought on reducing it to one new exception as discussed in #23.1 and #24?

lokapujya’s picture

I think what you said in #24 is ok. The error message will still be different though, right? So, I think that works.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
4.87 KB
3.85 KB

Made the changes as discussed. Both comments in #23 are addressed.

lokapujya’s picture

Status: Needs review » Needs work

The new exception would need to be added to the throwing function's comment.

Would we actually want to catch this exception? It's too bad that the page will show a generic error if there is an exception.

lokapujya’s picture

Status: Needs work » Needs review
FileSize
4.29 KB
721 bytes

Comment the throw.

Wim Leers queued 31: 2389203-31.patch for re-testing.

Wim Leers’s picture

Issue tags: +Needs tests

Looking good, but we still want a unit test for this.

Status: Needs review » Needs work

The last submitted patch, 31: 2389203-31.patch, failed testing.

Wim Leers’s picture

Specifically, we want a test for that in \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest. There are many examples to start from in that one already, so should be doable :)

lokapujya’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
6.16 KB
2.89 KB

Added Unit Tests.

Wim Leers’s picture

Status: Needs review » Needs work

Awesome!

Almost there :)

  1. +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
    @@ -179,6 +179,48 @@ public function testBuildByExtensionWithMissingInformation() {
    +   * @expectedExceptionMessage You have to key the css files
    

    This message is pretty vague.

    Let's turn it into: "Every CSS asset must be nested under a SMACSS category, i.e. either theme,
    or base. See for details."

  2. +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
    @@ -179,6 +179,48 @@ public function testBuildByExtensionWithMissingInformation() {
    +   * @expectedExceptionMessage You have used an invalid category
    

    Let's similarly expand this message.

lokapujya’s picture

We already say the categories in the exception. The @expectedExceptionMessage is only searching for a substring of the actual exception. I do like your wording better than saying "You have...". On the other hand, the way that the exception message currently reads, it tells you which file was wrong.

Also, do we want to catch this exception anywhere or catch it in a new issue?

suntog’s picture

Status: Needs work » Needs review
FileSize
6.3 KB
1.28 KB

Made advised edits comments as per #37

Status: Needs review » Needs work

The last submitted patch, 39: 2389203-39.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
3.25 KB
6.36 KB

Fixing messages in #39 and added two more.

wheatpenny’s picture

Issue summary: View changes
wheatpenny’s picture

Novice task: review the patch in #41 as outlined in this contributor task: https://www.drupal.org/contributor-tasks/review

wheatpenny’s picture

Issue summary: View changes

Adjusting positioning and content of beta review based on feedback by YesCT.

sqndr’s picture

Status: Needs review » Needs work

I applied the patch from #41 on a clean installation and I get:

Drupal\Core\Asset\Exception\InvalidCssDefinitionException: Every CSS asset must be nested under a SMACSS category in the core.library.yml file ('theme' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme) in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 136 of core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).

Update: It also breaks using Simplytest.me

sqndr’s picture

Just to make sure, when we say "validate the css categories", we only mean that people should group their css, right? We're not forcing them to use SMACSS naming, right? If company's have a different css architecture, they can still do:

css:
  kittens:
    kittens.css
  llamas:
    llames.css
  pandas:
    pandas.css

That's correct, right?


Let's say I'm using a third-party library (or a css framework) that I want to include. I'll always have to insert the css into a certain category … which might feel kinda strange. Let's say I'm using the Bootstrap library. If I were to use that framework, it contains css from all SMACSS categories. That means I'd do something like:

kittens.bootstrap:
  version: VERSION
  css:
    all: # 'Cause it's base, components, layout, …
      css/bootstrap.min.css: {}
lokapujya’s picture

I think this patch throws an exception if you don't use one of the SMACSS categories. We should make sure that's really what we want.

sqndr’s picture

I think this patch throws an exception if you don't use one of the SMACSS categories. We should make sure that's really what we want.

Discussed this with Lewis Nyman yesterday and that is not what we want, especially since the official SMACSS terminology is modules while we ofter say components and theme while we often use skin, due to the fact that modules and themes have a specific meaning in Drupal.

People should also not be forced to use SMACSS categories. I think it started from Yahoo and it has proven to be very successful, but if people want to organise their css in a different way and/or with a different naming convention, they should be able to do so.

Wim Leers’s picture

We're not forcing them to use SMACSS naming, right? If company's have a different css architecture, they can still do:

No, that's not correct, we are forcing SMACSS. Discussing that here is out of scope.

lokapujya’s picture

Regarding #45:

+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -122,12 +123,21 @@ public function buildByExtension($extension) {
           foreach ($library[$type] as $category => $files) {
+            if (empty($files)) {
+              throw new InvalidCssDefinitionException(sprintf("Every CSS asset must be nested under a SMACSS category in the %s.library.yml file ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category));
+            }

$library['css'] has a category that is empty that is causing the exception.

LewisNyman’s picture

No, that's not correct, we are forcing SMACSS. Discussing that here is out of scope.

I don't understand, where are we defining the list of valid categories? Even if we are only implementing the enforcement here, this is a TX regression.

lokapujya’s picture

Status: Needs work » Needs review
FileSize
7.42 KB
2.2 KB

Allowing a category to be empty and adding a test.

Status: Needs review » Needs work

The last submitted patch, 52: interdiff-2389203-52.patch, failed testing.

lokapujya’s picture

Status: Needs work » Needs review
lokapujya’s picture

+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -132,6 +132,11 @@ public function buildByExtension($extension) {
+           if (defined('CSS_' . strtoupper($category)) && empty($files)) {

Reminder, fix the spacing on this line in next patch.

sqndr’s picture

As Wim pointed out:

No, that's not correct, we are forcing SMACSS. Discussing that here is out of scope.

We currently agreed on forcing SMACSS, apparently. Can we open an issue to discuss this change (#52), before we start working on this? The SMACSS categories also define the order the css is loaded in. If you don't categorise the css, what will be the weight of the css? When will be loaded?

Can we keep this issue to forcing the SMACSS categories? If we want to move into another direction, make sure to open a discussion first - and than work on the patch. If I'm wrong, and we agreed somewhere to STOP using SMACSS, please refer to the issue where this has been agreed upon.

Wim Leers’s picture

Status: Needs review » Needs work

I don't understand, where are we defining the list of valid categories? Even if we are only implementing the enforcement here, this is a TX regression.

In common.inc:

/**
 * The default weight for CSS rules that style HTML elements ("base" styles).
 */
const CSS_BASE = -200;

/**
 * The default weight for CSS rules that layout a page.
 */
const CSS_LAYOUT = -100;

/**
 * The default weight for CSS rules that style design components (and their associated states and themes.)
 */
const CSS_COMPONENT = 0;

/**
 * The default weight for CSS rules that style states and are not included with components.
 */
const CSS_STATE = 100;

/**
 * The default weight for CSS rules that style themes and are not included with components.
 */
const CSS_THEME = 200;

+ in LibraryDiscoveryParser:

              // Apply the corresponding weight defined by CSS_* constants.
              $options['weight'] += constant('CSS_' . strtoupper($category));

If you don't categorise the css, what will be the weight of the css? When will be loaded?

Exactly.


  1. +++ b/core/lib/Drupal/Core/Asset/Exception/InvalidCssDefinitionException.php
    @@ -0,0 +1,15 @@
    +class InvalidCssDefinitionException extends \RunTimeException {
    

    Let's rename this to InvalidCssCategoryException.

  2. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -131,12 +132,26 @@ public function buildByExtension($extension) {
    +            // Allow empty categories.
    +           if (defined('CSS_' . strtoupper($category)) && empty($files)) {
    +              unset($library[$type][$category]);
    +              continue;
    +            }
    +            if (empty($files)) {
    +              throw new InvalidCssDefinitionException(sprintf("Every CSS asset must be nested under a SMACSS category in the %s.library.yml file ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category));
    +            }
    

    All of this can be replaced by:

    // Ignore categories that don't contain any files.
    if (empty($files)) {
      continue;
    }
    
lokapujya’s picture

All of this can be replaced by:

I'm not sure why it can be replaced.

  1. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -131,12 +132,26 @@ public function buildByExtension($extension) {
    +            // Allow empty categories.
    +           if (defined('CSS_' . strtoupper($category)) && empty($files)) {
    +              unset($library[$type][$category]);
    +              continue;
    +            }
    

    seven_library_info_alter() is unsetting the file name, but leaving the category. This part prevents an exception by skipping over the following code.

  2. +++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    @@ -131,12 +132,26 @@ public function buildByExtension($extension) {
    +            if (empty($files)) {
    +              throw new InvalidCssDefinitionException(sprintf("Every CSS asset must be nested under a SMACSS category in the %s.library.yml file ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category));
    +            }
    

    This part throws a specific exception message, if a file is not under a category.

Wim Leers’s picture

Ok, I figured we don't care about validating invalid categories if they don't contain anything. You want to still validate those. That's fine (better).

But then let's make the code easier to understand. Let's change what you currently have:

if (defined && empty) {
  …
}
if (empty) {
  …
}

to?

if (empty) {
  if (defined) {
    …
  }
  else {
    …
  }
}
lokapujya’s picture

Sure, and added a comment.

lokapujya’s picture

Status: Needs work » Needs review

test it.

Wim Leers’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -132,13 +132,16 @@ public function buildByExtension($extension) {
             if (empty($files)) {
...
+              else if (empty($files)) {

This nested if-test is always going to be true. No need to repeat it.

pjbaert’s picture

FileSize
813 bytes
7.52 KB

I processed the remark mentioned in #62.

pjbaert’s picture

Status: Needs work » Needs review

Let's change this status to needs review

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -187,10 +187,72 @@ public function testBuildByExtensionWithMissingInformation() {
+   * @expectedExceptionMessage You must use a valid SMACSS category to nest a CSS asset
+   * @expectedExceptionMessage css_invalid_category

Nit: the first line wins, the second line can be removed. Can be done upon commit.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -187,10 +187,72 @@ public function testBuildByExtensionWithMissingInformation() {
+     $path = __DIR__ . '/library_test_files';
+     $path = substr($path, strlen($this->root) + 1);
+     $this->libraryDiscoveryParser->setPaths('module', 'css_empty_category', $path);
+
+     $this->assertSame($this->libraryDiscoveryParser->buildByExtension('css_empty_category'), array());

Are we not missing a test file for this?

deepakaryan1988’s picture

Issue tags: -SprintWeekend2015

Removing sprint weekend tag!!
As suggested by @YesCT

Wim Leers’s picture

Issue tags: +Needs tests, +Needs reroll
deepakaryan1988’s picture

Issue tags: +SprintWeekend2015

Sorry, these issues were actually worked on during the 2015 Global Sprint
Weekend https://groups.drupal.org/node/447258

deepakaryan1988’s picture

Assigned: Unassigned » deepakaryan1988
deepakaryan1988’s picture

Assigned: deepakaryan1988 » Unassigned
Status: Needs work » Needs review
FileSize
5.84 KB
4.03 KB

Rerolling the patch #63 and also address comment #65

Status: Needs review » Needs work
lokapujya’s picture

+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -213,7 +213,6 @@
    * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException
    * @expectedExceptionMessage You must use a valid SMACSS category to nest a CSS asset
-   * @expectedExceptionMessage css_invalid_category

This change looks good. The rest of the changes were maybe included by mistake.

deepakaryan1988’s picture

I dont know why it's failing..
I am unable to debug!!
Can anyone help me with this?

lokapujya’s picture

those changes should not be part of the patch. Only the one change.

deepakaryan1988’s picture

Assigned: Unassigned » deepakaryan1988
Status: Needs work » Active

@lokapujya Ok thnx..
making that change only.

deepakaryan1988’s picture

Assigned: deepakaryan1988 » Unassigned

@lokapujya But these changes are in that patch.. :(
Still confused.

dcmul’s picture

@deepakaryan1988 Noticed a syntax error.
$path = substr($path, strlen($this->root) 1);

lokapujya’s picture

Can you re-do the reroll of #63? The patch in #71 contains changes that should not be included. Only the change shown in #73 is correct.

lokapujya’s picture

Status: Active » Needs work
Sivaji_Ganesh_Jojodae’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
7.47 KB
682 bytes

#63 re-rolled with change mentioned in #73.

Manjit.Singh’s picture

Assigned: Unassigned » Manjit.Singh
Issue tags: -Novice

lokapujya’s picture

Assigned: Manjit.Singh » Unassigned
Status: Needs review » Needs work
Issue tags: +Novice

Needs a test file for css_empty_category similar to css_missing_category.libraries.yml.

dcmul’s picture

Status: Needs work » Needs review
FileSize
7.91 KB

Address the issue raised in #66

lokapujya’s picture

Issue tags: -Needs tests
FileSize
1.86 KB

Including the interdiff so that we can review the changes.

lokapujya’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -187,10 +187,74 @@ public function testBuildByExtensionWithMissingInformation() {
+   * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException
+   * @expectedExceptionMessage Every CSS asset must be nested under a SMACSS category
+   * @expectedExceptionMessage css_missing_category
+   *

Looks like there is another test that has a duplicated @expectedExceptionMessage

Wim Leers’s picture

Issue tags: +Needs reroll
hussainweb’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
7.86 KB

Rerolling and also fixing issue in #87. Since it is just a small line change, it didn't make sense to separate patches and create an interdiff. I hope it's okay.

lokapujya’s picture

The whole purpose of the interdiff is so that we can see just the small change!

lokapujya’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -php-novice, -SprintWeekend2015, -Novice

Looks good though.

joelpittet’s picture

Yay more tests! RTBC++

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 90: validate_the_css-2389203-90.patch, failed testing.

hussainweb’s picture

I have seen this error in other issues as well. I think it is to do with a bot or random. Retesting.

Status: Needs work » Needs review
LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC then

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

Do we really want limit the categories to SMACCS categories? Couldn't we just define a weight for unknown categories and say they come after theme? i.e the lowest of the low.

lokapujya’s picture

Currently, SMACCS is already required. I think this issue is supposed to make it obvious that you did not specify a category.

One possible problem with this issue is that if the CSS is dynamically added without a category, then an exception can be thrown.

joelpittet’s picture

@alexpott I'd prefer if we could put the non SMACSS category in like the example, and people questioned this in the theme talk we did tonight in Vancouver user group. We can by defining aribrary CSS_ contstants but that is not cool but better than nothing...

But like @lokapujya mentioned in #99 it's already required.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

Before anyone spends time on this actually want ot make sure it's still a valid task.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there hasn't been a follow up going to close out for now. If still a valid task please reopen.

Thanks all