diff --git a/.github/fluent/linter_config.yml b/.github/fluent/linter_config.yml new file mode 100644 index 0000000000..6ef41ea839 --- /dev/null +++ b/.github/fluent/linter_config.yml @@ -0,0 +1,24 @@ +# 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/. + +# See https://github.com/mozilla-l10n/moz-fluent-linter/blob/main/src/fluent_linter/config.yml +# for details + +--- +# Check brand names +CO01: + enabled: true + brands: + - Firefox + - Mozilla + - Profiler + exclusions: + files: [] + messages: [] +# Enforce variable comments +VC: + disabled: false +# Enforce placeholder style, e.g. { $variable } +PS01: + disabled: false diff --git a/.github/fluent/requirements.txt b/.github/fluent/requirements.txt new file mode 100644 index 0000000000..4b9da3204d --- /dev/null +++ b/.github/fluent/requirements.txt @@ -0,0 +1 @@ +moz-fluent-linter~=0.4.9 diff --git a/.github/workflows/fluent_linter.yml b/.github/workflows/fluent_linter.yml new file mode 100644 index 0000000000..664221d1bb --- /dev/null +++ b/.github/workflows/fluent_linter.yml @@ -0,0 +1,35 @@ +name: Lint Reference Files +on: + push: + paths: + - 'locales/en-US/*.ftl' + - '.github/workflows/fluent_linter.yml' + - '.github/fluent/*' + branches: + - main + pull_request: + paths: + - 'locales/en-US/*.ftl' + - '.github/workflows/fluent_linter.yml' + - '.github/fluent/*' + branches: + - main + workflow_dispatch: +jobs: + linter: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v5 + - name: Set up Python 3 + uses: actions/setup-python@v6 + with: + python-version: '3.11' + cache: 'pip' + cache-dependency-path: '.github/fluent/requirements.txt' + - name: Install Python dependencies + run: | + pip install -r .github/fluent/requirements.txt + - name: Lint reference + run: | + moz-fluent-lint ./locales/en-US --config .github/fluent/linter_config.yml