mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
21
python/mozlint/test/linters/badreturncode.lint
Normal file
21
python/mozlint/test/linters/badreturncode.lint
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
|
||||
def lint(files, **lintargs):
|
||||
return 1
|
||||
|
||||
|
||||
LINTER = {
|
||||
'name': "BadReturnCodeLinter",
|
||||
'description': "Returns an error code no matter what",
|
||||
'include': [
|
||||
'files',
|
||||
],
|
||||
'type': 'external',
|
||||
'extensions': ['.js', '.jsm'],
|
||||
'payload': lint,
|
||||
}
|
||||
13
python/mozlint/test/linters/explicit_path.lint
Normal file
13
python/mozlint/test/linters/explicit_path.lint
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "ExplicitPathLinter",
|
||||
'description': "Only lint a specific file name",
|
||||
'rule': 'no-foobar',
|
||||
'include': [
|
||||
'no_foobar.js',
|
||||
],
|
||||
'type': 'string',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
30
python/mozlint/test/linters/external.lint
Normal file
30
python/mozlint/test/linters/external.lint
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
from mozlint import result
|
||||
|
||||
|
||||
def lint(files, **lintargs):
|
||||
results = []
|
||||
for path in files:
|
||||
with open(path, 'r') as fh:
|
||||
for i, line in enumerate(fh.readlines()):
|
||||
if 'foobar' in line:
|
||||
results.append(result.from_linter(
|
||||
LINTER, path=path, lineno=i+1, column=1, rule="no-foobar"))
|
||||
return results
|
||||
|
||||
|
||||
LINTER = {
|
||||
'name': "ExternalLinter",
|
||||
'description': "It's bad to have the string foobar in js files.",
|
||||
'include': [
|
||||
'files',
|
||||
],
|
||||
'type': 'external',
|
||||
'extensions': ['.js', '.jsm'],
|
||||
'payload': lint,
|
||||
}
|
||||
10
python/mozlint/test/linters/invalid_exclude.lint
Normal file
10
python/mozlint/test/linters/invalid_exclude.lint
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "BadExcludeLinter",
|
||||
'description': "Has an invalid exclude directive.",
|
||||
'exclude': [0, 1], # should be a list of strings
|
||||
'type': 'string',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
9
python/mozlint/test/linters/invalid_extension.lnt
Normal file
9
python/mozlint/test/linters/invalid_extension.lnt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "BadExtensionLinter",
|
||||
'description': "Has an invalid file extension.",
|
||||
'type': 'string',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
10
python/mozlint/test/linters/invalid_include.lint
Normal file
10
python/mozlint/test/linters/invalid_include.lint
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "BadIncludeLinter",
|
||||
'description': "Has an invalid include directive.",
|
||||
'include': 'should be a list',
|
||||
'type': 'string',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
9
python/mozlint/test/linters/invalid_type.lint
Normal file
9
python/mozlint/test/linters/invalid_type.lint
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "BadTypeLinter",
|
||||
'description': "Has an invalid type.",
|
||||
'type': 'invalid',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
7
python/mozlint/test/linters/missing_attrs.lint
Normal file
7
python/mozlint/test/linters/missing_attrs.lint
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "MissingAttrsLinter",
|
||||
'description': "Missing type and payload",
|
||||
}
|
||||
4
python/mozlint/test/linters/missing_definition.lint
Normal file
4
python/mozlint/test/linters/missing_definition.lint
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
# No LINTER variable
|
||||
19
python/mozlint/test/linters/raises.lint
Normal file
19
python/mozlint/test/linters/raises.lint
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
from mozlint.errors import LintException
|
||||
|
||||
|
||||
def lint(files, **lintargs):
|
||||
raise LintException("Oh no something bad happened!")
|
||||
|
||||
|
||||
LINTER = {
|
||||
'name': "RaisesLinter",
|
||||
'description': "Raises an exception",
|
||||
'type': 'external',
|
||||
'payload': lint,
|
||||
}
|
||||
15
python/mozlint/test/linters/regex.lint
Normal file
15
python/mozlint/test/linters/regex.lint
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "RegexLinter",
|
||||
'description': "Make sure the string 'foobar' never appears "
|
||||
"in a js variable file because it is bad.",
|
||||
'rule': 'no-foobar',
|
||||
'include': [
|
||||
'**/*.js',
|
||||
'**/*.jsm',
|
||||
],
|
||||
'type': 'regex',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
15
python/mozlint/test/linters/string.lint
Normal file
15
python/mozlint/test/linters/string.lint
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
|
||||
LINTER = {
|
||||
'name': "StringLinter",
|
||||
'description': "Make sure the string 'foobar' never appears "
|
||||
"in browser js files because it is bad.",
|
||||
'rule': 'no-foobar',
|
||||
'include': [
|
||||
'**/*.js',
|
||||
'**/*.jsm',
|
||||
],
|
||||
'type': 'string',
|
||||
'payload': 'foobar',
|
||||
}
|
||||
28
python/mozlint/test/linters/structured.lint
Normal file
28
python/mozlint/test/linters/structured.lint
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
|
||||
def lint(files, logger, **kwargs):
|
||||
for path in files:
|
||||
with open(path, 'r') as fh:
|
||||
for i, line in enumerate(fh.readlines()):
|
||||
if 'foobar' in line:
|
||||
logger.lint_error(path=path,
|
||||
lineno=i+1,
|
||||
column=1,
|
||||
rule="no-foobar")
|
||||
|
||||
|
||||
LINTER = {
|
||||
'name': "StructuredLinter",
|
||||
'description': "It's bad to have the string foobar in js files.",
|
||||
'include': [
|
||||
'files',
|
||||
],
|
||||
'type': 'structured_log',
|
||||
'extensions': ['.js', '.jsm'],
|
||||
'payload': lint,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue