taskcluster/ci/source-test/mozlint.yml
author Axel Hecht <axel@pike.org>
Fri, 29 Nov 2019 17:57:10 +0000
changeset 504741 b4b10ae558b9ca109218935d2bf48844cbfd7857
parent 504277 0c1efa982f7b148b5752a688c5673fd63b709786
child 506279 34efe80bfd6105472a1a13731a7087856f56fa02
permissions -rw-r--r--
Bug 1597258, follow-up to disable always-target for try-only l10n-conflicts job, r=tomprince Differential Revision: https://phabricator.services.mozilla.com/D55180

# 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/.
---
job-defaults:
    always-target: true
    attributes:
        code-review: true
    treeherder:
        kind: test
        tier: 1
    platform: lint/opt
    worker-type: t-linux-xlarge
    worker:
        docker-image: {in-tree: "lint"}
        max-run-time: 1800
        artifacts:
            - type: file
              name: public/code-review/mozlint.json
              path: /builds/worker/mozlint.json
        env:
            RUSTFMT: /build/rust/bin/rustfmt
            RUSTUP_HOME: /build/rust
            CARGO_HOME: /build/rust
    run:
        using: mach
    when:
        files-changed:
            # Other misc lint related files.
            - 'python/mozlint/**'
            - 'tools/lint/**'

codespell:
    description: Checks for misspellings in text files
    treeherder:
        symbol: text(spell)
    run:
        mach: lint -l codespell -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.js'
            - '**/*.jsm'
            - '**/*.jxs'
            - '**/*.xml'
            - '**/*.html'
            - '**/*.xhtml'
            - '**/*.cpp'
            - '**/*.c'
            - '**/*.h'
            - '**/*.configure'
            - '**/*.py'
            - '**/*.properties'
            - '**/*.rst'
            - '**/*.ftl'

cpp-virtual-final:
    description: lint C++ virtual function declarations
    treeherder:
        symbol: cpp(Cvf)
    run:
        mach: lint -l cpp-virtual-final -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.cpp'
            - '**/*.h'
            - '**/*.mm'

eslint:
    description: JS lint check
    treeherder:
        symbol: js(ES)
    run:
        using: run-task
        cwd: '{checkout}'
        command: >
            cp -r /build/node_modules_eslint node_modules &&
            ln -s ../tools/lint/eslint/eslint-plugin-mozilla node_modules &&
            ln -s ../tools/lint/eslint/eslint-plugin-spidermonkey-js node_modules &&
            ./mach lint -l eslint -f treeherder --quiet -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            # Files that are likely audited.
            - '**/*.js'
            - '**/*.jsm'
            - '**/*.jsx'
            - '**/*.html'
            - '**/*.xhtml'
            - '**/*.xml'
            # Run when eslint policies change.
            - '**/.eslintignore'
            - '**/*eslintrc*'
            # The plugin implementing custom checks.
            - 'tools/lint/eslint/eslint-plugin-mozilla/**'
            - 'tools/lint/eslint/eslint-plugin-spidermonkey-js/**'

license:
    description: Check for license blocks in source files.
    treeherder:
        symbol: pedantic(license)
    run:
        mach: lint -l license -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.c'
            - '**/*.cc'
            - '**/*.cpp'
            - '**/*.h'
            - '**/*.html'
            - '**/*.js'
            - '**/*.jsm'
            - '**/*.jsx'
            - '**/*.m'
            - '**/*.mm'
            - '**/*.py'
            - '**/*.rs'
            - '**/*.xhtml'
            - '**/*.xml'
            - '**/*.xul'

lintpref:
    description: Check for duplicates between all.js and StaticPrefList.yaml.
    treeherder:
        symbol: misc(pref)
    run:
        mach: lint -l lintpref -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - 'modules/libpref/init/all.js'
            - 'modules/libpref/init/StaticPrefList.yaml'
            - 'browser/app/profile/firefox.js'
            - 'mobile/android/app/mobile.js'
            - 'devtools/client/preferences/debugger.js'
            - 'mobile/android/app/geckoview-prefs.js'
            - 'browser/branding/official/pref/firefox-branding.js'
            - 'browser/branding/nightly/pref/firefox-branding.js'
            - 'browser/branding/unofficial/pref/firefox-branding.js'
            - 'browser/branding/aurora/pref/firefox-branding.js'
            - 'browser/app/profile/channel-prefs.js'
            - 'mobile/android/installer/mobile-l10n.js'
            - 'mobile/android/locales/en-US/mobile-l10n.js'

