|  | 1 | +variables:
 | 
|  | 2 | +  # This needs to be kept in sync with the max Python version accepted by ./mach
 | 
|  | 3 | +  PYTHON_VERSION: "3.11.7"
 | 
|  | 4 | +
 | 
|  | 5 | +.base:
 | 
|  | 6 | +  stage: lint
 | 
|  | 7 | +  interruptible: true
 | 
|  | 8 | +  variables:
 | 
|  | 9 | +    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
 | 
|  | 10 | +  cache:
 | 
|  | 11 | +    paths:
 | 
|  | 12 | +      - node_modules
 | 
|  | 13 | +      - .cache/pip
 | 
|  | 14 | +
 | 
|  | 15 | +eslint:
 | 
|  | 16 | +  extends: .base
 | 
|  | 17 | +  image: cimg/python:$PYTHON_VERSION-node
 | 
|  | 18 | +  script:
 | 
|  | 19 | +    - .gitlab/ci/scripts/run_linters.py eslint
 | 
|  | 20 | +  rules:
 | 
|  | 21 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 22 | +      changes:
 | 
|  | 23 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 24 | +        #
 | 
|  | 25 | +        # Files that are likely audited.
 | 
|  | 26 | +        - '**/*.js'
 | 
|  | 27 | +        - '**/*.jsm'
 | 
|  | 28 | +        - '**/*.json'
 | 
|  | 29 | +        - '**/*.jsx'
 | 
|  | 30 | +        - '**/*.mjs'
 | 
|  | 31 | +        - '**/*.sjs'
 | 
|  | 32 | +        - '**/*.html'
 | 
|  | 33 | +        - '**/*.xhtml'
 | 
|  | 34 | +        - '**/*.xml'
 | 
|  | 35 | +        - 'tools/lint/eslint.yml'
 | 
|  | 36 | +        # Run when eslint policies change.
 | 
|  | 37 | +        - '**/.eslintignore'
 | 
|  | 38 | +        - '**/*eslintrc*'
 | 
|  | 39 | +        # The plugin implementing custom checks.
 | 
|  | 40 | +        - 'tools/lint/eslint/eslint-plugin-mozilla/**'
 | 
|  | 41 | +        - 'tools/lint/eslint/eslint-plugin-spidermonkey-js/**'
 | 
|  | 42 | +    # Run job whenever a new tag is created
 | 
|  | 43 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 44 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 45 | +
 | 
|  | 46 | +stylelint:
 | 
|  | 47 | +  extends: .base
 | 
|  | 48 | +  image: cimg/python:$PYTHON_VERSION-node
 | 
|  | 49 | +  script:
 | 
|  | 50 | +    - .gitlab/ci/scripts/run_linters.py stylelint
 | 
|  | 51 | +  rules:
 | 
|  | 52 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 53 | +      changes:
 | 
|  | 54 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 55 | +        #
 | 
|  | 56 | +        # Files that are likely audited.
 | 
|  | 57 | +        - '**/*.css'
 | 
|  | 58 | +        - 'tools/lint/styleint.yml'
 | 
|  | 59 | +        # Run when stylelint policies change.
 | 
|  | 60 | +        - '**/.stylelintignore'
 | 
|  | 61 | +        - '**/*stylelintrc*'
 | 
|  | 62 | +    # Run job whenever a new tag is created
 | 
|  | 63 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 64 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 65 | +
 | 
|  | 66 | +py-black:
 | 
|  | 67 | +  extends: .base
 | 
|  | 68 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 69 | +  script:
 | 
|  | 70 | +    - .gitlab/ci/scripts/run_linters.py black
 | 
|  | 71 | +  rules:
 | 
|  | 72 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 73 | +      changes:
 | 
|  | 74 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 75 | +        #
 | 
|  | 76 | +        # The list of extensions should match tools/lint/black.yml
 | 
|  | 77 | +        - '**/*.py'
 | 
|  | 78 | +        - '**/moz.build'
 | 
|  | 79 | +        - '**/*.configure'
 | 
|  | 80 | +        - '**/*.mozbuild'
 | 
|  | 81 | +        - 'pyproject.toml'
 | 
|  | 82 | +        - 'tools/lint/black.yml'
 | 
|  | 83 | +    # Run job whenever a new tag is created
 | 
|  | 84 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 85 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 86 | +
 | 
|  | 87 | +py-ruff:
 | 
|  | 88 | +  extends: .base
 | 
|  | 89 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 90 | +  script:
 | 
|  | 91 | +    - .gitlab/ci/scripts/run_linters.py ruff
 | 
|  | 92 | +  rules:
 | 
|  | 93 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 94 | +      changes:
 | 
|  | 95 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 96 | +        #
 | 
|  | 97 | +        - '**/*.py'
 | 
|  | 98 | +        - '**/*.configure'
 | 
|  | 99 | +        - '**/.ruff.toml'
 | 
|  | 100 | +        - 'pyproject.toml'
 | 
|  | 101 | +        - 'tools/lint/ruff.yml'
 | 
