← Back to team overview

yellow team mailing list archive

[Merge] lp:~benji/juju-gui/yuidoc-forgiveness into lp:juju-gui

 

Benji York has proposed merging lp:~benji/juju-gui/yuidoc-forgiveness into lp:juju-gui.

Requested reviews:
  Juju GUI Hackers (juju-gui)

For more details, see:
https://code.launchpad.net/~benji/juju-gui/yuidoc-forgiveness/+merge/138819

Add the ability to rebuild the undocumented file.

Add an "undocumented" make target that rebuilds the yuidoc linter's list of
legacy undocumented functions.

https://codereview.appspot.com/6867080/

-- 
https://code.launchpad.net/~benji/juju-gui/yuidoc-forgiveness/+merge/138819
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~benji/juju-gui/yuidoc-forgiveness into lp:juju-gui.
=== modified file 'Makefile'
--- Makefile	2012-12-07 11:48:03 +0000
+++ Makefile	2012-12-07 19:22:25 +0000
@@ -118,6 +118,9 @@
 jshint: node_modules/jshint
 	node_modules/jshint/bin/hint $(JSFILES)
 
+undocumented:
+	bin/lint-yuidoc --generate-undocumented > undocumented
+
 yuidoc-lint: $(JSFILES)
 	bin/lint-yuidoc
 
@@ -268,6 +271,6 @@
 	appcache-touch appcache-force yuidoc spritegen yuidoc-lint \
 	build-files javascript-libraries build build-debug help \
 	build-prod clean clean-deps clean-docs clean-all devel debug \
-	prod link-debug-files link-prod-files doc
+	prod link-debug-files link-prod-files doc undocumented
 
 .DEFAULT_GOAL := all

=== modified file 'bin/lint-yuidoc'
--- bin/lint-yuidoc	2012-11-26 15:16:23 +0000
+++ bin/lint-yuidoc	2012-12-07 19:22:25 +0000
@@ -103,7 +103,21 @@
         file_num_doc_lines)
 
 
-def main():
+def read_undocumented_listing(lines):
+    """Read the listing of legacy undocumented functions."""
+    old_style = len(lines) and ':' not in lines[0]
+    if old_style:
+        raise RuntimeError('This version of the lint-yuidoc program can not '
+            'read the old-style "undocumented" file.  Try regenerating it '
+            'with --generate-undocumented.')
+
+    new_style_regex = re.compile('([^:]+):[^ ]+ "([^"]+)"')
+    def parser(line):
+        return new_style_regex.match(line).groups()
+    return set(map(parser, lines))
+
+
+def main(argv):
     """Check inline documentation of Javascript functions.
 
     Traverse the "app" subtree excluding all "assets" directories and
@@ -111,13 +125,17 @@
     number of documentation lines, the total number of undocumented functions,
     and any discrepancies between the current status and the undocumented list.
     """
+    in_generate_undocumented_file_mode = '--generate-undocumented' in argv
     # Did we find any lint?
     found_errors = False
     # All of the functions found.
     all_functions = set()
     total_num_doc_lines = 0
-    with open('undocumented') as f:
-        undocumented = [tuple(line.split()) for line in f.readlines()]
+    if in_generate_undocumented_file_mode:
+        undocumented = ()
+    else:
+        with open('undocumented') as f:
+            undocumented = read_undocumented_listing(f.readlines())
     for root, dirs, files in os.walk('app'):
         # Ignore any asset directories.
         try:
@@ -131,13 +149,21 @@
                 file_num_doc_lines) = check_file(file_name, undocumented)
             all_functions.update(file_functions)
             for code_location in missing_doc_functions:
-                print code_location, 'undocumented but not listed as such'
-                found_errors = True
-            for code_location in falsely_undoc_functions:
-                print code_location, 'erroneously listed as undocumented'
-                found_errors = True
+                if in_generate_undocumented_file_mode:
+                    print code_location
+                else:
+                    print code_location, 'undocumented but not listed as such'
+                    found_errors = True
+            if in_generate_undocumented_file_mode:
+                for code_location in falsely_undoc_functions:
+                    print code_location, 'erroneously listed as undocumented'
+                    found_errors = True
             total_num_doc_lines += file_num_doc_lines
 
