Permalink
Browse files

Updated readme; added necessary files

  • Loading branch information...
1 parent 614831b commit a4e5a0bed2a869089dfacd4f378a456df1e46a4b Matt Basta committed Jul 1, 2010
Showing with 228 additions and 101 deletions.
  1. +6 −0 .gitignore
  2. +24 −0 LICENSE
  3. +126 −101 README → README.rst
  4. +72 −0 hashes.txt
View
6 .gitignore
@@ -0,0 +1,6 @@
+/testfiles
+/testfiles/*
+*.pyc
+.DS_Store
+.coverage
+.figleaf
View
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2010, Mozilla Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+Neither the name of the Mozilla Corporation nor the names of its
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
227 README → README.rst
@@ -1,60 +1,75 @@
-addons.mozilla.org Validator
-----------------------------------------
+==============================
+ addons.mozilla.org Validator
+==============================
+-------------
+ Version 1.0
+-------------
This validator is a proposed replacement for the current add-on
validator available at addons.mozilla.org. It is written entirely in
python.
Prerequisites
-------------
+=============
Python Libraries:
+
- rdflib
- cssutils
-Pythong Libraries for Testing:
+Python Libraries for Testing:
+
- nose
- coverage
Running
-------------
+=======
Run the validator as follows:
-python package-parser.py <path to xpi> [-t <expected type>]
- [-o <output type>] [-v] [--file <output file>] [--boring]
+ python package-parser.py <path to xpi> [-t <expected type>] [-o <output type>] [-v] [--file <output file>] [--boring]
The path to the XPI should point to an XPI file.
Expected Type:
+--------------
The expected type should be one of the following values:
-- any (default) : Accepts any extension
-- extension : Accepts only extensions
-- theme : Accepts only themes
-- dictionary : Accepts only dictionaries
-- languagepack : Accepts only language packs
-- search : Accepts only OpenSearch XML files (unpackaged)
-- multi : Accepts only multiextension XPI packages
+any (default)
+ Accepts any extension
+extension
+ Accepts only extensions
+theme
+ Accepts only themes
+dictionary
+ Accepts only dictionaries
+languagepack
+ Accepts only language packs
+search
+ Accepts only OpenSearch XML files (unpackaged)
+multi
+ Accepts only multi-item XPI packages
Specifying an expected type will throw an error if the validator
does not detect that particular type when scanning. All addon type
detection mechanisms are used to make this determination.
Output Type:
+------------
The output type may be either of the following:
-- text (default) : Outputs a textual summary of the addo-on
- analysis. Supports verbose mode.
-- json : Outputs a JSON snippet representing a full summary of the
- add-on analysis.
+text (default)
+ Outputs a textual summary of the addo-on analysis. Supports verbose mode.
+json
+ Outputs a JSON snippet representing a full summary of the add-on analysis.
Verbose Mode:
+-------------
If the "-v" flag is set, the output will include informational
messages in addition to errors and warnings. Informational messages
@@ -70,6 +85,7 @@ default.
Output File:
+------------
Specifying an output file with the "--file" flag captures the output of
the analysis and stores it to the file specified. Specifying this
@@ -79,14 +95,16 @@ When outputting to a file, Boring Mode is automatically activated.
Boring Mode:
+------------
Boring mode, when activated, doesn't print colors to the terminal.
Output
-------------
+======
Text Output Mode:
+-----------------
In text output mode ("text"), output is structured in the format of one
message per line. The messages are prefixed by their priority level
@@ -97,50 +115,54 @@ add-on type was determined to be.
JSON Output Mode:
+-----------------
In JSON output mode ("json"), output is formatted as a JSON snippet
containing all messages. The format for the JSON output is that of the
sample document below.
-{
- "detected_type": "extension",
- "success": false,
- "messages": [
- {
- "type": "error",
- "message": "This is the error message text.",
- "description": "Description of the error message.",
- "file": "",
- "line": 0
- },
- {
- "type": "warning",
- "message": "This is the warning message text.",
- "description": "Description of the warning message.",
- "file": "testfile.xml",
- "line": 0
- },
- {
- "type": "info",
- "message": "This is the informational message text.",
- "description": "Description of the info message."
- "file": "chrome.manifest",
- "line": 21
- },
- {
- "type": "error",
- "message": "test.xpi > An error was found.",
- "description": "This error happened within a subpackage."
- "file": [
- "test.xpi",
- "chrome.manifest"
- ],
- "line": 21
- }
- ]
-}
+::
+
+ {
+ "detected_type": "extension",
+ "success": false,
+ "messages": [
+ {
+ "type": "error",
+ "message": "This is the error message text.",
+ "description": "Description of the error message.",
+ "file": "",
+ "line": 0
+ },
+ {
+ "type": "warning",
+ "message": "This is the warning message text.",
+ "description": "Description of the warning message.",
+ "file": "testfile.xml",
+ "line": 0
+ },
+ {
+ "type": "info",
+ "message": "This is the informational message text.",
+ "description": "Description of the info message."
+ "file": "chrome.manifest",
+ "line": 21
+ },
+ {
+ "type": "error",
+ "message": "test.xpi > An error was found.",
+ "description": "This error happened within a subpackage."
+ "file": [
+ "test.xpi",
+ "chrome.manifest"
+ ],
+ "line": 21
+ }
+ ]
+ }
JSON Notes:
+~~~~~~~~~~~
When a subpackage exists, an angle bracket will delimit the subpackage
name and the message text.
@@ -156,54 +178,57 @@ of the list in the `file` attribute is an empty string.
For instance, this tree would generate the following messages:
-package_to_test.xpi
- |
- |-install.rdf
- |-chrome.manifest
- |-subpackage.xpi
- | |
- | |-subsubpackage.xpi
- | |
- | |-chrome.manifest
- | |-install.rdf
- |
- |-subpackage.jar
- |
- |-install.rdf
-
-
-{
- "type": "info",
- "message": "<em:type> not found in install.rdf",
- "description": " ... ",
- "file": "install.rdf",
- "line": 0
-},
-{
- "type": "error",
- "message": "Invalid chrome.manifest subject: override",
- "description": " ... ",
- "file": "chrome.manifest",
- "line": 7
-},
-{
- "type": "error",
- "message": "subpackage.xpi > install.rdf missing from theme",
- "description": " ... ",
- "file": ["subpackage.xpi", ""],
- "line": 0
-},
-{
- "type": "error",
- "message": "subpackage.xpi > subsubpackage.xpi > Invalid chrome.manifest subject: sytle",
- "description": " ... ",
- "file": ["subpackage.xpi", "subsubpackage.xpi", "chrome.manifest"],
- "line": 5
-}
+::
+
+ package_to_test.xpi
+ |
+ |-install.rdf
+ |-chrome.manifest
+ |-subpackage.xpi
+ | |
+ | |-subsubpackage.xpi
+ | |
+ | |-chrome.manifest
+ | |-install.rdf
+ |
+ |-subpackage.jar
+ |
+ |-install.rdf
+
+::
+
+ {
+ "type": "info",
+ "message": "<em:type> not found in install.rdf",
+ "description": " ... ",
+ "file": "install.rdf",
+ "line": 0
+ },
+ {
+ "type": "error",
+ "message": "Invalid chrome.manifest subject: override",
+ "description": " ... ",
+ "file": "chrome.manifest",
+ "line": 7
+ },
+ {
+ "type": "error",
+ "message": "subpackage.xpi > install.rdf missing from theme",
+ "description": " ... ",
+ "file": ["subpackage.xpi", ""],
+ "line": 0
+ },
+ {
+ "type": "error",
+ "message": "subpackage.xpi > subsubpackage.xpi > Invalid chrome.manifest subject: sytle",
+ "description": " ... ",
+ "file": ["subpackage.xpi", "subsubpackage.xpi", "chrome.manifest"],
+ "line": 5
+ }
Testing
-------------
+=======
Unit tests can be run with a simple call to:
View
72 hashes.txt
@@ -0,0 +1,72 @@
+2c11746af7d894ed4b92d3fa69d6432eaad20343
+77c33a86bb26834d52ccd7b908290d7a4444564e
+c34d6c84ec67d4a61af87b1634bc007f2d46ba91
+97e561dfeb842c21b35e6f9963914316221cca1d
+fa05290dadfb7d2659a55c50b77595e23f999a74
+08341cd159e29f561ca0ec16c99bf4b85e43d30f
+d3b30b0fead39e4c40fb0c91408e74439020a279
+84b1514a01def3bc0b52f6fa03d0d9fa349bef72
+4c12e01d990bd2b1075812d9f28e3ffa50ca59df
+ddb4126bf4713cb4e0f2310401e58cb9e3f98997
+9d6f8bdcadd59eba977e9e31066bf393c9fdf8a4
+4a2c9fd552e1ca9ad66feaaad365990b1e664a8f
+88c03b5c437ac3551661ecfbe6e1de155c3099c4
+24fdaa88685c8b2dadcc94559ceef318fdcd115b
+24dd74d65d2e02aae973af97ebbb31b9820a5bbb
+788bb58005b75a004cd7abbd26f942eea0391f47
+07c089df7b7a5da16f434870087d6b0e1c45d3b5
+31555f340a206de7622fb760718ef4a1b296ed44
+16306f8187df578589821e6eb6b807ac4d467d1f
+384cbfe95d92a30d7c86ac07ea5de56f79c15f6a
+0cafb88edcaebad82c207cdf124de1889364c9f3
+ca0aea084a63d0a56e1bbf17fde5061f631b391f
+71adcc2cae87e412e521e4a7276efeaee2347927
+d97ecac3f1b3ccf1f0f68434e8406f87f5acc907
+2710cce192fcc4dc676d9572cd852f104ea59387
+c82ea9768b18696832408b6cc729e2e121def691
+6463e558dd79d51a2e8464806824c7bbc18c77fd
+677c1ad6d84705c818d63a43298ee3a12959c1b3
+3bb92e84642c03cf0fe49174d0e1c420d46d2e18
+0d2bc9db63acd9cc238a4925e79f9a3079490970
+6869cb783670d6a4923aaccfe4331015961ed8d6
+8963108fa84c2033a1052d47079d7f75a7e5b60e
+20860bad9c83c3890be57052f009b9d97848c9ec
+9025fe9334566eb919ddca85a8f949b01c7d837d
+55c7f265deba4afc1335071fafbbf7fda8f02bbe
+1be9c3684054001f53fa7ff6d85ec3cb573a9cd2
+c10dbe0c2b23444d0794f3376398702d84f41583
+3aca6488dfb65cf0e600a7a70376ca1354b7377c
+e0c497fc264d7706da23235266ed52acf2c7b89a
+83d1b489e30275a03f568f7e3fa6537d695e0197
+6be187a67b639b65dc8427eb8e790e42bbe4d7dd
+fed603a4db640b82de54b246de4be7a1cffa8780
+f0b95e99225f314fbe37ccf6b74ce2f916c517de
+3dc9f7c2642efff4482e68c9d9df874bf98f5bcb
+f3abd53f3725675e3e049c414749e16df11951ba
+7b9e8594368d30387059e5fdef9d662095dbbf7a
+6b911b0dc178423b946b0299851d9661004c21ef
+bff995d3a845903f281b0b51fea421059459a808
+265a86a9d9df5dfdbad77e06c85605bec4beb32a
+2c13dad3020d417aa841afbdba8548572533f9c3
+f02e1f7f1bb966d5fcf16b03daa79ee077a993f8
+b5efe44645f5358e3d785091af3440f80afa85e3
+65cbff4e9d95d47a6f31d96ab4ea361c1f538a7b
+d3e67a40156f1ea0bb5110246d967da3258f2d83
+72db638e9516db4e13952e0beec37e8bb7d0b12d
+e5335c2a82f26e49b1324edc21e452de040d5cdc
+e956e4de8f223992e2d1362d78c5b5bb33e27497
+84067c2604750933d3fe048c1f45c1c9d8f9038c
+65bfcaccbf4cf0ea3c34c86e495967fd3318540c
+879550d2acbdb1679ec3163a73a6dd6f8374882e
+015cf89260f3e8f0b86f5a17558125c933692989
+278d68b8e9edad4895836e272fbc8f78ec4f2f3e
+c147a1a86a2c33e60f160b8861501f43f4638c8d
+0b3effe3da813132e92d5f873ada776fd1c17f32
+4540775a3cb3fd95d5d344f88e74867b6f6c5573
+c9664029b47f98b41c1606e387605561006c50b7
+21a72032fbddf0f2edf9af79cbdcc2453ebc793d
+a488f653834a3146793e15bdbd11266a3d9ba3ed
+0bb3166ecb1bcf5111ddf59b1813cbfa513be60f
+66851ab2133e27b97c4f3048416b947aa7ed82c5
+5847ed101f55d51c53538a7078971e7de8fb6762
+e96461c6c19608f528b4a3c33a032b697b999b62

0 comments on commit a4e5a0b

Please sign in to comment.