|  | 102 | +        - 'tools/lint/python/ruff.py'
 | 
|  | 103 | +        - 'tools/lint/python/ruff_requirements.txt'
 | 
|  | 104 | +    # Run job whenever a new tag is created
 | 
|  | 105 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 106 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 107 | +
 | 
|  | 108 | +yaml:
 | 
|  | 109 | +  extends: .base
 | 
|  | 110 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 111 | +  script:
 | 
|  | 112 | +    - .gitlab/ci/scripts/run_linters.py yaml
 | 
|  | 113 | +  rules:
 | 
|  | 114 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 115 | +      changes:
 | 
|  | 116 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 117 | +        #
 | 
|  | 118 | +        - '**/*.yml'
 | 
|  | 119 | +        - '**/*.yaml'
 | 
|  | 120 | +        - '**/.ymllint'
 | 
|  | 121 | +    # Run job whenever a new tag is created
 | 
|  | 122 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 123 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 124 | +
 | 
|  | 125 | +shellcheck:
 | 
|  | 126 | +  extends: .base
 | 
|  | 127 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 128 | +  script:
 | 
|  | 129 | +    - .gitlab/ci/scripts/run_linters.py shellcheck
 | 
|  | 130 | +  rules:
 | 
|  | 131 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 132 | +      changes:
 | 
|  | 133 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 134 | +        #
 | 
|  | 135 | +        - '**/*.sh'
 | 
|  | 136 | +        - 'tools/lint/shellcheck.yml'
 | 
|  | 137 | +    # Run job whenever a new tag is created
 | 
|  | 138 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 139 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 140 | +
 | 
|  | 141 | +clang-format:
 | 
|  | 142 | +  extends: .base
 | 
|  | 143 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 144 | +  script:
 | 
|  | 145 | +    - .gitlab/ci/scripts/run_linters.py clang-format
 | 
|  | 146 | +  rules:
 | 
|  | 147 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 148 | +      changes:
 | 
|  | 149 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 150 | +        #
 | 
|  | 151 | +        - '**/*.cpp'
 | 
|  | 152 | +        - '**/*.c'
 | 
|  | 153 | +        - '**/*.cc'
 | 
|  | 154 | +        - '**/*.h'
 | 
|  | 155 | +        - '**/*.m'
 | 
|  | 156 | +        - '**/*.mm'
 | 
|  | 157 | +        - 'tools/lint/clang-format.yml'
 | 
|  | 158 | +    # Run job whenever a new tag is created
 | 
|  | 159 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 160 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 161 | +
 | 
|  | 162 | +rustfmt:
 | 
|  | 163 | +  extends: .base
 | 
|  | 164 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 165 | +  script:
 | 
|  | 166 | +    - .gitlab/ci/scripts/run_linters.py rustfmt
 | 
|  | 167 | +  rules:
 | 
|  | 168 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 169 | +      changes:
 | 
|  | 170 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 171 | +        #
 | 
|  | 172 | +        - '**/*.rs'
 | 
|  | 173 | +        - 'tools/lint/rustfmt.yml'
 | 
|  | 174 | +    # Run job whenever a new tag is created
 | 
|  | 175 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 176 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 177 | +
 | 
|  | 178 | +fluent-lint:
 | 
|  | 179 | +  extends: .base
 | 
|  | 180 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 181 | +  script:
 | 
|  | 182 | +    - .gitlab/ci/scripts/run_linters.py fluent-lint
 | 
|  | 183 | +  rules:
 | 
|  | 184 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 185 | +      changes:
 | 
|  | 186 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 187 | +        #
 | 
|  | 188 | +        - '**/*.ftl'
 | 
|  | 189 | +        - 'tools/lint/fluent-lint.yml'
 | 
|  | 190 | +        - 'tools/lint/fluent-lint/exclusions.yml'
 | 
|  | 191 | +    # Run job whenever a new tag is created
 | 
|  | 192 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 193 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 194 | +
 | 
|  | 195 | +localization:
 | 
|  | 196 | +  extends: .base
 | 
|  | 197 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 198 | +  script:
 | 
|  | 199 | +    - .gitlab/ci/scripts/run_linters.py l10n
 | 
|  | 200 | +  rules:
 | 
|  | 201 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 202 | +      changes:
 | 
|  | 203 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 204 | +        #
 | 
|  | 205 | +        - '**/locales/en-US/**'
 | 
|  | 206 | +        - '**/l10n.toml'
 | 
|  | 207 | +        - 'third_party/python/compare-locales/**'
 | 
|  | 208 | +        - 'third_party/python/fluent/**'
 | 
|  | 209 | +        - 'tools/lint/l10n.yml'
 | 
|  | 210 | +    # Run job whenever a new tag is created
 | 
|  | 211 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 212 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 213 | +
 | 
|  | 214 | +mingw-capitalization:
 | 
|  | 215 | +  extends: .base
 | 
|  | 216 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 217 | +  script:
 | 
|  | 218 | +    - .gitlab/ci/scripts/run_linters.py mingw-capitalization
 | 