mingw-cap:
    description: lint for MinGW Capitalization issues
    treeherder:
        symbol: misc(mingw)
    run:
        mach: lint -l mingw-capitalization -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.cpp'
            - '**/*.cc'
            - '**/*.c'
            - '**/*.h'

py-compat:
    description: lint for python 2/3 compatibility issues
    treeherder:
        symbol: py(py-compat)
    run:
        mach: lint -l py2 -l py3 -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.py'
            - '**/.flake8'

py-flake8:
    description: flake8 run over the gecko codebase
    treeherder:
        symbol: py(f8)
    run:
        mach: lint -l flake8 -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.py'
            - '**/.flake8'
            # moz.configure files are also Python files.
            - '**/*.configure'

test-manifest:
    description: lint test manifests
    treeherder:
        symbol: misc(tm)
    run:
        mach: lint -l test-disable -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.ini'
            - 'python/mozlint/**'
            - 'tools/lint/**'

wptlint-gecko:
    description: web-platform-tests linter
    treeherder:
        symbol: misc(W)
    run:
        mach: lint -l wpt -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - 'testing/web-platform/tests/**'
            - 'testing/web-platform/mozilla/tests/**'

yaml:
    description: yamllint run over the gecko codebase
    treeherder:
        symbol: pedantic(yaml)
    run:
        mach: lint -l yaml -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.yml'
            - '**/*.yaml'
            - '**/.ymllint'

rst:
    description: rst lint run over the gecko codebase
    treeherder:
        symbol: text(rst)
    run:
        mach: lint -l rst -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.rst'

shellcheck:
    description: shellcheck run over the gecko codebase
    treeherder:
        symbol: misc(shell)
    run:
        mach: lint -l shellcheck -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.sh'


localization:
    description: l10n tests for strings with errors
    treeherder:
        symbol: text(l1nt)
    run:
        mach: lint -l l10n -f treeherder
    attributes:
        code-review: false
    when:
        files-changed:
            - '**/locales/en-US/**'
            - '**/l10n.toml'
            - 'third_party/python/compare-locales/**'
            - 'third_party/python/fluent/**'


l10n-conflicts:
    description: l10n tests for strings with errors and conflicts with cross-channel
    treeherder:
        symbol: text(l1nt-conflicts)
    always-target: false
    run-on-projects:
        - try
    run:
        mach: lint -W -l l10n -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/locales/en-US/**'
            - '**/l10n.toml'
            - 'third_party/python/compare-locales/**'
            - 'third_party/python/fluent/**'


rustfmt:
    description: rustfmt on the Rust code
    treeherder:
        symbol: misc(rustfmt)
    run:
        mach: lint -l rustfmt -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.rs'


file-whitespace:
    description: Check for trailing whitespaces and Windows CR
    platform: lint/opt
    treeherder:
        symbol: pedantic(file-whitespace)
    run:
        mach: lint -l file-whitespace -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.c'
            - '**/*.cc'
            - '**/*.cpp'
            - '**/*.h'
            - '**/*.py'
            - '**/*.rs'


file-perm:
    description: Check for incorrect permissions on source files
    platform: lint/opt
    treeherder:
        symbol: pedantic(file-perm)
    run:
        mach: lint -l file-perm -f treeherder -f json:/builds/worker/mozlint.json
    when:
        files-changed:
            - '**/*.c'
            - '**/*.cc'
            - '**/*.cpp'
            - '**/*.h'
            - '**/*.html'
            - '**/*.js'
            - '**/*.jsm'
            - '**/*.jsx'
            - '**/*.m'
            - '**/*.mm'
            - '**/*.rs'
            - '**/*.xhtml'
            - '**/*.xml'
            - '**/*.xul'