diff --git a/css-checks/src/test/java/org/sonar/css/checks/common/DeprecatedSystemColorCheckTest.java b/css-checks/src/test/java/org/sonar/css/checks/common/DeprecatedSystemColorCheckTest.java index 4a310bac..c4d525a4 100644 --- a/css-checks/src/test/java/org/sonar/css/checks/common/DeprecatedSystemColorCheckTest.java +++ b/css-checks/src/test/java/org/sonar/css/checks/common/DeprecatedSystemColorCheckTest.java @@ -27,19 +27,21 @@ public class DeprecatedSystemColorCheckTest { + private DeprecatedSystemColorCheck check = new DeprecatedSystemColorCheck(); + @Test public void test_css() { - CssCheckVerifier.verifyCssFile(new DeprecatedSystemColorCheck(), getTestFile("deprecatedSystemColor.css")); + CssCheckVerifier.verifyCssFile(check, getTestFile("deprecatedSystemColor.css")); } @Test public void test_less() { - CssCheckVerifier.verifyLessFile(new DeprecatedSystemColorCheck(), getTestFile("deprecatedSystemColor.less")); + CssCheckVerifier.verifyLessFile(check, getTestFile("deprecatedSystemColor.less")); } @Test public void test_scss() { - CssCheckVerifier.verifyScssFile(new DeprecatedSystemColorCheck(), getTestFile("deprecatedSystemColor.scss")); + CssCheckVerifier.verifyScssFile(check, getTestFile("deprecatedSystemColor.scss")); } private File getTestFile(String fileName) { diff --git a/css-checks/src/test/java/org/sonar/css/checks/common/ExperimentalPseudoCheckTest.java b/css-checks/src/test/java/org/sonar/css/checks/common/ExperimentalPseudoCheckTest.java index 29076ddd..59cefaf6 100644 --- a/css-checks/src/test/java/org/sonar/css/checks/common/ExperimentalPseudoCheckTest.java +++ b/css-checks/src/test/java/org/sonar/css/checks/common/ExperimentalPseudoCheckTest.java @@ -23,11 +23,29 @@ import org.sonar.css.checks.CheckTestUtils; import org.sonar.css.checks.verifier.CssCheckVerifier; +import java.io.File; + public class ExperimentalPseudoCheckTest { + private ExperimentalPseudoCheck check = new ExperimentalPseudoCheck(); + + @Test + public void test_css() { + CssCheckVerifier.verifyCssFile(check, getTestFile("experimentalPseudoUsage.css")); + } + @Test - public void test() { - CssCheckVerifier.verifyCssFile(new ExperimentalPseudoCheck(), CheckTestUtils.getCommonTestFile("experimentalPseudoUsage.css")); + public void test_less() { + CssCheckVerifier.verifyLessFile(check, getTestFile("experimentalPseudoUsage.less")); + } + + @Test + public void test_scss() { + CssCheckVerifier.verifyScssFile(check, getTestFile("experimentalPseudoUsage.scss")); + } + + private File getTestFile(String fileName) { + return CheckTestUtils.getCommonTestFile("experimental-pseudo-usage/" + fileName); } } diff --git a/css-checks/src/test/resources/checks/common/experimentalPseudoUsage.css b/css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.css similarity index 100% rename from css-checks/src/test/resources/checks/common/experimentalPseudoUsage.css rename to css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.css diff --git a/css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.less b/css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.less new file mode 100644 index 00000000..cf8a73d6 --- /dev/null +++ b/css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.less @@ -0,0 +1,31 @@ +#fullscreen:fullscreen > h1 { /* Noncompliant ![sc=13;ec=23;el=+0]! !{Remove this usage of the experimental "fullscreen" pseudo.}! */ + color: red; +} + +#id:-moz-abc { /* Noncompliant ![sc=5;ec=13;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +p:dir(ltr) { /* Noncompliant ![sc=3;ec=6;el=+0]! !{Remove this usage of the experimental "dir" pseudo.}! */ + color: red; +} + +p:-moz-abc(ltr) { /* Noncompliant ![sc=3;ec=11;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +:host { /* Noncompliant ![sc=2;ec=6;el=+0]! !{Remove this usage of the experimental "host" pseudo.}! */ + color: red; +} + +p:empty { + color: red; +} + +p:not(.mybox) { + color: red; +} + +.animation (@animation-name, @animation-count: infinte, @timing-function:linear) { + color: #000000; +} diff --git a/its/ruling/projects/custom/common/experimentalPseudoUsage.css b/css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.scss similarity index 100% rename from its/ruling/projects/custom/common/experimentalPseudoUsage.css rename to css-checks/src/test/resources/checks/common/experimental-pseudo-usage/experimentalPseudoUsage.scss diff --git a/css-frontend/src/main/java/org/sonar/css/parser/LexicalGrammar.java b/css-frontend/src/main/java/org/sonar/css/parser/LexicalGrammar.java index 46038022..0375779e 100644 --- a/css-frontend/src/main/java/org/sonar/css/parser/LexicalGrammar.java +++ b/css-frontend/src/main/java/org/sonar/css/parser/LexicalGrammar.java @@ -326,6 +326,7 @@ public enum LexicalGrammar implements GrammarRuleKey { LESS_MIXIN_GUARD_OR, LESS_MIXIN_PARAMETERS, LESS_MIXIN_PARAMETER, + LESS_MIXIN_PARAMETER_DEFAULT_VALUE, LESS_IDENTIFIER_NO_WS_NOR_WHEN, LESS_IDENT_IDENTIFIER_NO_WS_NOR_WHEN, LESS_MERGE, diff --git a/css-frontend/src/main/java/org/sonar/css/parser/TreeFactory.java b/css-frontend/src/main/java/org/sonar/css/parser/TreeFactory.java index 8435041d..562f4e2b 100644 --- a/css-frontend/src/main/java/org/sonar/css/parser/TreeFactory.java +++ b/css-frontend/src/main/java/org/sonar/css/parser/TreeFactory.java @@ -729,12 +729,16 @@ public SeparatedList lessMixinParameterLi return new SeparatedList<>(parameters, separators); } - public LessMixinParameterTree lessMixinParameter(LessVariableTree variable, Optional colon, Optional value) { - return new LessMixinParameterTreeImpl(variable, colon.orNull(), value.orNull()); + public LessMixinParameterTree lessMixinParameter(LessVariableTree variable, Optional defaultValue) { + return new LessMixinParameterTreeImpl(variable, null, defaultValue.orNull()); } public LessMixinParameterTree lessMixinParameter(ValueTree value) { - return new LessMixinParameterTreeImpl(null, null, value); + return new LessMixinParameterTreeImpl(null, value, null); + } + + public LessMixinParameterDefaultValueTree lessMixinParameterDefaultValue(SyntaxToken colon, ValueTree value) { + return new LessMixinParameterDefaultValueTreeImpl(colon, value); } public LessEscapingTree lessEscaping(SyntaxToken escapingSymbol, StringTree string) { diff --git a/css-frontend/src/main/java/org/sonar/css/parser/less/LessGrammar.java b/css-frontend/src/main/java/org/sonar/css/parser/less/LessGrammar.java index 14dab9fe..5b8ead23 100644 --- a/css-frontend/src/main/java/org/sonar/css/parser/less/LessGrammar.java +++ b/css-frontend/src/main/java/org/sonar/css/parser/less/LessGrammar.java @@ -348,11 +348,17 @@ public LessMixinParameterTree LESS_MIXIN_PARAMETER() { b.firstOf( f.lessMixinParameter( LESS_VARIABLE(), - b.optional(b.token(LexicalGrammar.COLON)), - b.optional(DECLARATION_VALUE())), + b.optional(LESS_MIXIN_PARAMETER_DEFAULT_VALUE())), f.lessMixinParameter(DECLARATION_VALUE()))); } + public LessMixinParameterDefaultValueTree LESS_MIXIN_PARAMETER_DEFAULT_VALUE() { + return b.nonterminal(LexicalGrammar.LESS_MIXIN_PARAMETER_DEFAULT_VALUE).is( + f.lessMixinParameterDefaultValue( + b.token(LexicalGrammar.COLON), + DECLARATION_VALUE())); + } + public IdentifierTree LESS_INTERPOLATED_IDENTIFIER() { return b.nonterminal(LexicalGrammar.LESS_INTERPOLATED_IDENTIFIER).is( f.lessInterpolatedIdentifier(b.token(LexicalGrammar.LESS_IDENT_INTERPOLATED_IDENTIFIER))); diff --git a/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterDefaultValueTreeImpl.java b/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterDefaultValueTreeImpl.java new file mode 100644 index 00000000..c654b579 --- /dev/null +++ b/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterDefaultValueTreeImpl.java @@ -0,0 +1,67 @@ +/* + * SonarQube CSS / SCSS / Less Analyzer + * Copyright (C) 2013-2017 David RACODON + * mailto: david.racodon@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.css.tree.impl.less; + +import com.google.common.collect.Iterators; +import org.sonar.css.tree.impl.TreeImpl; +import org.sonar.plugins.css.api.tree.Tree; +import org.sonar.plugins.css.api.tree.css.SyntaxToken; +import org.sonar.plugins.css.api.tree.css.ValueTree; +import org.sonar.plugins.css.api.tree.less.LessMixinParameterDefaultValueTree; +import org.sonar.plugins.css.api.visitors.DoubleDispatchVisitor; + +import java.util.Iterator; + +public class LessMixinParameterDefaultValueTreeImpl extends TreeImpl implements LessMixinParameterDefaultValueTree { + + private final SyntaxToken colon; + private final ValueTree value; + + public LessMixinParameterDefaultValueTreeImpl(SyntaxToken colon, ValueTree value) { + this.colon = colon; + this.value = value; + } + + @Override + public Kind getKind() { + return Kind.LESS_MIXIN_PARAMETER_DEFAULT_VALUE; + } + + @Override + public Iterator childrenIterator() { + return Iterators.forArray(colon, value); + } + + @Override + public void accept(DoubleDispatchVisitor visitor) { + visitor.visitLessMixinParameterDefaultValue(this); + } + + @Override + public SyntaxToken colon() { + return colon; + } + + @Override + public ValueTree value() { + return value; + } + +} diff --git a/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterTreeImpl.java b/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterTreeImpl.java index 02f4c70d..34bb88b5 100644 --- a/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterTreeImpl.java +++ b/css-frontend/src/main/java/org/sonar/css/tree/impl/less/LessMixinParameterTreeImpl.java @@ -22,8 +22,8 @@ import com.google.common.collect.Iterators; import org.sonar.css.tree.impl.TreeImpl; import org.sonar.plugins.css.api.tree.Tree; -import org.sonar.plugins.css.api.tree.css.SyntaxToken; import org.sonar.plugins.css.api.tree.css.ValueTree; +import org.sonar.plugins.css.api.tree.less.LessMixinParameterDefaultValueTree; import org.sonar.plugins.css.api.tree.less.LessMixinParameterTree; import org.sonar.plugins.css.api.tree.less.LessVariableTree; import org.sonar.plugins.css.api.visitors.DoubleDispatchVisitor; @@ -34,13 +34,13 @@ public class LessMixinParameterTreeImpl extends TreeImpl implements LessMixinParameterTree { private final LessVariableTree variable; - private final SyntaxToken colon; private final ValueTree value; + private final LessMixinParameterDefaultValueTree defaultValue; - public LessMixinParameterTreeImpl(LessVariableTree variable, @Nullable SyntaxToken colon, @Nullable ValueTree value) { + public LessMixinParameterTreeImpl(@Nullable LessVariableTree variable, @Nullable ValueTree value, @Nullable LessMixinParameterDefaultValueTree defaultValue) { this.variable = variable; - this.colon = colon; this.value = value; + this.defaultValue = defaultValue; } @Override @@ -50,7 +50,7 @@ public Kind getKind() { @Override public Iterator childrenIterator() { - return Iterators.forArray(variable, colon, value); + return Iterators.forArray(variable, value, defaultValue); } @Override @@ -66,14 +66,14 @@ public LessVariableTree variable() { @Override @Nullable - public SyntaxToken colon() { - return colon; + public ValueTree value() { + return value; } @Override @Nullable - public ValueTree value() { - return value; + public LessMixinParameterDefaultValueTree defaultValue() { + return defaultValue; } } diff --git a/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/Tree.java b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/Tree.java index 77181e07..dc337c0d 100644 --- a/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/Tree.java +++ b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/Tree.java @@ -154,6 +154,7 @@ enum Kind implements GrammarRuleKey { LESS_MIXIN_GUARD(LessMixinGuardTree.class), LESS_MIXIN_PARAMETERS(LessMixinParametersTree.class), LESS_MIXIN_PARAMETER(LessMixinParameterTree.class), + LESS_MIXIN_PARAMETER_DEFAULT_VALUE(LessMixinParameterDefaultValueTree.class), LESS_ESCAPING(LessEscapingTree.class), LESS_OPERATOR(LessOperatorTree.class); diff --git a/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterDefaultValueTree.java b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterDefaultValueTree.java new file mode 100644 index 00000000..6b921eec --- /dev/null +++ b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterDefaultValueTree.java @@ -0,0 +1,32 @@ +/* + * SonarQube CSS / SCSS / Less Analyzer + * Copyright (C) 2013-2017 David RACODON + * mailto: david.racodon@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.plugins.css.api.tree.less; + +import org.sonar.plugins.css.api.tree.Tree; +import org.sonar.plugins.css.api.tree.css.SyntaxToken; +import org.sonar.plugins.css.api.tree.css.ValueTree; + +public interface LessMixinParameterDefaultValueTree extends Tree { + + SyntaxToken colon(); + + ValueTree value(); + +} diff --git a/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterTree.java b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterTree.java index ee7235d3..97883b63 100644 --- a/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterTree.java +++ b/css-frontend/src/main/java/org/sonar/plugins/css/api/tree/less/LessMixinParameterTree.java @@ -19,21 +19,20 @@ */ package org.sonar.plugins.css.api.tree.less; -import javax.annotation.Nullable; - -import org.sonar.plugins.css.api.tree.css.SyntaxToken; import org.sonar.plugins.css.api.tree.Tree; import org.sonar.plugins.css.api.tree.css.ValueTree; +import javax.annotation.Nullable; + public interface LessMixinParameterTree extends Tree { @Nullable LessVariableTree variable(); @Nullable - SyntaxToken colon(); + ValueTree value(); @Nullable - ValueTree value(); + LessMixinParameterDefaultValueTree defaultValue(); } diff --git a/css-frontend/src/main/java/org/sonar/plugins/css/api/visitors/DoubleDispatchVisitor.java b/css-frontend/src/main/java/org/sonar/plugins/css/api/visitors/DoubleDispatchVisitor.java index 6cff78e7..41e7e33b 100644 --- a/css-frontend/src/main/java/org/sonar/plugins/css/api/visitors/DoubleDispatchVisitor.java +++ b/css-frontend/src/main/java/org/sonar/plugins/css/api/visitors/DoubleDispatchVisitor.java @@ -457,6 +457,10 @@ public void visitLessMixinParameter(LessMixinParameterTree tree) { scanChildren(tree); } + public void visitLessMixinParameterDefaultValue(LessMixinParameterDefaultValueTree tree) { + scanChildren(tree); + } + public void visitLessEscaping(LessEscapingTree tree) { scanChildren(tree); } diff --git a/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterDefaultValueTreeTest.java b/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterDefaultValueTreeTest.java new file mode 100644 index 00000000..36c5f939 --- /dev/null +++ b/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterDefaultValueTreeTest.java @@ -0,0 +1,48 @@ +/* + * SonarQube CSS / SCSS / Less Analyzer + * Copyright (C) 2013-2017 David RACODON + * mailto: david.racodon@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.css.parser.less; + +import org.junit.Test; +import org.sonar.css.parser.LexicalGrammar; +import org.sonar.plugins.css.api.tree.less.LessMixinParameterDefaultValueTree; + +import static org.fest.assertions.Assertions.assertThat; + +public class LessMixinParameterDefaultValueTreeTest extends LessTreeTest { + + public LessMixinParameterDefaultValueTreeTest() { + super(LexicalGrammar.LESS_MIXIN_PARAMETER_DEFAULT_VALUE); + } + + @Test + public void lessMixinParameterDefaultValue() { + checkParsed(":abc"); + checkParsed(": abc"); + checkParsed(" : abc"); + } + + private LessMixinParameterDefaultValueTree checkParsed(String toParse) { + LessMixinParameterDefaultValueTree tree = (LessMixinParameterDefaultValueTree) parser().parse(toParse); + assertThat(tree.colon()).isNotNull(); + assertThat(tree.value()).isNotNull(); + return tree; + } + +} diff --git a/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterTreeTest.java b/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterTreeTest.java index d6c4e054..c38fd614 100644 --- a/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterTreeTest.java +++ b/css-frontend/src/test/java/org/sonar/css/parser/less/LessMixinParameterTreeTest.java @@ -36,18 +36,23 @@ public void lessMixinParameter() { LessMixinParameterTree tree; tree = checkParsed("@var"); - assertThat(tree.colon()).isNull(); + assertThat(tree.defaultValue()).isNull(); assertThat(tree.value()).isNull(); + assertThat(tree.variable()).isNotNull(); tree = checkParsed("@var: abc"); - assertThat(tree.colon()).isNotNull(); + assertThat(tree.variable()).isNotNull(); + assertThat(tree.defaultValue()).isNotNull(); + assertThat(tree.value()).isNull(); + + tree = checkParsed("abc"); + assertThat(tree.variable()).isNull(); + assertThat(tree.defaultValue()).isNull(); assertThat(tree.value()).isNotNull(); } private LessMixinParameterTree checkParsed(String toParse) { - LessMixinParameterTree tree = (LessMixinParameterTree) parser().parse(toParse); - assertThat(tree.variable()).isNotNull(); - return tree; + return (LessMixinParameterTree) parser().parse(toParse); } } diff --git a/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css new file mode 100644 index 00000000..777f777d --- /dev/null +++ b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css @@ -0,0 +1,27 @@ +#fullscreen:fullscreen > h1 { /* Noncompliant ![sc=13;ec=23;el=+0]! !{Remove this usage of the experimental "fullscreen" pseudo.}! */ + color: red; +} + +#id:-moz-abc { /* Noncompliant ![sc=5;ec=13;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +p:dir(ltr) { /* Noncompliant ![sc=3;ec=6;el=+0]! !{Remove this usage of the experimental "dir" pseudo.}! */ + color: red; +} + +p:-moz-abc(ltr) { /* Noncompliant ![sc=3;ec=11;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +:host { /* Noncompliant ![sc=2;ec=6;el=+0]! !{Remove this usage of the experimental "host" pseudo.}! */ + color: red; +} + +p:empty { + color: red; +} + +p:not(.mybox) { + color: red; +} diff --git a/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less new file mode 100644 index 00000000..cf8a73d6 --- /dev/null +++ b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less @@ -0,0 +1,31 @@ +#fullscreen:fullscreen > h1 { /* Noncompliant ![sc=13;ec=23;el=+0]! !{Remove this usage of the experimental "fullscreen" pseudo.}! */ + color: red; +} + +#id:-moz-abc { /* Noncompliant ![sc=5;ec=13;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +p:dir(ltr) { /* Noncompliant ![sc=3;ec=6;el=+0]! !{Remove this usage of the experimental "dir" pseudo.}! */ + color: red; +} + +p:-moz-abc(ltr) { /* Noncompliant ![sc=3;ec=11;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +:host { /* Noncompliant ![sc=2;ec=6;el=+0]! !{Remove this usage of the experimental "host" pseudo.}! */ + color: red; +} + +p:empty { + color: red; +} + +p:not(.mybox) { + color: red; +} + +.animation (@animation-name, @animation-count: infinte, @timing-function:linear) { + color: #000000; +} diff --git a/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss new file mode 100644 index 00000000..777f777d --- /dev/null +++ b/its/ruling/projects/custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss @@ -0,0 +1,27 @@ +#fullscreen:fullscreen > h1 { /* Noncompliant ![sc=13;ec=23;el=+0]! !{Remove this usage of the experimental "fullscreen" pseudo.}! */ + color: red; +} + +#id:-moz-abc { /* Noncompliant ![sc=5;ec=13;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +p:dir(ltr) { /* Noncompliant ![sc=3;ec=6;el=+0]! !{Remove this usage of the experimental "dir" pseudo.}! */ + color: red; +} + +p:-moz-abc(ltr) { /* Noncompliant ![sc=3;ec=11;el=+0]! !{Remove this usage of the experimental "abc" pseudo.}! */ + color: red; +} + +:host { /* Noncompliant ![sc=2;ec=6;el=+0]! !{Remove this usage of the experimental "host" pseudo.}! */ + color: red; +} + +p:empty { + color: red; +} + +p:not(.mybox) { + color: red; +} diff --git a/its/ruling/tests/src/test/expected/css-experimental-pseudo-usage.json b/its/ruling/tests/src/test/expected/css-experimental-pseudo-usage.json index aeab3117..1545ef20 100644 --- a/its/ruling/tests/src/test/expected/css-experimental-pseudo-usage.json +++ b/its/ruling/tests/src/test/expected/css-experimental-pseudo-usage.json @@ -1,5 +1,5 @@ { -'project:custom/common/experimentalPseudoUsage.css':[ +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css':[ 1, 5, 9, diff --git a/its/ruling/tests/src/test/expected/css-ids.json b/its/ruling/tests/src/test/expected/css-ids.json index 93b9aa0c..fda7efc0 100644 --- a/its/ruling/tests/src/test/expected/css-ids.json +++ b/its/ruling/tests/src/test/expected/css-ids.json @@ -5,7 +5,7 @@ 'project:custom/common/class-selector-naming-convention/selectorNamingConventionCustomFormat.css':[ 10, ], -'project:custom/common/experimentalPseudoUsage.css':[ +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css':[ 1, 5, ], diff --git a/its/ruling/tests/src/test/expected/css-line-length.json b/its/ruling/tests/src/test/expected/css-line-length.json index a28e4da1..dca22e65 100644 --- a/its/ruling/tests/src/test/expected/css-line-length.json +++ b/its/ruling/tests/src/test/expected/css-line-length.json @@ -65,6 +65,9 @@ 36, 37, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css':[ +1, +], 'project:custom/common/experimentalAtRuleUsage.css':[ 1, 2, @@ -79,9 +82,6 @@ 5, 6, ], -'project:custom/common/experimentalPseudoUsage.css':[ -1, -], 'project:custom/common/font-family-not-ending-with-generic-font-family/fontFamilyNotEndingWithGenericFontFamily.css':[ 9, 10, diff --git a/its/ruling/tests/src/test/expected/css-named-color.json b/its/ruling/tests/src/test/expected/css-named-color.json index 45b8d3c8..8b0fa4f5 100644 --- a/its/ruling/tests/src/test/expected/css-named-color.json +++ b/its/ruling/tests/src/test/expected/css-named-color.json @@ -4229,11 +4229,7 @@ 2, 57, ], -'project:custom/common/experimentalAtRuleUsage.css':[ -20, -21, -], -'project:custom/common/experimentalPseudoUsage.css':[ +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.css':[ 2, 6, 10, @@ -4242,6 +4238,10 @@ 22, 26, ], +'project:custom/common/experimentalAtRuleUsage.css':[ +20, +21, +], 'project:custom/common/file-too-many-lines/fileTooManyLines10.css':[ 2, 3, diff --git a/its/ruling/tests/src/test/expected/less-experimental-pseudo-usage.json b/its/ruling/tests/src/test/expected/less-experimental-pseudo-usage.json index 9a4b43f7..d217abdf 100644 --- a/its/ruling/tests/src/test/expected/less-experimental-pseudo-usage.json +++ b/its/ruling/tests/src/test/expected/less-experimental-pseudo-usage.json @@ -1,4 +1,11 @@ { +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +1, +5, +9, +13, +17, +], 'project:custom/common/unknown-pseudo/unknownPseudo.less':[ 4, 14, diff --git a/its/ruling/tests/src/test/expected/less-ids.json b/its/ruling/tests/src/test/expected/less-ids.json index f48e742b..bc8de7c5 100644 --- a/its/ruling/tests/src/test/expected/less-ids.json +++ b/its/ruling/tests/src/test/expected/less-ids.json @@ -2,6 +2,10 @@ 'project:custom/common/class-selector-naming-convention/selectorNamingConvention.less':[ 10, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +1, +5, +], 'project:custom/common/id-selector-naming-convention/selectorNamingConvention.less':[ 1, 7, diff --git a/its/ruling/tests/src/test/expected/less-line-length.json b/its/ruling/tests/src/test/expected/less-line-length.json index 836b2f1b..6d785061 100644 --- a/its/ruling/tests/src/test/expected/less-line-length.json +++ b/its/ruling/tests/src/test/expected/less-line-length.json @@ -44,6 +44,9 @@ 20, 21, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +1, +], 'project:custom/common/font-family-not-ending-with-generic-font-family/fontFamilyNotEndingWithGenericFontFamily.less':[ 9, 10, diff --git a/its/ruling/tests/src/test/expected/less-named-color.json b/its/ruling/tests/src/test/expected/less-named-color.json index 2ca6daa1..8a18518f 100644 --- a/its/ruling/tests/src/test/expected/less-named-color.json +++ b/its/ruling/tests/src/test/expected/less-named-color.json @@ -114,6 +114,15 @@ 84, 96, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +2, +6, +10, +14, +18, +22, +26, +], 'project:custom/common/fixme/fixmeTagPresence.less':[ 3, 8, diff --git a/its/ruling/tests/src/test/expected/less-prefer-single-line-comments.json b/its/ruling/tests/src/test/expected/less-prefer-single-line-comments.json index a01dfd21..d4edd410 100644 --- a/its/ruling/tests/src/test/expected/less-prefer-single-line-comments.json +++ b/its/ruling/tests/src/test/expected/less-prefer-single-line-comments.json @@ -118,6 +118,13 @@ 21, 22, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +1, +5, +9, +13, +17, +], 'project:custom/common/experimental-selector-combinator-usage/experimentalSelectorCombinatorUsage.less':[ 1, 5, diff --git a/its/ruling/tests/src/test/expected/less-unknown-pseudo.json b/its/ruling/tests/src/test/expected/less-unknown-pseudo.json index 8a1b72b2..bd224f3d 100644 --- a/its/ruling/tests/src/test/expected/less-unknown-pseudo.json +++ b/its/ruling/tests/src/test/expected/less-unknown-pseudo.json @@ -1,4 +1,7 @@ { +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.less':[ +29, +], 'project:custom/common/unknown-pseudo/unknownPseudo.less':[ 7, 18, diff --git a/its/ruling/tests/src/test/expected/scss-experimental-pseudo-usage.json b/its/ruling/tests/src/test/expected/scss-experimental-pseudo-usage.json index 2eb8af22..3b07422c 100644 --- a/its/ruling/tests/src/test/expected/scss-experimental-pseudo-usage.json +++ b/its/ruling/tests/src/test/expected/scss-experimental-pseudo-usage.json @@ -1,4 +1,11 @@ { +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss':[ +1, +5, +9, +13, +17, +], 'project:custom/common/unknown-pseudo/unknownPseudo.scss':[ 7, 17, diff --git a/its/ruling/tests/src/test/expected/scss-ids.json b/its/ruling/tests/src/test/expected/scss-ids.json index 97453da3..d531ec3d 100644 --- a/its/ruling/tests/src/test/expected/scss-ids.json +++ b/its/ruling/tests/src/test/expected/scss-ids.json @@ -2,6 +2,10 @@ 'project:custom/common/class-selector-naming-convention/selectorNamingConvention.scss':[ 10, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss':[ +1, +5, +], 'project:custom/common/id-selector-naming-convention/selectorNamingConvention.scss':[ 1, 7, diff --git a/its/ruling/tests/src/test/expected/scss-line-length.json b/its/ruling/tests/src/test/expected/scss-line-length.json index 89589383..9a2d100d 100644 --- a/its/ruling/tests/src/test/expected/scss-line-length.json +++ b/its/ruling/tests/src/test/expected/scss-line-length.json @@ -49,6 +49,9 @@ 20, 21, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss':[ +1, +], 'project:custom/common/font-family-not-ending-with-generic-font-family/fontFamilyNotEndingWithGenericFontFamily.scss':[ 9, 10, diff --git a/its/ruling/tests/src/test/expected/scss-named-color.json b/its/ruling/tests/src/test/expected/scss-named-color.json index fb9be03b..525d6977 100644 --- a/its/ruling/tests/src/test/expected/scss-named-color.json +++ b/its/ruling/tests/src/test/expected/scss-named-color.json @@ -142,6 +142,15 @@ 84, 96, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss':[ +2, +6, +10, +14, +18, +22, +26, +], 'project:custom/common/formatting/declaration.scss':[ 2, 6, diff --git a/its/ruling/tests/src/test/expected/scss-prefer-single-line-comments.json b/its/ruling/tests/src/test/expected/scss-prefer-single-line-comments.json index 2333101b..076b8b29 100644 --- a/its/ruling/tests/src/test/expected/scss-prefer-single-line-comments.json +++ b/its/ruling/tests/src/test/expected/scss-prefer-single-line-comments.json @@ -149,6 +149,13 @@ 21, 22, ], +'project:custom/common/experimental-pseudo-usage/experimentalPseudoUsage.scss':[ +1, +5, +9, +13, +17, +], 'project:custom/common/experimental-selector-combinator-usage/experimentalSelectorCombinatorUsage.scss':[ 1, 5,