diff options
author | Trevor Elliott <trevor@galois.com> | 2013-06-03 17:11:35 -0700 |
---|---|---|
committer | Trevor Elliott <trevor@galois.com> | 2013-06-03 17:11:35 -0700 |
commit | 998e6546b172850a7f51d0e4e1d50017b655a80e (patch) | |
tree | 61f294daec641b22968dde12370649ca825c9b20 /exampleData | |
parent | 8c0e0a63d3e91977e71bdceaf8caed5a60f4f6d0 (diff) |
Switch to a CommonJS format for rule definitions
Rules are now defined as CommonJS modules, using the exports object as
the external facing API for the rule.
Diffstat (limited to 'exampleData')
-rw-r--r-- | exampleData/ruleSets/colorRules.json | 20 | ||||
-rw-r--r-- | exampleData/ruleSets/colorRules/backgroundCheck.js (renamed from exampleData/ruleSets/backgroundCheck.js) | 12 | ||||
-rw-r--r-- | exampleData/ruleSets/colorRules/foregroundCheck.js (renamed from exampleData/ruleSets/foregroundCheck.js) | 11 |
3 files changed, 24 insertions, 19 deletions
diff --git a/exampleData/ruleSets/colorRules.json b/exampleData/ruleSets/colorRules.json index 54fb549..bcfce72 100644 --- a/exampleData/ruleSets/colorRules.json +++ b/exampleData/ruleSets/colorRules.json @@ -6,20 +6,10 @@ { "name": "Color Guidelines" , "description": "Foreground/background color guidelines" -, "rules": [ - //---------------------------------------------------------------- - { "name": "Foreground check" - , "description": ["Foreground colors should be in the set: \n", - "#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738"] - , "file": "foregroundCheck.js" - }, - //---------------------------------------------------------------- - { "name": "Background check" - , "description": ["Backgrounds colors should be in the set:", - "#00 #FF #3D #F7 #C2 #B4 #4E"] - , "file": "backgroundCheck.js" - } -] +, "rules": + [ "colorRules/foregroundCheck.js" + , "colorRules/backgroundCheck.js" + ] } //---------------------------------------------------------------- /* { "id": 2141103 @@ -72,4 +62,4 @@ //---------------------------------------------------------------- ] } - */
\ No newline at end of file + */ diff --git a/exampleData/ruleSets/backgroundCheck.js b/exampleData/ruleSets/colorRules/backgroundCheck.js index 7da59aa..4ce7043 100644 --- a/exampleData/ruleSets/backgroundCheck.js +++ b/exampleData/ruleSets/colorRules/backgroundCheck.js @@ -1,4 +1,12 @@ -function() { + +exports.name = 'Foreground Check'; + +exports.description = + [ 'Foreground colors should be in the set:' + , '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738' + ].join('\n'); + +exports.rule = function() { var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' '); report("broken"); $5(':visible') @@ -7,4 +15,4 @@ function() { var color = fiveui.color.colorToHex($(elt).css('background-color')); report('non-standard background color: ' + color, $(elt)); }); -} +}; diff --git a/exampleData/ruleSets/foregroundCheck.js b/exampleData/ruleSets/colorRules/foregroundCheck.js index 32a8ee5..5b1e04b 100644 --- a/exampleData/ruleSets/foregroundCheck.js +++ b/exampleData/ruleSets/colorRules/foregroundCheck.js @@ -1,4 +1,11 @@ -function() { +exports.name = 'Background Check'; + +exports.description = + [ 'Backgrounds colors should be in the set:' + , '#00 #FF #3D #F7 #C2 #B4 #4E' + ].join('\n'); + +exports.rule = function() { var allow = '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'.split(' '); $5(':visible') .cssIsNot('color', allow, fiveui.color.colorToHex) @@ -6,4 +13,4 @@ function() { var color = fiveui.color.colorToHex($(elt).css('color')); report('foreground color: ' + color, elt); }); -} +}; |