Bug 1623907 - Additional mozlint source tests for Thunderbird. r=darktrojan
authorRob Lemley <rob@thunderbird.net>
Sat, 14 Mar 2020 09:34:15 -0400
changeset 38807 a50b3018a35d526bf304363a26adc2086b82d050
parent 38806 1cd5d14b2f8386707f91cc0a25544299a845b9f8
child 38808 55f47e24fe840ee2607e5ad1a461a0813f9bf331
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewersdarktrojan
bugs1623907
Bug 1623907 - Additional mozlint source tests for Thunderbird. r=darktrojan Config files for running mozlint checks against comm-central code.
taskcluster/ci/source-test/mozlint.yml
tools/lint/GlobalExclude.txt
tools/lint/codespell.yml
tools/lint/file-perm.yml
tools/lint/file-whitespace.yml
tools/lint/license.yml
tools/lint/lintpref.yml
tools/lint/mingw-capitalization.yml
tools/lint/py2.yml
tools/lint/py3.yml
tools/lint/shellcheck.yml
tools/lint/yaml.yml
--- a/taskcluster/ci/source-test/mozlint.yml
+++ b/taskcluster/ci/source-test/mozlint.yml
@@ -2,83 +2,261 @@
 # 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
     treeherder:
         kind: test
         tier: 1
+    platform: lint/opt
     worker-type: t-linux-xlarge
     worker:
         docker-image: {in-tree: "lint"}
         max-run-time: 1800
     run:
         using: mach
         comm-checkout: true
     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-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l codespell -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**.js'
+            - 'comm/**.jsm'
+            - 'comm/**.jxs'
+            - 'comm/**.xml'
+            - 'comm/**.html'
+            - 'comm/**.xhtml'
+            - 'comm/**.cpp'
+            - 'comm/**.c'
+            - 'comm/**.h'
+            - 'comm/**.configure'
+            - 'comm/**.py'
+            - 'comm/**.properties'
+            - 'comm/**.rst'
+            - 'comm/**.md'
+            - 'comm/**.ftl'
+
 eslint:
     description: JS lint check
-    platform: lint/opt
     treeherder:
-        symbol: ES
+        symbol: js(ES)
     run:
         using: run-task
         command: >
             cd /builds/worker/checkouts/gecko/ &&
             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 &&
             cd /builds/worker/checkouts/gecko/comm &&
-            ../mach lint -f treeherder -l eslint --quiet
+            ../mach lint -f treeherder -l eslint --quiet -f json:/builds/worker/mozlint.json *
     when:
         files-changed:
             # Files that are likely audited.
             - 'comm/**/*.js'
             - 'comm/**/*.jsm'
             - 'comm/**/*.jsx'
             - 'comm/**/*.html'
             - 'comm/**/*.xhtml'
             - 'comm/**/*.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/**'
 
-yaml:
-    description: yamllint run over the taskcluster configuration
+file-perm:
+    description: Check for incorrect permissions on source files
+    platform: lint/opt
+    treeherder:
+        symbol: pedantic(file-perm)
+    run-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l file-perm -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.c'
+            - 'comm/**/*.cc'
+            - 'comm/**/*.cpp'
+            - 'comm/**/*.h'
+            - 'comm/**/*.html'
+            - 'comm/**/*.js'
+            - 'comm/**/*.jsm'
+            - 'comm/**/*.jsx'
+            - 'comm/**/*.m'
+            - 'comm/**/*.mm'
+            - 'comm/**/*.rs'
+            - 'comm/**/*.xhtml'
+            - 'comm/**/*.xml'
+            - 'comm/**/*.xul'
+
+file-whitespace:
+    description: Check for trailing whitespaces and Windows CR
     platform: lint/opt
     treeherder:
-        symbol: yaml
+        symbol: pedantic(file-whitespace)
+    run-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l file-whitespace -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.c'
+            - 'comm/**/*.cc'
+            - 'comm/**/*.cpp'
+            - 'comm/**/*.h'
+            - 'comm/**/*.py'
+            - 'comm/**/*.rs'
+
+license:
+    description: Check for license blocks in source files.
+    treeherder:
+        symbol: pedantic(license)
+    run-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l license -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.c'
+            - 'comm/**/*.cc'
+            - 'comm/**/*.cpp'
+            - 'comm/**/*.h'
+            - 'comm/**/*.html'
+            - 'comm/**/*.js'
+            - 'comm/**/*.jsm'
+            - 'comm/**/*.jsx'
+            - 'comm/**/*.m'
+            - 'comm/**/*.mm'
+            - 'comm/**/*.py'
+            - 'comm/**/*.rs'
+            - 'comm/**/*.xhtml'
+            - 'comm/**/*.xml'
+            - 'comm/**/*.xul'
+
+lintpref:
+    description: Check for duplicates between all.js and StaticPrefList.yaml.
+    treeherder:
+        symbol: misc(pref)
+    run-on-projects: ['try-comm-central']
     run:
         mach: >