|  | 219 | +  rules:
 | 
|  | 220 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 221 | +      changes:
 | 
|  | 222 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 223 | +        #
 | 
|  | 224 | +        - '**/*.cpp'
 | 
|  | 225 | +        - '**/*.cc'
 | 
|  | 226 | +        - '**/*.c'
 | 
|  | 227 | +        - '**/*.h'
 | 
|  | 228 | +        - 'tools/lint/mingw-capitalization.yml'
 | 
|  | 229 | +    # Run job whenever a new tag is created
 | 
|  | 230 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 231 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 232 | +
 | 
|  | 233 | +mscom-init:
 | 
|  | 234 | +  extends: .base
 | 
|  | 235 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 236 | +  script:
 | 
|  | 237 | +    - .gitlab/ci/scripts/run_linters.py mscom-init
 | 
|  | 238 | +  rules:
 | 
|  | 239 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 240 | +      changes:
 | 
|  | 241 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 242 | +        #
 | 
|  | 243 | +        - '**/*.cpp'
 | 
|  | 244 | +        - '**/*.cc'
 | 
|  | 245 | +        - '**/*.c'
 | 
|  | 246 | +        - '**/*.h'
 | 
|  | 247 | +        - 'tools/lint/mscom-init.yml'
 | 
|  | 248 | +    # Run job whenever a new tag is created
 | 
|  | 249 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 250 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 251 | +
 | 
|  | 252 | +file-whitespace:
 | 
|  | 253 | +  extends: .base
 | 
|  | 254 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 255 | +  script:
 | 
|  | 256 | +    - .gitlab/ci/scripts/run_linters.py file-whitespace
 | 
|  | 257 | +  rules:
 | 
|  | 258 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 259 | +      changes:
 | 
|  | 260 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 261 | +        #
 | 
|  | 262 | +        - '**/*.c'
 | 
|  | 263 | +        - '**/*.cc'
 | 
|  | 264 | +        - '**/*.cpp'
 | 
|  | 265 | +        - '**/*.css'
 | 
|  | 266 | +        - '**/*.dtd'
 | 
|  | 267 | +        - '**/*.idl'
 | 
|  | 268 | +        - '**/*.ftl'
 | 
|  | 269 | +        - '**/*.h'
 | 
|  | 270 | +        - '**/*.html'
 | 
|  | 271 | +        - '**/*.md'
 | 
|  | 272 | +        - '**/*.properties'
 | 
|  | 273 | +        - '**/*.py'
 | 
|  | 274 | +        - '**/*.rs'
 | 
|  | 275 | +        - '**/*.rst'
 | 
|  | 276 | +        - '**/*.webidl'
 | 
|  | 277 | +        - '**/*.xhtml'
 | 
|  | 278 | +        - 'tools/lint/file-whitespace.yml'
 | 
|  | 279 | +    # Run job whenever a new tag is created
 | 
|  | 280 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 281 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 282 | +
 | 
|  | 283 | +test-manifest:
 | 
|  | 284 | +  extends: .base
 | 
|  | 285 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 286 | +  script:
 | 
|  | 287 | +    - .gitlab/ci/scripts/run_linters.py test-manifest-alpha test-manifest-disable test-manifest-skip-if
 | 
|  | 288 | +  rules:
 | 
|  | 289 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 290 | +      changes:
 | 
|  | 291 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 292 | +        #
 | 
|  | 293 | +        - '**/*.ini'
 | 
|  | 294 | +        - 'python/mozlint/**'
 | 
|  | 295 | +        - 'tools/lint/**'
 | 
|  | 296 | +    # Run job whenever a new tag is created
 | 
|  | 297 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 298 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true'
 | 
|  | 299 | +
 | 
|  | 300 | +trojan-source:
 | 
|  | 301 | +  extends: .base
 | 
|  | 302 | +  image: cimg/python:$PYTHON_VERSION
 | 
|  | 303 | +  script:
 | 
|  | 304 | +    - .gitlab/ci/scripts/run_linters.py trojan-source
 | 
|  | 305 | +  rules:
 | 
|  | 306 | +    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
 | 
|  | 307 | +      changes:
 | 
|  | 308 | +        # List copied from: taskcluster/ci/source-test/mozlint.yml
 | 
|  | 309 | +        #
 | 
|  | 310 | +        - '**/*.c'
 | 
|  | 311 | +        - '**/*.cc'
 | 
|  | 312 | +        - '**/*.cpp'
 | 
|  | 313 | +        - '**/*.h'
 | 
|  | 314 | +        - '**/*.py'
 | 
|  | 315 | +        - '**/*.rs'
 | 
|  | 316 | +        - 'tools/lint/trojan-source.yml'
 | 
|  | 317 | +    # Run job whenever a new tag is created
 | 
|  | 318 | +    # or whenever a commit is merged to a protected branch
 | 
|  | 319 | +    - if: $CI_COMMIT_TAG || $CI_COMMIT_REF_PROTECTED == 'true' |