summaryrefslogtreecommitdiffstats
path: root/tools/lint/test/files/fluent-lint
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /tools/lint/test/files/fluent-lint
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/lint/test/files/fluent-lint')
-rw-r--r--tools/lint/test/files/fluent-lint/bad.ftl44
-rw-r--r--tools/lint/test/files/fluent-lint/brand-names-excluded.ftl2
-rw-r--r--tools/lint/test/files/fluent-lint/brand-names.ftl30
-rw-r--r--tools/lint/test/files/fluent-lint/comment-group1.ftl35
-rw-r--r--tools/lint/test/files/fluent-lint/comment-group2.ftl15
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource1.ftl11
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource2.ftl6
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource3.ftl6
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource4.ftl8
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource5.ftl8
-rw-r--r--tools/lint/test/files/fluent-lint/comment-resource6.ftl4
-rw-r--r--tools/lint/test/files/fluent-lint/comment-variables1.ftl60
-rw-r--r--tools/lint/test/files/fluent-lint/comment-variables2.ftl27
-rw-r--r--tools/lint/test/files/fluent-lint/excluded.ftl6
-rw-r--r--tools/lint/test/files/fluent-lint/test-brands.ftl5
-rw-r--r--tools/lint/test/files/fluent-lint/tools/lint/fluent-lint/exclusions.yml17
16 files changed, 284 insertions, 0 deletions
diff --git a/tools/lint/test/files/fluent-lint/bad.ftl b/tools/lint/test/files/fluent-lint/bad.ftl
new file mode 100644
index 0000000000..ebc0e1a602
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/bad.ftl
@@ -0,0 +1,44 @@
+Blah-blah = Uppercase letters in identifiers are not permitted.
+blah-blah = This is a legal identifier.
+blah_blah = Underscores in identifiers are not permitted.
+
+bad-apostrophe-1 = The bee's knees
+bad-apostrophe-end-1 = The bees' knees
+bad-apostrophe-2 = The bee‘s knees
+bad-single-quote = 'The bee’s knees'
+ok-apostrophe = The bee’s knees
+ok-single-quote = ‘The bee’s knees’
+bad-double-quote = "The bee’s knees"
+good-double-quote = “The bee’s knees”
+bad-ellipsis = The bee’s knees...
+good-ellipsis = The bee’s knees…
+
+embedded-tag = Read more about <a data-l10n-name="privacy-policy"> our privacy policy </a>.
+bad-embedded-tag = Read more about <a data-l10n-name="privacy-policy"> our 'privacy' policy </a>.
+
+Invalid_Id = This identifier is in the exclusions file and will not cause an error.
+
+good-has-attributes =
+ .accessKey = Attribute identifiers are not checked.
+
+bad-has-attributes =
+ .accessKey = Attribute 'values' are checked.
+
+good-function-call = Last modified: { DATETIME($timeChanged, day: "numeric", month: "long", year: "numeric") }
+
+# $engineName (String) - The engine name that will currently be used for the private window.
+good-variable-identifier = { $engineName } is your default search engine in Private Windows
+
+short-id = I am too short
+
+identifiers-in-selectors-should-be-ignored =
+ .label = { $tabCount ->
+ [1] Send Tab to Device
+ [UPPERCASE] Send Tab to Device
+ *[other] Send { $tabCount } Tabs to Device
+ }
+
+this-message-reference-is-ignored =
+ .label = { menu-quit.label }
+
+ok-message-with-html-and-var = This is a <a href="{ $url }">link</a>
diff --git a/tools/lint/test/files/fluent-lint/brand-names-excluded.ftl b/tools/lint/test/files/fluent-lint/brand-names-excluded.ftl
new file mode 100644
index 0000000000..9f3afa28b8
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/brand-names-excluded.ftl
@@ -0,0 +1,2 @@
+# Comment
+bad-firefox1 = Welcome to Firefox
diff --git a/tools/lint/test/files/fluent-lint/brand-names.ftl b/tools/lint/test/files/fluent-lint/brand-names.ftl
new file mode 100644
index 0000000000..c338d920ca
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/brand-names.ftl
@@ -0,0 +1,30 @@
+bad-firefox1 = Welcome to Firefox
+
+# Comment should be ignored when displaying the offset of the error
+bad-firefox2 = Welcome to Firefox again
+bad-firefox2b = <span>Welcome to Firefox<span> again
+bad-firefox3 = <b>Firefox</b>
+bad-firefox-excluded = <b>Firefox</b>
+
+bad-mozilla1 = Welcome to Mozilla
+bad-mozilla2 = Welcome to Mozilla again
+bad-mozilla2b = <span>Welcome to Mozilla</span> again
+bad-mozilla3 = <b>Mozilla</b>
+
+bad-thunderbird1 = Welcome to Thunderbird
+bad-thunderbird2 = <span>Welcome to Thunderbird</span> again
+bad-thunderbird3 = <b>Thunderbird</b>
+
+good-firefox1 = Welcome to { -brand-firefox }
+good-firefox2 = Welcome to { firefox-message }
+
+good-mozilla1 = Welcome to { -brand-mozilla }
+good-mozilla2 = Welcome to { mozilla-message }
+
+good-thunderbird1 = Welcome to { -brand-thunderbird }
+good-thunderbird2 = Welcome to { thunderbird-message }
+
+# There are no brand checks on terms
+-brand-firefox = Firefox
+
+bland-message = No brands here.
diff --git a/tools/lint/test/files/fluent-lint/comment-group1.ftl b/tools/lint/test/files/fluent-lint/comment-group1.ftl
new file mode 100644
index 0000000000..32c19dc441
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-group1.ftl
@@ -0,0 +1,35 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Test group comments.
+
+fake-identifier-1 = Fake text
+
+## Pass: This group comment has proper spacing.
+
+fake-identifier-2 = Fake text
+## Fail: (GC03) Group comments should have an empty line before them.
+
+fake-identifier-3 = Fake text
+
+## Fail: (GC02) Group comments should have an empty line after them.
+fake-identifier-4 = Fake text
+
+## Pass: A single comment is fine.
+
+## Fail: (GC04) A group comment must be followed by at least one message.
+
+fake-identifier-5 = Fake text
+
+
+## Fail: (GC03) Only allow 1 line above.
+
+fake-identifier-6 = Fake text
+
+## Fail: (GC02) Only allow 1 line below.
+
+
+fake-identifier-6 = Fake text
+
+## Fail: (GC01) Group comments should not be at the end of a file.
diff --git a/tools/lint/test/files/fluent-lint/comment-group2.ftl b/tools/lint/test/files/fluent-lint/comment-group2.ftl
new file mode 100644
index 0000000000..47d29fa211
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-group2.ftl
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Test group comments.
+
+## Pass: This group comment is followed by a term
+
+-fake-term = Fake text
+
+## Pass: The last group comment is allowed to be an empty ##
+
+fake-identifier-1 = Fake text
+
+##
diff --git a/tools/lint/test/files/fluent-lint/comment-resource1.ftl b/tools/lint/test/files/fluent-lint/comment-resource1.ftl
new file mode 100644
index 0000000000..f5d5e53d59
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource1.ftl
@@ -0,0 +1,11 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Pass: This is a resource comment with proper spacing.
+
+fake-identifier-1 = Fake text
+
+### Fail: (RC01) There should not be more than one resource comment
+
+fake-identifier-2 = Fake text
diff --git a/tools/lint/test/files/fluent-lint/comment-resource2.ftl b/tools/lint/test/files/fluent-lint/comment-resource2.ftl
new file mode 100644
index 0000000000..44a77f4e73
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource2.ftl
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+### Fail: (RC03) There should be an empty line preceeding.
+
+fake-identifier-1 = Fake text
diff --git a/tools/lint/test/files/fluent-lint/comment-resource3.ftl b/tools/lint/test/files/fluent-lint/comment-resource3.ftl
new file mode 100644
index 0000000000..b261404380
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource3.ftl
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Fail: (RC02) There should be an empty line following.
+fake-identifier-1 = Fake text
diff --git a/tools/lint/test/files/fluent-lint/comment-resource4.ftl b/tools/lint/test/files/fluent-lint/comment-resource4.ftl
new file mode 100644
index 0000000000..c24e8887f8
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource4.ftl
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+
+### Fail: (RC03) There should be only one space above.
+
+fake-identifier-1 = Fake text
diff --git a/tools/lint/test/files/fluent-lint/comment-resource5.ftl b/tools/lint/test/files/fluent-lint/comment-resource5.ftl
new file mode 100644
index 0000000000..60d8e8c264
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource5.ftl
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Fail: (RC02) There should be only one space below.
+
+
+fake-identifier-1 = Fake text
diff --git a/tools/lint/test/files/fluent-lint/comment-resource6.ftl b/tools/lint/test/files/fluent-lint/comment-resource6.ftl
new file mode 100644
index 0000000000..a2ca9abfe7
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-resource6.ftl
@@ -0,0 +1,4 @@
+### Pass: Check two conditions.
+### 1. This is an edge case, but we shouldn't error if there is only a resource comment.
+### 2. Make sure this linter does not error if there is no license header. The license is
+### checked with `mach lint license`.
diff --git a/tools/lint/test/files/fluent-lint/comment-variables1.ftl b/tools/lint/test/files/fluent-lint/comment-variables1.ftl
new file mode 100644
index 0000000000..10de9de195
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-variables1.ftl
@@ -0,0 +1,60 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+### Test group comments.
+### $var doesn't count towards commented placeables
+
+message-without-comment = This string has a { $var }
+
+## Variables:
+## $foo-group (String): group level comment
+
+# Variables:
+# $foo1 (String): just text
+message-with-comment = This string has a { $foo1 }
+
+message-with-group-comment = This string has a { $foo-group }
+
+select-without-comment1 = {
+ $select1 ->
+ [t] Foo
+ *[s] Bar
+}
+
+select-without-comment2 = {
+ $select2 ->
+ [t] Foo { $select2 }
+ *[s] Bar
+}
+
+## Variables:
+## $select4 (Integer): a number
+
+# Variables:
+# $select3 (Integer): a number
+select-with-comment1 = {
+ $select3 ->
+ [t] Foo
+ *[s] Bar
+}
+
+select-with-group-comment1 = {
+ $select4 ->
+ [t] Foo { $select4 }
+ *[s] Bar
+}
+
+message-attribute-without-comment =
+ .label = This string as { $attr }
+
+# Variables:
+# $attr2 (String): just text
+message-attribute-with-comment =
+ .label = This string as { $attr2 }
+
+message-selection-function =
+ { PLATFORM() ->
+ [macos] foo
+ *[other] bar
+ }
diff --git a/tools/lint/test/files/fluent-lint/comment-variables2.ftl b/tools/lint/test/files/fluent-lint/comment-variables2.ftl
new file mode 100644
index 0000000000..2e9ae8e684
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/comment-variables2.ftl
@@ -0,0 +1,27 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+## Terms are not checked for variables, no need for comments.
+
+-term-without-comment1 = { $term1 }
+-term-without-comment2 = {
+ $select2 ->
+ [t] Foo { $term2 }
+ *[s] Bar
+}
+
+# Testing that variable references from terms are not kept around when analyzing
+# standard messages (see bug 1812568).
+#
+# Variables:
+# $message1 (String) - Just text
+message-with-comment = This string has a { $message1 }
+
+# This comment is not necessary, just making sure it doesn't get carried over to
+# the following message which uses the same variable.
+#
+# Variables:
+# $term-message (string) - Text
+-term-with-variable = { $term-message }
+message-without-comment = This string has a { $term-message }
diff --git a/tools/lint/test/files/fluent-lint/excluded.ftl b/tools/lint/test/files/fluent-lint/excluded.ftl
new file mode 100644
index 0000000000..79fe509ad6
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/excluded.ftl
@@ -0,0 +1,6 @@
+# This file is used to test excluding paths from tests.
+Blah-blah = Uppercase letters in identifiers are not permitted.
+blah-blah = This is a legal identifier.
+blah_blah = Underscores in identifiers are not permitted.
+
+bad-apostrophe-1 = The bee's knees
diff --git a/tools/lint/test/files/fluent-lint/test-brands.ftl b/tools/lint/test/files/fluent-lint/test-brands.ftl
new file mode 100644
index 0000000000..1aa6e9d0e8
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/test-brands.ftl
@@ -0,0 +1,5 @@
+# These are brands used in the fluent-lint test
+
+-brand-first = Firefox
+-brand-second = Thunderbird
+-brand-third = Mozilla
diff --git a/tools/lint/test/files/fluent-lint/tools/lint/fluent-lint/exclusions.yml b/tools/lint/test/files/fluent-lint/tools/lint/fluent-lint/exclusions.yml
new file mode 100644
index 0000000000..1aecf8cedd
--- /dev/null
+++ b/tools/lint/test/files/fluent-lint/tools/lint/fluent-lint/exclusions.yml
@@ -0,0 +1,17 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+---
+ID01:
+ messages:
+ - Invalid_Id
+ files:
+ - excluded.ftl
+ID02:
+ messages: []
+ files: []
+CO01:
+ messages:
+ - bad-firefox-excluded
+ files:
+ - brand-names-excluded.ftl