-            lint -f treeherder -l yaml -n
+            lint -v -l lintpref -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'modules/libpref/init/all.js'
+            - 'modules/libpref/init/StaticPrefList.yaml'
+            - 'comm/mail/app/profile/all-thunderbird.js'
+            - 'comm/mail/app/profile/channel-prefs.js'
+            - 'comm/mail/branding/nightly/thunderbird-branding.js'
+            - 'comm/mail/branding/thunderbird/thunderbird-branding.js'
+
+mingw-cap:
+    description: lint for MinGW Capitalization issues
+    treeherder:
+        symbol: misc(mingw)
+    run:
+        mach: >
+            lint -v -l mingw-capitalization -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.cpp'
+            - 'comm/**/*.cc'
+            - 'comm/**/*.c'
+            - 'comm/**/*.h'
+
+py-compat:
+    description: lint for python 2/3 compatibility issues
+    treeherder:
+        symbol: py(py-compat)
+    run-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l py2 -l py3 -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.py'
+            - 'comm/**/.flake8'
+
+py-flake8:
+    description: flake8 run over the thunderbird codebase
+    treeherder:
+        symbol: py(f8)
+    run:
+        mach: >
+            lint -v -l flake8 -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/taskcluster
+    when:
+        files-changed:
+            - '**/*.py'
+            - '**/.flake8'
+            # moz.configure files are also Python files.
+            - '**/*.configure'
+
+shellcheck:
+    description: shellcheck run over the gecko codebase
+    treeherder:
+        symbol: misc(shell)
+    run-on-projects: ['try-comm-central']
+    run:
+        mach: >
+            lint -v -l shellcheck -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
+            comm/*
+    when:
+        files-changed:
+            - 'comm/**/*.sh'
+
+yaml:
+    description: yamllint run over the taskcluster configuration
+    treeherder:
+        symbol: pedantic(yaml)
+    run:
+        mach: >
+            lint -v -l yaml -f treeherder
+            -f json:/builds/worker/mozlint.json
+            --config-path=comm/tools/lint
             comm/mail/config
             comm/taskcluster
             comm/.*.yml
     when:
         files-changed:
             - 'comm/**/*.yml'
             - 'comm/**/*.yaml'
             - '**/.ymllint'