+    if in_generate_undocumented_file_mode:
+        # Nothing more to do.
+        return 0
+
     print
     print 'Total documentation lines: %d' % total_num_doc_lines
 
@@ -157,4 +183,4 @@
 
 
 if __name__ == '__main__':
-    sys.exit(main())
+    sys.exit(main(sys.argv))

=== modified file 'undocumented'
--- undocumented	2012-11-12 15:19:43 +0000
+++ undocumented	2012-12-07 19:22:25 +0000
@@ -1,213 +1,240 @@
-app/app.js callback
-app/models/charm.js compare
-app/models/charm.js failure
-app/models/charm.js initializer
-app/models/charm.js parse
-app/models/charm.js sync
-app/models/charm.js validator
-app/models/endpoints.js add
-app/models/endpoints.js convert
-app/models/models.js _setDefaultsAndCalculatedValues
-app/models/models.js add
-app/models/models.js comparator
-app/models/models.js getModelById
-app/models/models.js getModelFromChange
-app/models/models.js getModelListByModelName
-app/models/models.js getNotificationsForModel
-app/models/models.js get_informative_states_for_service
-app/models/models.js get_relations_for_service
-app/models/models.js get_units_for_service
-app/models/models.js has_relation_for_endpoint
-app/models/models.js initializer
-app/models/models.js on_delta
-app/models/models.js process_delta
-app/models/models.js removeOldest
-app/models/models.js reset
-app/models/models.js setter
-app/models/models.js trim
-app/models/models.js update_service_unit_aggregates
-app/models/models.js valueFn
-app/store/charm.js _normalizeCharms
-app/store/charm.js find
-app/store/charm.js loadByPath
-app/store/charm.js setter
-app/store/charm.js success
-app/store/env.js Environment
-app/store/env.js _dispatch_event
-app/store/env.js _dispatch_rpc_result
-app/store/env.js _send_rpc
-app/store/env.js add_relation
-app/store/env.js add_unit
-app/store/env.js connect
-app/store/env.js deploy
-app/store/env.js destroy_service
-app/store/env.js destructor
-app/store/env.js dispatch_result
-app/store/env.js expose
-app/store/env.js get_charm
-app/store/env.js get_endpoints
-app/store/env.js get_service
-app/store/env.js initializer
-app/store/env.js on_close
-app/store/env.js on_message
-app/store/env.js on_open
-app/store/env.js remove_relation
-app/store/env.js remove_units
-app/store/env.js resolved
-app/store/env.js set_config
-app/store/env.js set_constraints
-app/store/env.js status
-app/store/env.js unexpose
-app/store/notifications.js evict
-app/store/notifications.js generate_notices
-app/store/notifications.js level
-app/store/notifications.js message
-app/store/notifications.js title
-app/views/charm-panel.js _moveTooltip
-app/views/charm-panel.js _showErrors
-app/views/charm-panel.js calculatePanelPosition
-app/views/charm-panel.js createInstance
-app/views/charm-panel.js getInstance
-app/views/charm-panel.js hideDescription
-app/views/charm-panel.js initializer
-app/views/charm-panel.js killInstance
-app/views/charm-panel.js mouseenter
-app/views/charm-panel.js mouseleave
-app/views/charm-panel.js onCharmDeployClicked
-app/views/charm-panel.js render
-app/views/charm-panel.js setDefaultSeries
-app/views/charm-panel.js setPanel
-app/views/charm-panel.js setupOverlay
-app/views/charm-panel.js showConfiguration
-app/views/charm-panel.js showDescription
-app/views/charm-panel.js updatePanelPosition
-app/views/charm.js _deployCallback
-app/views/charm.js initializer
-app/views/charm.js on_charm_data
-app/views/charm.js on_charm_deploy
-app/views/charm.js on_results_change
-app/views/charm.js on_search_change
-app/views/charm.js render
-app/views/environment.js _addRelationCallback
-app/views/environment.js _bindEvent
-app/views/environment.js _destroyCallback
-app/views/environment.js _fire_zoom
-app/views/environment.js _removeRelationCallback
-app/views/environment.js addRelation
-app/views/environment.js addRelationDrag
-app/views/environment.js addRelationDragEnd
-app/views/environment.js addRelationDragStart
-app/views/environment.js addRelationEnd
-app/views/environment.js addRelationStart
-app/views/environment.js ambiguousAddRelationCheck
-app/views/environment.js attachSceneEvents
-app/views/environment.js buildScene
-app/views/environment.js cancelRelationBuild
-app/views/environment.js destroyService
-app/views/environment.js destroyServiceConfirm
-app/views/environment.js detachSceneEvents
-app/views/environment.js drawRelation
-app/views/environment.js drawRelationGroup
-app/views/environment.js drawService
-app/views/environment.js fade
-app/views/environment.js hide
-app/views/environment.js hideGraphListPicker
-app/views/environment.js initializer
-app/views/environment.js mouseenter
-app/views/environment.js mouseleave
-app/views/environment.js mouseout
-app/views/environment.js mouseover
-app/views/environment.js postRender
-app/views/environment.js processRelation
-app/views/environment.js processRelations
-app/views/environment.js relationClick
-app/views/environment.js removeRelation
-app/views/environment.js removeRelationConfirm
-app/views/environment.js render
-app/views/environment.js renderSlider
-app/views/environment.js rescale
-app/views/environment.js serviceClick
-app/views/environment.js serviceDblClick
-app/views/environment.js serviceForBox
-app/views/environment.js setSizesFromViewport
-app/views/environment.js show
-app/views/environment.js showGraphListPicker
-app/views/environment.js show_service
-app/views/environment.js subordinateRelationsForService
-app/views/environment.js toggleControlPanel
-app/views/environment.js updateCanvas
-app/views/environment.js updateData
-app/views/environment.js updateLinks
-app/views/environment.js updateServiceMenuLocation
-app/views/environment.js zoom_in
-app/views/environment.js zoom_out
-app/views/notifications.js close
-app/views/notifications.js getShowable
-app/views/notifications.js initializer
-app/views/notifications.js notificationSelect
-app/views/notifications.js notifyToggle
-app/views/notifications.js render
-app/views/notifications.js slowRender
-app/views/service.js _addUnitCallback
-app/views/service.js _destroyCallback
-app/views/service.js _exposeServiceCallback
-app/views/service.js _modifyUnits
-app/views/service.js _removeRelationCallback
-app/views/service.js _removeUnitCallback
-app/views/service.js _setConfigCallback
-app/views/service.js _setConstraintsCallback
-app/views/service.js _unexposeServiceCallback
-app/views/service.js confirmDestroy
-app/views/service.js confirmRemoved
-app/views/service.js destroyService
-app/views/service.js doRemoveRelation
-app/views/service.js exposeService
-app/views/service.js filterUnits
-app/views/service.js fitToWindow
-app/views/service.js getHeight
-app/views/service.js getServiceTabs
-app/views/service.js initializer
-app/views/service.js modifyUnits
-app/views/service.js render
-app/views/service.js resetUnits
-app/views/service.js saveConfig
-app/views/service.js showErrors
-app/views/service.js unexposeService
-app/views/service.js updateConstraints
-app/views/unit.js _removeUnitCallback
-app/views/unit.js _resolvedRelationCallback
-app/views/unit.js _resolvedUnitCallback
-app/views/unit.js confirmRemoved
-app/views/unit.js confirmResolved
-app/views/unit.js confirmResolvedRelation
-app/views/unit.js doRemoveUnit
-app/views/unit.js doResolvedRelation
-app/views/unit.js doResolvedUnit
-app/views/unit.js initializer
-app/views/unit.js retry
-app/views/unit.js retryRelation
-app/views/utils.js BoundingBox
-app/views/utils.js Box
-app/views/utils.js BoxPair
-app/views/utils.js _addAlertMessage
-app/views/utils.js action
-app/views/utils.js addSVGClass
-app/views/utils.js bindModelView
-app/views/utils.js console
-app/views/utils.js get
-app/views/utils.js hasSVGClass
-app/views/utils.js humanizeNumber
-app/views/utils.js invokeCallback
-app/views/utils.js isFloat
-app/views/utils.js isInt
-app/views/utils.js native
-app/views/utils.js noop
-app/views/utils.js pair
-app/views/utils.js removeSVGClass
-app/views/utils.js renderable_charm
-app/views/utils.js scale
-app/views/utils.js set
-app/views/utils.js substitute
-app/views/utils.js toString
-app/views/utils.js toggleSVGClass
-app/views/utils.js translate
+app/app.js:95 "callback"
+app/app.js:569 "callback"
+app/store/charm.js:66 "_normalizeCharms"
+app/store/charm.js:24 "find"
+app/store/charm.js:11 "success"
+app/store/charm.js:105 "setter"
+app/store/charm.js:7 "loadByPath"
+app/store/notifications.js:100 "level"
+app/store/notifications.js:148 "generate_notices"
+app/store/notifications.js:118 "evict"
+app/store/notifications.js:140 "level"
+app/store/notifications.js:108 "message"
+app/store/notifications.js:22 "title"
+app/store/notifications.js:25 "message"
+app/store/notifications.js:129 "title"
+app/store/notifications.js:137 "message"
+app/store/env.js:64 "on_close"
+app/store/env.js:69 "on_message"
+app/store/env.js:181 "status"
+app/store/env.js:132 "remove_units"
+app/store/env.js:198 "set_config"
+app/store/env.js:59 "on_open"
+app/store/env.js:185 "remove_relation"
+app/store/env.js:150 "get_service"
+app/store/env.js:155 "deploy"
+app/store/env.js:146 "get_charm"
+app/store/env.js:218 "resolved"
+app/store/env.js:211 "set_constraints"
+app/store/env.js:192 "destroy_service"
+app/store/env.js:226 "get_endpoints"
+app/store/env.js:5 "Environment"
+app/store/env.js:92 "_dispatch_event"
+app/store/env.js:40 "connect"
+app/store/env.js:173 "expose"
+app/store/env.js:101 "_dispatch_rpc_result"
+app/store/env.js:112 "_send_rpc"
+app/store/env.js:35 "destructor"
+app/store/env.js:125 "add_unit"
+app/store/env.js:177 "unexpose"
+app/store/env.js:86 "dispatch_result"
+app/store/env.js:139 "add_relation"
+app/store/env.js:22 "initializer"
+app/views/charm.js:32 "render"
+app/views/charm.js:96 "_deployCallback"
+app/views/charm.js:61 "on_charm_data"
+app/views/charm.js:141 "on_search_change"
+app/views/charm.js:69 "on_charm_deploy"
+app/views/charm.js:114 "initializer"
+app/views/charm.js:16 "initializer"
+app/views/charm.js:166 "on_results_change"
+app/views/charm.js:122 "render"
+app/views/service.js:488 "updateConstraints"
+app/views/service.js:514 "_setConstraintsCallback"
+app/views/service.js:846 "filterUnits"
+app/views/service.js:288 "initializer"
+app/views/service.js:547 "render"
+app/views/service.js:372 "render"
+app/views/service.js:451 "_removeRelationCallback"
+app/views/service.js:191 "_destroyCallback"
+app/views/service.js:338 "fitToWindow"
+app/views/service.js:116 "_removeUnitCallback"
+app/views/service.js:737 "_setConfigCallback"
+app/views/service.js:402 "confirmRemoved"
+app/views/service.js:264 "_exposeServiceCallback"
+app/views/service.js:667 "showErrors"
+app/views/service.js:257 "exposeService"
+app/views/service.js:800 "render"
+app/views/service.js:52 "_modifyUnits"
+app/views/service.js:707 "saveConfig"
+app/views/service.js:608 "render"
+app/views/service.js:339 "getHeight"
+app/views/service.js:182 "destroyService"
+app/views/service.js:30 "modifyUnits"
+app/views/service.js:424 "doRemoveRelation"
+app/views/service.js:300 "getServiceTabs"
+app/views/service.js:166 "confirmDestroy"
+app/views/service.js:88 "_addUnitCallback"
+app/views/service.js:23 "resetUnits"
+app/views/service.js:230 "unexposeService"
+app/views/service.js:237 "_unexposeServiceCallback"
+app/views/notifications.js:239 "render"
+app/views/notifications.js:63 "notifyToggle"
+app/views/notifications.js:93 "notificationSelect"
+app/views/notifications.js:209 "getShowable"
+app/views/notifications.js:15 "initializer"
+app/views/notifications.js:266 "getShowable"
+app/views/notifications.js:134 "render"
+app/views/notifications.js:121 "slowRender"
+app/views/notifications.js:218 "close"
+app/views/unit.js:132 "doResolvedUnit"
+app/views/unit.js:180 "doRemoveUnit"
+app/views/unit.js:190 "_removeUnitCallback"
+app/views/unit.js:264 "doResolvedRelation"
+app/views/unit.js:162 "confirmRemoved"
+app/views/unit.js:275 "_resolvedRelationCallback"
+app/views/unit.js:218 "retry"
+app/views/unit.js:141 "_resolvedUnitCallback"
+app/views/unit.js:246 "confirmResolvedRelation"
+app/views/unit.js:297 "retryRelation"
+app/views/unit.js:118 "confirmResolved"
+app/views/unit.js:23 "initializer"
+app/views/utils.js:110 "bindModelView"
+app/views/utils.js:53 "console"
+app/views/utils.js:619 "translate"
+app/views/utils.js:486 "isFloat"
+app/views/utils.js:254 "action"
+app/views/utils.js:566 "get"
+app/views/utils.js:557 "get"
+app/views/utils.js:475 "toString"
+app/views/utils.js:195 "removeSVGClass"
+app/views/utils.js:567 "set"
+app/views/utils.js:560 "set"
+app/views/utils.js:50 "noop"
+app/views/utils.js:574 "get"
+app/views/utils.js:143 "humanizeNumber"
+app/views/utils.js:531 "BoundingBox"
+app/views/utils.js:482 "isInt"
+app/views/utils.js:286 "_addAlertMessage"
+app/views/utils.js:174 "addSVGClass"
+app/views/utils.js:211 "toggleSVGClass"
+app/views/utils.js:81 "substitute"
+app/views/utils.js:334 "invokeCallback"
+app/views/utils.js:166 "hasSVGClass"
+app/views/utils.js:618 "scale"
+app/views/utils.js:741 "BoxPair"
+app/views/utils.js:32 "noop"
+app/views/utils.js:47 "native"
+app/views/utils.js:575 "set"
+app/views/utils.js:133 "renderable_charm"
+app/views/utils.js:744 "pair"
+app/views/utils.js:533 "Box"
+app/views/environment.js:1167 "addRelationDrag"
+app/views/environment.js:1072 "fade"
+app/views/environment.js:1389 "rescale"
+app/views/environment.js:1354 "zoom_in"
+app/views/environment.js:1090 "postRender"
+app/views/environment.js:1216 "_removeRelationCallback"
+app/views/environment.js:1545 "toggleControlPanel"
+app/views/environment.js:1144 "addRelationDragStart"
+app/views/environment.js:1458 "setSizesFromViewport"
+app/views/environment.js:1765 "_addRelationCallback"
+app/views/environment.js:432 "serviceDblClick"
+app/views/environment.js:1602 "_destroyCallback"
+app/views/environment.js:1571 "destroyServiceConfirm"
+app/views/environment.js:1261 "cancelRelationBuild"
+app/views/environment.js:676 "drawRelationGroup"
+app/views/environment.js:404 "detachSceneEvents"
+app/views/environment.js:265 "buildScene"
+app/views/environment.js:139 "mouseenter"
+app/views/environment.js:980 "processRelation"
+app/views/environment.js:250 "render"
+app/views/environment.js:991 "processRelations"
+app/views/environment.js:1066 "hide"
+app/views/environment.js:351 "attachSceneEvents"
+app/views/environment.js:656 "updateLinks"
+app/views/environment.js:1185 "addRelationDragEnd"
+app/views/environment.js:489 "updateData"
+app/views/environment.js:438 "relationClick"
+app/views/environment.js:1643 "ambiguousAddRelationCheck"
+app/views/environment.js:415 "serviceClick"
+app/views/environment.js:1594 "destroyService"
+app/views/environment.js:1060 "show"
+app/views/environment.js:1632 "addRelationStart"
+app/views/environment.js:529 "updateCanvas"
+app/views/environment.js:1016 "subordinateRelationsForService"
+app/views/environment.js:76 "mouseenter"
+app/views/environment.js:147 "mouseleave"
+app/views/environment.js:1726 "addRelationEnd"
+app/views/environment.js:1504 "updateServiceMenuLocation"
+app/views/environment.js:1204 "removeRelation"
+app/views/environment.js:1363 "_fire_zoom"
+app/views/environment.js:1421 "hideGraphListPicker"
+app/views/environment.js:239 "initializer"
+app/views/environment.js:1345 "zoom_out"
+app/views/environment.js:742 "drawRelation"
+app/views/environment.js:758 "drawService"
+app/views/environment.js:1133 "addRelation"
+app/views/environment.js:1564 "show_service"
+app/views/environment.js:114 "mouseleave"
+app/views/environment.js:173 "mouseout"
+app/views/environment.js:1411 "showGraphListPicker"
+app/views/environment.js:168 "mouseover"
+app/views/environment.js:1051 "serviceForBox"
+app/views/environment.js:1241 "removeRelationConfirm"
+app/views/environment.js:1022 "renderSlider"
+app/views/environment.js:360 "_bindEvent"
+app/views/charm-panel.js:948 "createInstance"
+app/views/charm-panel.js:476 "initializer"
+app/views/charm-panel.js:250 "render"
+app/views/charm-panel.js:1140 "calculatePanelPosition"
+app/views/charm-panel.js:723 "showDescription"
+app/views/charm-panel.js:332 "showConfiguration"
+app/views/charm-panel.js:936 "setupOverlay"
+app/views/charm-panel.js:655 "render"
+app/views/charm-panel.js:873 "onCharmDeployClicked"
+app/views/charm-panel.js:736 "hideDescription"
+app/views/charm-panel.js:195 "mouseleave"
+app/views/charm-panel.js:417 "_showErrors"
+app/views/charm-panel.js:1179 "getInstance"
+app/views/charm-panel.js:480 "render"
+app/views/charm-panel.js:994 "setPanel"
+app/views/charm-panel.js:651 "initializer"
+app/views/charm-panel.js:209 "initializer"
+app/views/charm-panel.js:1123 "updatePanelPosition"
+app/views/charm-panel.js:700 "_moveTooltip"
+app/views/charm-panel.js:1185 "killInstance"
+app/views/charm-panel.js:1170 "setDefaultSeries"
+app/views/charm-panel.js:192 "mouseenter"
+app/models/models.js:305 "setter"
+app/models/models.js:430 "getModelListByModelName"
+app/models/models.js:325 "add"
+app/models/models.js:171 "update_service_unit_aggregates"
+app/models/models.js:358 "getNotificationsForModel"
+app/models/models.js:69 "process_delta"
+app/models/models.js:456 "on_delta"
+app/models/models.js:421 "getModelById"
+app/models/models.js:149 "get_informative_states_for_service"
+app/models/models.js:204 "process_delta"
+app/models/models.js:339 "trim"
+app/models/models.js:385 "initializer"
+app/models/models.js:437 "getModelFromChange"
+app/models/models.js:273 "get_relations_for_service"
+app/models/models.js:330 "comparator"
+app/models/models.js:120 "add"
+app/models/models.js:112 "_setDefaultsAndCalculatedValues"
+app/models/models.js:297 "valueFn"
+app/models/models.js:446 "reset"
+app/models/models.js:130 "get_units_for_service"
+app/models/models.js:108 "process_delta"
+app/models/models.js:345 "removeOldest"
+app/models/models.js:240 "has_relation_for_endpoint"
+app/models/models.js:231 "process_delta"
+app/models/charm.js:155 "validator"
+app/models/charm.js:113 "parse"
+app/models/charm.js:77 "sync"
+app/models/charm.js:105 "failure"
+app/models/charm.js:48 "initializer"
+app/models/charm.js:129 "compare"
+app/models/endpoints.js:43 "add"
+app/models/endpoints.js:32 "convert"


Follow ups