-
-py-flake8:
-    description: flake8 run over the thunderbird codebase
-    platform: lint/opt
-    treeherder:
-        symbol: f8
-    run:
-        mach: >
-            lint -f treeherder -l flake8 -n
-            comm/taskcluster
-    when:
-        files-changed:
-            - '**/*.py'
-            - '**/.flake8'
-            # moz.configure files are also Python files.
-            - '**/*.configure'
new file mode 100644
--- /dev/null
+++ b/tools/lint/GlobalExclude.txt
@@ -0,0 +1,4 @@
+comm/chat/protocols/matrix/lib
+comm/third_party/libgpg-error
+comm/third_party/libgcrypt
+comm/third_party/libotr
new file mode 100644
--- /dev/null
+++ b/tools/lint/codespell.yml
@@ -0,0 +1,31 @@
+---
+codespell:
+    description: Check code for common misspellings
+    include:
+        - .
+    # List of extensions coming from:
+    # tools/lint/{flake8,eslint}.yml
+    # tools/mach_commands.py (clang-format)
+    # + documentation
+    # + localization files
+    extensions:
+        - js
+        - jsm
+        - jxs
+        - xml
+        - html
+        - xhtml
+        - cpp
+        - c
+        - h
+        - configure
+        - py
+        - properties
+        - rst
+        - md
+        - ftl
+    support-files:
+        - 'tools/lint/spell/**'
+    type: external
+    setup: spell:setup
+    payload: spell:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/file-perm.yml
@@ -0,0 +1,24 @@
+---
+file-perm:
+    description: File permission check
+    include:
+        - .
+    extensions:
+        - .c
+        - .cc
+        - .cpp
+        - .h
+        - .html
+        - .js
+        - .jsm
+        - .jsx
+        - .m
+        - .mm
+        - .rs
+        - .xhtml
+        - .xml
+        - .xul
+    support-files:
+        - 'tools/lint/file-perm/**'
+    type: external
+    payload: file-perm:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/file-whitespace.yml
@@ -0,0 +1,18 @@
+---
+file-whitespace:
+    description: File content sanity check
+    include:
+        - .
+    exclude:
+        - calendar/libical/src/**
+    extensions:
+        - .c
+        - .cc
+        - .cpp
+        - .h
+        - .py
+        - .rs
+    support-files:
+        - 'tools/lint/file-whitespace/**'
+    type: external
+    payload: file-whitespace:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/license.yml
@@ -0,0 +1,30 @@
+---
+license:
+    description: License Check
+    include:
+        - .
+    extensions:
+        - .c
+        - .cc
+        - .cpp
+        - .css
+        - .dtd
+        - .ftl
+        - .h
+        - .html
+        - .js
+        - .jsm
+        - .jsx
+        - .m
+        - .mm
+        - .properties
+        - .py
+        - .rs
+        # - .svg
+        - .xhtml
+        - .xml
+        - .xul
+    support-files:
+        - 'tools/lint/license/**'
+    type: external
+    payload: license:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/lintpref.yml
@@ -0,0 +1,20 @@
+---
+lintpref:
+    description: Linter for static prefs.
+    include:
+        - 'comm/calendar/lightning/content/lightning.js'
+        - 'comm/chat/chat-prefs.js'
+        - 'comm/mail/app/profile/'
+        - 'comm/mail/branding/'
+        - 'comm/mail/components/compose/composer.js'
+        - 'comm/mail/components/im/all-im.js'
+        - 'comm/mail/locales/en-US/all-l10n.js'
+        - 'comm/mailnews/extensions/dsn/content/dsn.js'
+        - 'comm/mailnews/extensions/mdn/content/mdn.js'
+        - 'comm/mailnews/mailnews.js'
+    exclude: []
+    extensions: ['js']
+    type: external
+    payload: libpref:checkdupes
+    support-files:
+        - 'modules/libpref/init/StaticPrefList.yaml'
new file mode 100644
--- /dev/null
+++ b/tools/lint/mingw-capitalization.yml
@@ -0,0 +1,9 @@
+---
+mingw-capitalization:
+    description: >
+      "A Windows include file is not lowercase, and may break the MinGW build"
+    extensions: ['h', 'cpp', 'cc', 'c']
+    include: ['.']
+    type: external
+    level: error
+    payload: cpp.mingw-capitalization:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/py2.yml
@@ -0,0 +1,10 @@
+---
+py2:
+    description: Python 2 compatibility check
+    include: ['.']
+    extensions: ['py']
+    support-files:
+        - 'tools/lint/python/*compat*'
+    type: external
+    payload: python.compat:lintpy2
+    setup: python.compat:setuppy2
new file mode 100644
--- /dev/null
+++ b/tools/lint/py3.yml
@@ -0,0 +1,10 @@
+---
+py3:
+    description: Python 3 compatibility check
+    include: ['.']
+    extensions: ['py']
+    support-files:
+        - 'tools/lint/python/*compat*'
+    type: external
+    payload: python.compat:lintpy3
+    setup: python.compat:setuppy3
new file mode 100644
--- /dev/null
+++ b/tools/lint/shellcheck.yml
@@ -0,0 +1,14 @@
+---
+shellcheck:
+    description: Shell script linter
+    include:
+        - .
+    exclude: []
+    # 1090: https://github.com/koalaman/shellcheck/wiki/SC1090
+    # 'Can't follow a non-constant source'
+    extensions: ['sh']
+    support-files:
+        - 'tools/lint/shell/**'
+    excludecodes: ['1090', '1091']
+    type: external
+    payload: shell:lint
new file mode 100644
--- /dev/null
+++ b/tools/lint/yaml.yml
@@ -0,0 +1,11 @@
+---
+yamllint:
+    description: YAML linter
+    include:
+        - .
+    extensions: ['yml', 'yaml']
+    support-files:
+        - '**/.yamllint'
+        - 'tools/lint/yamllint_/**'
+    type: external
+    payload: yamllint_:lint