diff --git a/platform/commonUI/browse/test/creation/CreateWizardSpec.js b/platform/commonUI/browse/test/creation/CreateWizardSpec.js index 713b1d33d3..628fdbc447 100644 --- a/platform/commonUI/browse/test/creation/CreateWizardSpec.js +++ b/platform/commonUI/browse/test/creation/CreateWizardSpec.js @@ -152,7 +152,7 @@ define( }); it("validates selection types using policy", function () { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject', ['getCapability'] ), @@ -166,8 +166,8 @@ define( rows = structure.sections[sections.length - 1].rows, locationRow = rows[rows.length - 1]; - mockDomainObject.getCapability.andReturn(mockOtherType); - locationRow.validate(mockDomainObject); + mockDomainObj.getCapability.andReturn(mockOtherType); + locationRow.validate(mockDomainObj); // Should check policy to see if the user-selected location // can actually contain objects of this type diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index 7ec48122ca..2f682fc950 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -63,10 +63,10 @@ define( }); } - function showDialog(type) { + function showDialog(objType) { // Create a dialog object to generate the form structure, etc. var dialog = - new PropertiesDialog(type, domainObject.getModel()); + new PropertiesDialog(objType, domainObject.getModel()); // Show the dialog return dialogService.getUserInput( diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index 3174330d03..7617101549 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -75,8 +75,8 @@ define( * Invoke persistence on a domain object. This will be called upon * the removed object's parent (as its composition will have changed.) */ - function doPersist(domainObject) { - var persistence = domainObject.getCapability('persistence'); + function doPersist(domainObj) { + var persistence = domainObj.getCapability('persistence'); return persistence && persistence.persist(); } diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 7659367dc6..5184d73086 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -223,7 +223,7 @@ define( // Update value for this property in all elements of the // selection which have this property. - function updateProperties(property, value) { + function updateProperties(property, val) { var changed = false; // Update property in a selected element @@ -233,12 +233,12 @@ define( // Check if this is a setter, or just assignable if (typeof selected[property] === 'function') { changed = - changed || (selected[property]() !== value); - selected[property](value); + changed || (selected[property]() !== val); + selected[property](val); } else { changed = - changed || (selected[property] !== value); - selected[property] = value; + changed || (selected[property] !== val); + selected[property] = val; } } } diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index 0e30920575..a4146f5965 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -133,11 +133,11 @@ define( self = this; // Initialize toolbar (expose object to parent scope) - function initialize(definition) { + function initialize(def) { // If we have been asked to expose toolbar state... if (self.attrs.toolbar) { // Initialize toolbar object - self.toolbar = new EditToolbar(definition, self.commit); + self.toolbar = new EditToolbar(def, self.commit); // Ensure toolbar state is exposed self.exposeToolbar(); } diff --git a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js index eebf513464..00d245a256 100644 --- a/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js +++ b/platform/commonUI/edit/test/actions/PropertiesDialogSpec.js @@ -37,11 +37,11 @@ define( model = { x: "initial value" }; properties = ["x", "y", "z"].map(function (k) { return { - getValue: function (model) { - return model[k]; + getValue: function (m) { + return m[k]; }, - setValue: function (model, v) { - model[k] = v; + setValue: function (m, v) { + m[k] = v; }, getDefinition: function () { return { control: 'textfield '}; diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index 2348db23c4..af0204c24d 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -50,8 +50,8 @@ define( var context = domainObject && domainObject.getCapability('context'), objectPath = context ? context.getPath() : [], - ids = objectPath.map(function (domainObject) { - return domainObject.getId(); + ids = objectPath.map(function (domainObj) { + return domainObj.getId(); }); // Parses the path together. Starts with the diff --git a/platform/commonUI/general/src/ui/TreeNodeView.js b/platform/commonUI/general/src/ui/TreeNodeView.js index 2cff198e76..13b28bb473 100644 --- a/platform/commonUI/general/src/ui/TreeNodeView.js +++ b/platform/commonUI/general/src/ui/TreeNodeView.js @@ -105,8 +105,8 @@ define([ function getIdPath(domainObject) { var context = domainObject && domainObject.getCapability('context'); - function getId(domainObject) { - return domainObject.getId(); + function getId(domainObj) { + return domainObj.getId(); } return context ? context.getPath().map(getId) : []; diff --git a/platform/commonUI/general/src/ui/TreeView.js b/platform/commonUI/general/src/ui/TreeView.js index da0bed7091..07d155e960 100644 --- a/platform/commonUI/general/src/ui/TreeView.js +++ b/platform/commonUI/general/src/ui/TreeView.js @@ -62,8 +62,8 @@ define([ var self = this, domainObject = this.activeObject; - function addNode(domainObject, index) { - self.nodeViews[index].model(domainObject); + function addNode(domainObj, index) { + self.nodeViews[index].model(domainObj); } function addNodes(domainObjects) { diff --git a/platform/commonUI/general/test/ui/TreeViewSpec.js b/platform/commonUI/general/test/ui/TreeViewSpec.js index 1e492d4bfd..c889c31090 100644 --- a/platform/commonUI/general/test/ui/TreeViewSpec.js +++ b/platform/commonUI/general/test/ui/TreeViewSpec.js @@ -36,7 +36,7 @@ define([ treeView; function makeMockDomainObject(id, model, capabilities) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, [ 'getId', @@ -46,18 +46,18 @@ define([ 'useCapability' ] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn(model); - mockDomainObject.hasCapability.andCallFake(function (c) { + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn(model); + mockDomainObj.hasCapability.andCallFake(function (c) { return !!(capabilities[c]); }); - mockDomainObject.getCapability.andCallFake(function (c) { + mockDomainObj.getCapability.andCallFake(function (c) { return capabilities[c]; }); - mockDomainObject.useCapability.andCallFake(function (c) { + mockDomainObj.useCapability.andCallFake(function (c) { return capabilities[c] && capabilities[c].invoke(); }); - return mockDomainObject; + return mockDomainObj; } beforeEach(function () { @@ -99,24 +99,16 @@ define([ var mockComposition; function makeGenericCapabilities() { - var mockContext = - jasmine.createSpyObj('context', ['getPath']), - mockType = - jasmine.createSpyObj('type', ['getGlyph']), - mockLocation = - jasmine.createSpyObj('location', ['isLink']), - mockMutation = - jasmine.createSpyObj('mutation', ['listen']), - mockStatus = + var mockStatus = jasmine.createSpyObj('status', ['listen', 'list']); mockStatus.list.andReturn([]); return { - context: mockContext, - type: mockType, - mutation: mockMutation, - location: mockLocation, + context: jasmine.createSpyObj('context', ['getPath']), + type: jasmine.createSpyObj('type', ['getGlyph']), + location: jasmine.createSpyObj('location', ['isLink']), + mutation: jasmine.createSpyObj('mutation', ['listen']), status: mockStatus }; } @@ -133,11 +125,11 @@ define([ beforeEach(function () { mockComposition = ['a', 'b', 'c'].map(function (id) { - var testCapabilities = makeGenericCapabilities(), + var testCaps = makeGenericCapabilities(), mockChild = - makeMockDomainObject(id, {}, testCapabilities); + makeMockDomainObject(id, {}, testCaps); - testCapabilities.context.getPath + testCaps.context.getPath .andReturn([mockDomainObject, mockChild]); return mockChild; @@ -207,11 +199,11 @@ define([ describe("when a context-less object is selected", function () { beforeEach(function () { - var testCapabilities = makeGenericCapabilities(), - mockDomainObject = - makeMockDomainObject('xyz', {}, testCapabilities); - delete testCapabilities.context; - treeView.value(mockDomainObject); + var testCaps = makeGenericCapabilities(), + mockDomainObj = + makeMockDomainObject('xyz', {}, testCaps); + delete testCaps.context; + treeView.value(mockDomainObj); }); it("clears all selection state", function () { diff --git a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js index 5dbee8177d..81a3fd9e84 100644 --- a/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoButtonGesture.js @@ -79,8 +79,8 @@ define( // On any touch on the body, default body touches/events // are prevented, the bubble is dismissed, and the touchstart // body event is unbound, reallowing gestures - body.on('touchstart', function (event) { - event.preventDefault(); + body.on('touchstart', function (evt) { + evt.preventDefault(); hideBubble(); body.unbind('touchstart'); }); diff --git a/platform/commonUI/mobile/test/AgentServiceSpec.js b/platform/commonUI/mobile/test/AgentServiceSpec.js index e55113810e..da8c19ddc8 100644 --- a/platform/commonUI/mobile/test/AgentServiceSpec.js +++ b/platform/commonUI/mobile/test/AgentServiceSpec.js @@ -69,7 +69,7 @@ define( }); it("detects display orientation", function () { - var agentService = new AgentService(testWindow); + agentService = new AgentService(testWindow); testWindow.innerWidth = 1024; testWindow.innerHeight = 400; expect(agentService.isPortrait()).toBeFalsy(); diff --git a/platform/core/src/actions/ActionProvider.js b/platform/core/src/actions/ActionProvider.js index 4e3973186c..b0afd3e909 100644 --- a/platform/core/src/actions/ActionProvider.js +++ b/platform/core/src/actions/ActionProvider.js @@ -81,8 +81,8 @@ define( // additionally fills in the action's getMetadata method // with the extension definition (if no getMetadata // method was supplied.) - function instantiateAction(Action, context) { - var action = new Action(context), + function instantiateAction(Action, ctxt) { + var action = new Action(ctxt), metadata; // Provide a getMetadata method that echos @@ -90,7 +90,7 @@ define( // unless the action has defined its own. if (!action.getMetadata) { metadata = Object.create(Action.definition || {}); - metadata.context = context; + metadata.context = ctxt; action.getMetadata = function () { return metadata; }; @@ -103,14 +103,14 @@ define( // applicable in a given context, according to the static // appliesTo method of given actions (if defined), and // instantiate those applicable actions. - function createIfApplicable(actions, context) { + function createIfApplicable(actions, ctxt) { function isApplicable(Action) { - return Action.appliesTo ? Action.appliesTo(context) : true; + return Action.appliesTo ? Action.appliesTo(ctxt) : true; } function instantiate(Action) { try { - return instantiateAction(Action, context); + return instantiateAction(Action, ctxt); } catch (e) { $log.error([ "Could not instantiate action", diff --git a/platform/core/src/capabilities/CompositionCapability.js b/platform/core/src/capabilities/CompositionCapability.js index c2d08cdf26..598767a422 100644 --- a/platform/core/src/capabilities/CompositionCapability.js +++ b/platform/core/src/capabilities/CompositionCapability.js @@ -82,7 +82,7 @@ define( return mutationResult && self.invoke().then(findObject); } - function addIdToModel(model) { + function addIdToModel(objModel) { // Pick a specific index if needed. index = isNaN(index) ? composition.length : index; // Also, don't put past the end of the array @@ -90,11 +90,11 @@ define( // Remove the existing instance of the id if (oldIndex !== -1) { - model.composition.splice(oldIndex, 1); + objModel.composition.splice(oldIndex, 1); } // ...and add it back at the appropriate index. - model.composition.splice(index, 0, id); + objModel.composition.splice(index, 0, id); } // If no index has been specified already and the id is already diff --git a/platform/core/src/capabilities/CoreCapabilityProvider.js b/platform/core/src/capabilities/CoreCapabilityProvider.js index 27833630a2..7e5d1e4b7b 100644 --- a/platform/core/src/capabilities/CoreCapabilityProvider.js +++ b/platform/core/src/capabilities/CoreCapabilityProvider.js @@ -62,9 +62,9 @@ define( } // Package capabilities as key-value pairs - function packageCapabilities(capabilities) { + function packageCapabilities(caps) { var result = {}; - capabilities.forEach(function (capability) { + caps.forEach(function (capability) { if (capability.key) { result[capability.key] = result[capability.key] || capability; diff --git a/platform/core/src/capabilities/MutationCapability.js b/platform/core/src/capabilities/MutationCapability.js index ec448af17c..592f613438 100644 --- a/platform/core/src/capabilities/MutationCapability.js +++ b/platform/core/src/capabilities/MutationCapability.js @@ -124,9 +124,9 @@ define( clone = JSON.parse(JSON.stringify(model)), useTimestamp = arguments.length > 1; - function notifyListeners(model) { + function notifyListeners(newModel) { generalTopic.notify(domainObject); - specificTopic.notify(model); + specificTopic.notify(newModel); } // Function to handle copying values to the actual diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 204cd7de35..8e1990892d 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -124,8 +124,8 @@ define( this.persistenceService.createObject; // Update persistence timestamp... - domainObject.useCapability("mutation", function (model) { - model.persisted = modified; + domainObject.useCapability("mutation", function (m) { + m.persisted = modified; }, modified); // ...and persist diff --git a/platform/core/src/models/PersistedModelProvider.js b/platform/core/src/models/PersistedModelProvider.js index 7a74ebb23a..cd6fde75c4 100644 --- a/platform/core/src/models/PersistedModelProvider.js +++ b/platform/core/src/models/PersistedModelProvider.js @@ -82,9 +82,9 @@ define( } // Package the result as id->model - function packageResult(parsedIds, models) { + function packageResult(parsedIdsToPackage, models) { var result = {}; - parsedIds.forEach(function (parsedId, index) { + parsedIdsToPackage.forEach(function (parsedId, index) { var id = parsedId.id; if (models[index]) { result[id] = models[index]; @@ -93,11 +93,11 @@ define( return result; } - function loadModels(parsedIds) { - return $q.all(parsedIds.map(loadModel)) + function loadModels(parsedIdsToLoad) { + return $q.all(parsedIdsToLoad.map(loadModel)) .then(function (models) { return packageResult( - parsedIds, + parsedIdsToLoad, models.map(addPersistedTimestamp) ); }); diff --git a/platform/core/src/types/MergeModels.js b/platform/core/src/types/MergeModels.js index be9a6ebab8..a33c6dba40 100644 --- a/platform/core/src/types/MergeModels.js +++ b/platform/core/src/types/MergeModels.js @@ -58,14 +58,14 @@ define( * corresponding keys in the recursive step. * * - * @param a the first object to be merged - * @param b the second object to be merged + * @param modelA the first object to be merged + * @param modelB the second object to be merged * @param merger the merger, as described above - * @returns {*} the result of merging `a` and `b` + * @returns {*} the result of merging `modelA` and `modelB` * @constructor * @memberof platform/core */ - function mergeModels(a, b, merger) { + function mergeModels(modelA, modelB, merger) { var mergeFunction; function mergeArrays(a, b) { @@ -93,11 +93,11 @@ define( } mergeFunction = (merger && Function.isFunction(merger)) ? merger : - (Array.isArray(a) && Array.isArray(b)) ? mergeArrays : - (a instanceof Object && b instanceof Object) ? mergeObjects : + (Array.isArray(modelA) && Array.isArray(modelB)) ? mergeArrays : + (modelA instanceof Object && modelB instanceof Object) ? mergeObjects : mergeOther; - return mergeFunction(a, b); + return mergeFunction(modelA, modelB); } return mergeModels; diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index f2ae2655b6..b30efce0d9 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -159,8 +159,8 @@ define( } function lookupTypeDef(typeKey) { - function buildTypeDef(typeKey) { - var typeDefs = typeDefinitions[typeKey] || [], + function buildTypeDef(typeKeyToBuild) { + var typeDefs = typeDefinitions[typeKeyToBuild] || [], inherits = typeDefs.map(function (typeDef) { return asArray(typeDef.inherits || []); }).reduce(function (a, b) { @@ -175,7 +175,7 @@ define( // Always provide a default name def.model = def.model || {}; def.model.name = def.model.name || - ("Unnamed " + (def.name || "Object")); + ("Unnamed " + (def.name || "Object")); return def; } diff --git a/platform/core/src/views/ViewProvider.js b/platform/core/src/views/ViewProvider.js index 6ee1ccb4c4..7af298c7e8 100644 --- a/platform/core/src/views/ViewProvider.js +++ b/platform/core/src/views/ViewProvider.js @@ -105,15 +105,15 @@ define( // Check if an object has all capabilities designated as `needs` // for a view. Exposing a capability via delegation is taken to // satisfy this filter if `allowDelegation` is true. - function capabilitiesMatch(domainObject, capabilities, allowDelegation) { - var delegation = domainObject.getCapability("delegation"); + function capabilitiesMatch(domainObj, capabilities, allowDelegation) { + var delegation = domainObj.getCapability("delegation"); allowDelegation = allowDelegation && (delegation !== undefined); // Check if an object has (or delegates, if allowed) a // capability. function hasCapability(c) { - return domainObject.hasCapability(c) || + return domainObj.hasCapability(c) || (allowDelegation && delegation.doesDelegateCapability(c)); } @@ -128,13 +128,13 @@ define( // Check if a view and domain object type can be paired; // both can restrict the others they accept. - function viewMatchesType(view, type) { - var views = type && (type.getDefinition() || {}).views, + function viewMatchesType(view, objType) { + var views = objType && (objType.getDefinition() || {}).views, matches = true; // View is restricted to a certain type if (view.type) { - matches = matches && type && type.instanceOf(view.type); + matches = matches && objType && objType.instanceOf(view.type); } // Type wishes to restrict its specific views diff --git a/platform/core/test/capabilities/InstantiationCapabilitySpec.js b/platform/core/test/capabilities/InstantiationCapabilitySpec.js index 4a798a567d..b65f26f368 100644 --- a/platform/core/test/capabilities/InstantiationCapabilitySpec.js +++ b/platform/core/test/capabilities/InstantiationCapabilitySpec.js @@ -73,16 +73,16 @@ define( }); it("uses the instantiate service to create domain objects", function () { - var mockDomainObject = jasmine.createSpyObj('domainObject', [ + var mockDomainObj = jasmine.createSpyObj('domainObject', [ 'getId', 'getModel', 'getCapability', 'useCapability', 'hasCapability' ]), testModel = { someKey: "some value" }; - mockInstantiate.andReturn(mockDomainObject); + mockInstantiate.andReturn(mockDomainObj); expect(instantiation.instantiate(testModel)) - .toBe(mockDomainObject); + .toBe(mockDomainObj); expect(mockInstantiate) .toHaveBeenCalledWith({ someKey: "some value", diff --git a/platform/core/test/models/CachingModelDecoratorSpec.js b/platform/core/test/models/CachingModelDecoratorSpec.js index ec7a4dd32d..73a0957b28 100644 --- a/platform/core/test/models/CachingModelDecoratorSpec.js +++ b/platform/core/test/models/CachingModelDecoratorSpec.js @@ -99,7 +99,7 @@ define( }); it("ensures a single object instance, even for multiple concurrent calls", function () { - var promiseA, promiseB, mockCallback = jasmine.createSpy(); + var promiseA, promiseB; promiseA = fakePromise(); promiseB = fakePromise(); @@ -126,7 +126,7 @@ define( }); it("is robust against updating with undefined values", function () { - var promiseA, promiseB, mockCallback = jasmine.createSpy(); + var promiseA, promiseB; promiseA = fakePromise(); promiseB = fakePromise(); diff --git a/platform/core/test/views/ViewProviderSpec.js b/platform/core/test/views/ViewProviderSpec.js index ddeff3e158..6d725708da 100644 --- a/platform/core/test/views/ViewProviderSpec.js +++ b/platform/core/test/views/ViewProviderSpec.js @@ -109,7 +109,7 @@ define( it("restricts typed views to matching types", function () { var testType = "testType", testView = { key: "x", type: testType }, - provider = new ViewProvider([testView], mockLog); + viewProvider = new ViewProvider([testView], mockLog); // Include a "type" capability capabilities.type = jasmine.createSpyObj( @@ -120,21 +120,21 @@ define( // Should be included when types match capabilities.type.instanceOf.andReturn(true); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([testView]); expect(capabilities.type.instanceOf) .toHaveBeenCalledWith(testType); // ...but not when they don't capabilities.type.instanceOf.andReturn(false); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([]); }); it("enforces view restrictions from types", function () { var testView = { key: "x" }, - provider = new ViewProvider([testView], mockLog); + viewProvider = new ViewProvider([testView], mockLog); // Include a "type" capability capabilities.type = jasmine.createSpyObj( @@ -146,13 +146,13 @@ define( // Should be included when view keys match capabilities.type.getDefinition .andReturn({ views: [testView.key]}); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([testView]); // ...but not when they don't capabilities.type.getDefinition .andReturn({ views: ["somethingElse"]}); - expect(provider.getViews(mockDomainObject)) + expect(viewProvider.getViews(mockDomainObject)) .toEqual([]); }); diff --git a/platform/entanglement/src/actions/AbstractComposeAction.js b/platform/entanglement/src/actions/AbstractComposeAction.js index 25c9fbabf5..e81ee4361c 100644 --- a/platform/entanglement/src/actions/AbstractComposeAction.js +++ b/platform/entanglement/src/actions/AbstractComposeAction.js @@ -126,11 +126,11 @@ define( label = this.verb + " To"; - validateLocation = function (newParent) { + validateLocation = function (newParentObj) { var newContext = self.cloneContext(); newContext.selectedObject = object; - newContext.domainObject = newParent; - return composeService.validate(object, newParent) && + newContext.domainObject = newParentObj; + return composeService.validate(object, newParentObj) && self.policyService.allow("action", self, newContext); }; @@ -139,8 +139,8 @@ define( label, validateLocation, currentParent - ).then(function (newParent) { - return composeService.perform(object, newParent); + ).then(function (newParentObj) { + return composeService.perform(object, newParentObj); }); }; diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index 3bff772ef5..37745501ac 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -83,11 +83,11 @@ define( // Combines caller-provided filter (if any) with the // baseline behavior of respecting creation policy. - function filterWithPolicy(domainObject) { - return (!filter || filter(domainObject)) && + function filterWithPolicy(domainObj) { + return (!filter || filter(domainObj)) && policyService.allow( "creation", - domainObject.getCapability("type") + domainObj.getCapability("type") ); } diff --git a/platform/entanglement/src/services/LocationService.js b/platform/entanglement/src/services/LocationService.js index 0fa096f2af..42925b8235 100644 --- a/platform/entanglement/src/services/LocationService.js +++ b/platform/entanglement/src/services/LocationService.js @@ -77,8 +77,8 @@ define( return dialogService .getUserInput(formStructure, formState) - .then(function (formState) { - return formState.location; + .then(function (userFormState) { + return userFormState.location; }); } }; diff --git a/platform/entanglement/test/services/CopyServiceSpec.js b/platform/entanglement/test/services/CopyServiceSpec.js index a392b59b03..b52e7aab6a 100644 --- a/platform/entanglement/test/services/CopyServiceSpec.js +++ b/platform/entanglement/test/services/CopyServiceSpec.js @@ -458,17 +458,17 @@ define( }); it("throws an error", function () { - var copyService = + var service = new CopyService(mockQ, policyService); function perform() { - copyService.perform(object, newParent); + service.perform(object, newParent); } - spyOn(copyService, "validate"); - copyService.validate.andReturn(true); + spyOn(service, "validate"); + service.validate.andReturn(true); expect(perform).not.toThrow(); - copyService.validate.andReturn(false); + service.validate.andReturn(false); expect(perform).toThrow(); }); }); diff --git a/platform/features/plot/test/PlotOptionsControllerSpec.js b/platform/features/plot/test/PlotOptionsControllerSpec.js index f48aa517e1..a95aabce7c 100644 --- a/platform/features/plot/test/PlotOptionsControllerSpec.js +++ b/platform/features/plot/test/PlotOptionsControllerSpec.js @@ -120,7 +120,7 @@ define( it("on changes in form values, updates the object model", function () { var scopeConfiguration = mockScope.configuration, - model = mockDomainObject.getModel(); + objModel = mockDomainObject.getModel(); scopeConfiguration.plot.yAxis.autoScale = true; scopeConfiguration.plot.yAxis.key = 'eu'; @@ -130,10 +130,10 @@ define( mockScope.$watchCollection.calls[0].args[1](); expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function)); - mockDomainObject.useCapability.mostRecentCall.args[1](model); - expect(model.configuration.plot.yAxis.autoScale).toBe(true); - expect(model.configuration.plot.yAxis.key).toBe('eu'); - expect(model.configuration.plot.xAxis.key).toBe('lst'); + mockDomainObject.useCapability.mostRecentCall.args[1](objModel); + expect(objModel.configuration.plot.yAxis.autoScale).toBe(true); + expect(objModel.configuration.plot.yAxis.key).toBe('eu'); + expect(objModel.configuration.plot.xAxis.key).toBe('lst'); }); diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index 79496a14db..e4cfa45b23 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -32,15 +32,15 @@ define( /** * Set default values for optional parameters on a given scope */ - function setDefaults($scope) { - if (typeof $scope.enableFilter === 'undefined') { - $scope.enableFilter = true; - $scope.filters = {}; + function setDefaults(scope) { + if (typeof scope.enableFilter === 'undefined') { + scope.enableFilter = true; + scope.filters = {}; } - if (typeof $scope.enableSort === 'undefined') { - $scope.enableSort = true; - $scope.sortColumn = undefined; - $scope.sortDirection = undefined; + if (typeof scope.enableSort === 'undefined') { + scope.enableSort = true; + scope.sortColumn = undefined; + scope.sortDirection = undefined; } } @@ -485,13 +485,13 @@ define( /** * Returns true if row matches all filters. */ - function matchRow(filters, row) { - return Object.keys(filters).every(function (key) { + function matchRow(filterMap, row) { + return Object.keys(filterMap).every(function (key) { if (!row[key]) { return false; } var testVal = String(row[key].text).toLowerCase(); - return testVal.indexOf(filters[key]) !== -1; + return testVal.indexOf(filterMap[key]) !== -1; }); } diff --git a/platform/features/timeline/src/capabilities/ActivityTimespan.js b/platform/features/timeline/src/capabilities/ActivityTimespan.js index 405fbec50b..61e120d688 100644 --- a/platform/features/timeline/src/capabilities/ActivityTimespan.js +++ b/platform/features/timeline/src/capabilities/ActivityTimespan.js @@ -52,25 +52,25 @@ define( // Set the start time associated with this object function setStart(value) { var end = getEnd(); - mutation.mutate(function (model) { - model.start.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.start.timestamp = Math.max(value, 0); // Update duration to keep end time - model.duration.timestamp = Math.max(end - value, 0); + m.duration.timestamp = Math.max(end - value, 0); }, model.modified); } // Set the duration associated with this object function setDuration(value) { - mutation.mutate(function (model) { - model.duration.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.duration.timestamp = Math.max(value, 0); }, model.modified); } // Set the end time associated with this object function setEnd(value) { var start = getStart(); - mutation.mutate(function (model) { - model.duration.timestamp = Math.max(value - start, 0); + mutation.mutate(function (m) { + m.duration.timestamp = Math.max(value - start, 0); }, model.modified); } diff --git a/platform/features/timeline/src/capabilities/CumulativeGraph.js b/platform/features/timeline/src/capabilities/CumulativeGraph.js index f9ffcb4b66..92d1cfa503 100644 --- a/platform/features/timeline/src/capabilities/CumulativeGraph.js +++ b/platform/features/timeline/src/capabilities/CumulativeGraph.js @@ -53,21 +53,21 @@ define( // Initialize the data values function initializeValues() { - var values = [], + var vals = [], slope = 0, i; // Add a point (or points, if needed) reaching to the provided // domain and/or range value function addPoint(domain, range) { - var previous = values[values.length - 1], + var previous = vals[vals.length - 1], delta = domain - previous.domain, // time delta change = delta * slope * rate, // change next = previous.range + change; // Crop to minimum boundary... if (next < minimum) { - values.push({ + vals.push({ domain: intercept( previous.domain, previous.range, @@ -81,7 +81,7 @@ define( // ...and maximum boundary if (next > maximum) { - values.push({ + vals.push({ domain: intercept( previous.domain, previous.range, @@ -95,19 +95,19 @@ define( // Add the new data value if (delta > 0) { - values.push({ domain: domain, range: next }); + vals.push({ domain: domain, range: next }); } slope = range; } - values.push({ domain: 0, range: initial }); + vals.push({ domain: 0, range: initial }); for (i = 0; i < graph.getPointCount(); i += 1) { addPoint(graph.getDomainValue(i), graph.getRangeValue(i)); } - return values; + return vals; } function convertToPercent(point) { diff --git a/platform/features/timeline/src/capabilities/ResourceGraph.js b/platform/features/timeline/src/capabilities/ResourceGraph.js index 2e0bec8497..93ced78f09 100644 --- a/platform/features/timeline/src/capabilities/ResourceGraph.js +++ b/platform/features/timeline/src/capabilities/ResourceGraph.js @@ -72,13 +72,13 @@ define( // If there are sequences of points with the same timestamp, // allow only the first and last. - function filterPoint(value, index, values) { + function filterPoint(value, index, vals) { // Allow the first or last point as a base case; aside from // that, allow only points that have different timestamps // from their predecessor or successor. - return (index === 0) || (index === values.length - 1) || - (value.domain !== values[index - 1].domain) || - (value.domain !== values[index + 1].domain); + return (index === 0) || (index === vals.length - 1) || + (value.domain !== vals[index - 1].domain) || + (value.domain !== vals[index + 1].domain); } // Add a step up or down (Step 3c above) diff --git a/platform/features/timeline/src/capabilities/TimelineTimespan.js b/platform/features/timeline/src/capabilities/TimelineTimespan.js index 3224d42ab5..de747764ef 100644 --- a/platform/features/timeline/src/capabilities/TimelineTimespan.js +++ b/platform/features/timeline/src/capabilities/TimelineTimespan.js @@ -57,8 +57,8 @@ define( // Set the start time associated with this object function setStart(value) { - mutation.mutate(function (model) { - model.start.timestamp = Math.max(value, 0); + mutation.mutate(function (m) { + m.start.timestamp = Math.max(value, 0); }, model.modified); } diff --git a/platform/features/timeline/src/capabilities/UtilizationCapability.js b/platform/features/timeline/src/capabilities/UtilizationCapability.js index 79a803a3ae..2744976615 100644 --- a/platform/features/timeline/src/capabilities/UtilizationCapability.js +++ b/platform/features/timeline/src/capabilities/UtilizationCapability.js @@ -120,13 +120,13 @@ define( } // Look up a specific object's resource utilization - function lookupUtilization(domainObject) { - return domainObject.useCapability('utilization'); + function lookupUtilization(object) { + return object.useCapability('utilization'); } // Look up a specific object's resource utilization keys - function lookupUtilizationResources(domainObject) { - var utilization = domainObject.getCapability('utilization'); + function lookupUtilizationResources(object) { + var utilization = object.getCapability('utilization'); return utilization && utilization.resources(); } diff --git a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js index cd699dc647..c1605a21e9 100644 --- a/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js +++ b/platform/features/timeline/src/controllers/drag/TimelineDragHandler.js @@ -47,19 +47,19 @@ define( } // Get the timespan associated with this domain object - function populateCapabilityMaps(domainObject) { - var id = domainObject.getId(), - timespanPromise = domainObject.useCapability('timespan'); + function populateCapabilityMaps(object) { + var id = object.getId(), + timespanPromise = object.useCapability('timespan'); if (timespanPromise) { timespanPromise.then(function (timespan) { // Cache that timespan timespans[id] = timespan; // And its mutation capability - mutations[id] = domainObject.getCapability('mutation'); + mutations[id] = object.getCapability('mutation'); // Also cache the persistence capability for later - persists[id] = domainObject.getCapability('persistence'); + persists[id] = object.getCapability('persistence'); // And the composition, for bulk moves - compositions[id] = domainObject.getModel().composition || []; + compositions[id] = object.getModel().composition || []; }); } } @@ -199,8 +199,8 @@ define( minStart; // Update start & end, in that order - function updateStartEnd(id) { - var timespan = timespans[id], start, end; + function updateStartEnd(spanId) { + var timespan = timespans[spanId], start, end; if (timespan) { // Get start/end so we don't get fooled by our // own adjustments @@ -210,7 +210,7 @@ define( timespan.setStart(start + delta); timespan.setEnd(end + delta); // Mark as dirty for subsequent persistence - dirty[toId(id)] = true; + dirty[toId(spanId)] = true; } } @@ -228,12 +228,12 @@ define( } // Find the minimum start time - minStart = Object.keys(ids).map(function (id) { + minStart = Object.keys(ids).map(function (spanId) { // Get the start time; default to +Inf if not // found, since this will not survive a min // test if any real timespans are present - return timespans[id] ? - timespans[id].getStart() : + return timespans[spanId] ? + timespans[spanId].getStart() : Number.POSITIVE_INFINITY; }).reduce(function (a, b) { // Reduce with a minimum test diff --git a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js index 0032b8cbe8..2488d57030 100644 --- a/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js +++ b/platform/features/timeline/src/controllers/graph/TimelineGraphPopulator.js @@ -75,11 +75,14 @@ define( // Look up resources for a domain object function lookupResources(swimlane) { - var graphs = swimlane.domainObject.useCapability('graph'); + var graphPromise = + swimlane.domainObject.useCapability('graph'); function getKeys(obj) { return Object.keys(obj); } - return $q.when(graphs ? (graphs.then(getKeys)) : []); + return $q.when( + graphPromise ? (graphPromise.then(getKeys)) : [] + ); } // Add all graph assignments appropriate for this swimlane diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js index ee470edc77..7fa4dc2e9b 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineProxy.js @@ -34,8 +34,8 @@ define( var actionMap = {}; // Populate available Create actions for this domain object - function populateActionMap(domainObject) { - var actionCapability = domainObject.getCapability('action'), + function populateActionMap(object) { + var actionCapability = object.getCapability('action'), actions = actionCapability ? actionCapability.getActions('add') : []; actions.forEach(function (action) { diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js index dd655bcb5e..898ca119ee 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js @@ -45,9 +45,9 @@ define( if (arguments.length > 0 && Array.isArray(value)) { if ((model.relationships || {})[ACTIVITY_RELATIONSHIP] !== value) { // Update the relationships - mutator.mutate(function (model) { - model.relationships = model.relationships || {}; - model.relationships[ACTIVITY_RELATIONSHIP] = value; + mutator.mutate(function (m) { + m.relationships = m.relationships || {}; + m.relationships[ACTIVITY_RELATIONSHIP] = value; }).then(persister.persist); } } @@ -61,8 +61,8 @@ define( if (arguments.length > 0 && (typeof value === 'string') && value !== model.link) { // Update the link - mutator.mutate(function (model) { - model.link = value; + mutator.mutate(function (m) { + m.link = value; }).then(persister.persist); } return model.link; diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js index e655741342..71648995f0 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDropHandler.js @@ -51,7 +51,7 @@ define( } // Check if pathA entirely contains pathB - function pathContains(swimlane, id) { + function pathContains(swimlaneToCheck, id) { // Check if id at a specific index matches (for map below) function matches(pathId) { return pathId === id; @@ -59,18 +59,18 @@ define( // Path A contains Path B if it is longer, and all of // B's ids match the ids in A. - return swimlane.idPath.map(matches).reduce(or, false); + return swimlaneToCheck.idPath.map(matches).reduce(or, false); } // Check if a swimlane contains a child with the specified id - function contains(swimlane, id) { + function contains(swimlaneToCheck, id) { // Check if a child swimlane has a matching domain object id function matches(child) { return child.domainObject.getId() === id; } // Find any one child id that matches this id - return swimlane.children.map(matches).reduce(or, false); + return swimlaneToCheck.children.map(matches).reduce(or, false); } // Initiate mutation of a domain object diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index f7a77fe2df..ccc6148997 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -61,8 +61,8 @@ define( swimlane; // For the recursive step - function populate(childSubgraph, index) { - populateSwimlanes(childSubgraph, swimlane, index); + function populate(childSubgraph, nextIndex) { + populateSwimlanes(childSubgraph, swimlane, nextIndex); } // Make sure we have a valid object instance... diff --git a/platform/features/timeline/src/services/ObjectLoader.js b/platform/features/timeline/src/services/ObjectLoader.js index 377709592f..ec4d7b15c8 100644 --- a/platform/features/timeline/src/services/ObjectLoader.js +++ b/platform/features/timeline/src/services/ObjectLoader.js @@ -41,13 +41,13 @@ define( filter; // Check object existence (for criterion-less filtering) - function exists(domainObject) { - return !!domainObject; + function exists(object) { + return !!object; } // Check for capability matching criterion - function hasCapability(domainObject) { - return domainObject && domainObject.hasCapability(criterion); + function hasCapability(object) { + return object && object.hasCapability(criterion); } // For the recursive step... @@ -61,8 +61,8 @@ define( } // Avoid infinite recursion - function notVisiting(domainObject) { - return !visiting[domainObject.getId()]; + function notVisiting(object) { + return !visiting[object.getId()]; } // Put the composition of this domain object into the result diff --git a/platform/features/timeline/test/actions/TimelineTraverserSpec.js b/platform/features/timeline/test/actions/TimelineTraverserSpec.js index 48fb584162..e6000c6c62 100644 --- a/platform/features/timeline/test/actions/TimelineTraverserSpec.js +++ b/platform/features/timeline/test/actions/TimelineTraverserSpec.js @@ -55,8 +55,8 @@ define([ if (!!model.composition) { mockDomainObject.useCapability.andCallFake(function (c) { return c === 'composition' && - Promise.resolve(model.composition.map(function (id) { - return mockDomainObjects[id]; + Promise.resolve(model.composition.map(function (cid) { + return mockDomainObjects[cid]; })); }); } @@ -68,8 +68,8 @@ define([ ); mockRelationships.getRelatedObjects.andCallFake(function (k) { var ids = model.relationships[k] || []; - return Promise.resolve(ids.map(function (id) { - return mockDomainObjects[id]; + return Promise.resolve(ids.map(function (objId) { + return mockDomainObjects[objId]; })); }); mockDomainObject.getCapability.andCallFake(function (c) { diff --git a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js index 3899ce8120..0c37f3edae 100644 --- a/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js +++ b/platform/features/timeline/test/capabilities/UtilizationCapabilitySpec.js @@ -69,8 +69,8 @@ define( resources: function () { return Object.keys(costs).sort(); }, - cost: function (c) { - return costs[c]; + cost: function (k) { + return costs[k]; } }); }, diff --git a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js index 502d2e7642..1e62983437 100644 --- a/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js +++ b/platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js @@ -56,22 +56,22 @@ define( } function makeMockDomainObject(id, composition) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, ['getId', 'getModel', 'getCapability', 'useCapability'] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn({ composition: composition }); - mockDomainObject.useCapability.andReturn(asPromise(mockTimespans[id])); - mockDomainObject.getCapability.andCallFake(function (c) { + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn({ composition: composition }); + mockDomainObj.useCapability.andReturn(asPromise(mockTimespans[id])); + mockDomainObj.getCapability.andCallFake(function (c) { return { persistence: mockPersists[id], mutation: mockMutations[id] }[c]; }); - return mockDomainObject; + return mockDomainObj; } beforeEach(function () { diff --git a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js index 4fd374a412..f9358a514e 100644 --- a/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js +++ b/platform/features/timeline/test/controllers/swimlane/TimelineSwimlanePopulatorSpec.js @@ -42,16 +42,16 @@ define( } function makeMockDomainObject(id, composition) { - var mockDomainObject = jasmine.createSpyObj( + var mockDomainObj = jasmine.createSpyObj( 'domainObject-' + id, ['getId', 'getModel', 'getCapability', 'useCapability'] ); - mockDomainObject.getId.andReturn(id); - mockDomainObject.getModel.andReturn({ composition: composition }); - mockDomainObject.useCapability.andReturn(asPromise(false)); + mockDomainObj.getId.andReturn(id); + mockDomainObj.getModel.andReturn({ composition: composition }); + mockDomainObj.useCapability.andReturn(asPromise(false)); - return mockDomainObject; + return mockDomainObj; } function subgraph(domainObject, objects) { diff --git a/platform/framework/src/register/ExtensionRegistrar.js b/platform/framework/src/register/ExtensionRegistrar.js index 0dcd86ea4c..7b5ef7e096 100644 --- a/platform/framework/src/register/ExtensionRegistrar.js +++ b/platform/framework/src/register/ExtensionRegistrar.js @@ -164,15 +164,15 @@ define( // Examine a group of resolved dependencies to determine // which extension categories still need to be satisfied. - function findEmptyExtensionDependencies(extensionGroup) { + function findEmptyExtensionDependencies(extGroup) { var needed = {}, - categories = Object.keys(extensionGroup), + categories = Object.keys(extGroup), allExtensions = []; // Build up an array of all extensions categories.forEach(function (category) { allExtensions = - allExtensions.concat(extensionGroup[category]); + allExtensions.concat(extGroup[category]); }); // Track all extension dependencies exposed therefrom @@ -197,10 +197,9 @@ define( // Register any extension categories that are depended-upon but // have not been declared anywhere; such dependencies are then // satisfied by an empty array, instead of not at all. - function registerEmptyDependencies(extensionGroup) { - findEmptyExtensionDependencies( - extensionGroup - ).forEach(function (name) { + function registerEmptyDependencies(extGroup) { + findEmptyExtensionDependencies(extGroup) + .forEach(function (name) { $log.info("Registering empty extension category " + name); app.factory(name, [staticFunction([])]); }); diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index bac334a4a0..1abcd91a91 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -58,11 +58,11 @@ define( var loader = this.loader, $log = this.$log; - function loadImplementation(extension) { - var implPromise = extension.hasImplementationValue() ? - Promise.resolve(extension.getImplementationValue()) : - loader.load(extension.getImplementationPath()), - definition = extension.getDefinition(); + function loadImplementation(ext) { + var implPromise = ext.hasImplementationValue() ? + Promise.resolve(ext.getImplementationValue()) : + loader.load(ext.getImplementationPath()), + definition = ext.getDefinition(); // Wrap a constructor function (to avoid modifying the original) function constructorFor(impl) { @@ -94,7 +94,7 @@ define( result.definition = definition; // Log that this load was successful - $log.info("Resolved " + extension.getLogName()); + $log.info("Resolved " + ext.getLogName()); return result; } @@ -105,7 +105,7 @@ define( // Build up a log message from parts var message = [ "Could not load implementation for extension ", - extension.getLogName(), + ext.getLogName(), " due to ", err.message ].join(""); @@ -113,16 +113,16 @@ define( // Log that the extension was not loaded $log.warn(message); - return extension.getDefinition(); + return ext.getDefinition(); } - if (!extension.hasImplementationValue()) { + if (!ext.hasImplementationValue()) { // Log that loading has begun $log.info([ "Loading implementation ", - extension.getImplementationPath(), + ext.getImplementationPath(), " for extension ", - extension.getLogName() + ext.getLogName() ].join("")); } diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index 1b421b527f..2fe826bb49 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -92,8 +92,8 @@ define( if ((response || {}).status === CONFLICT) { error.key = "revision"; // Load the updated model, then reject the promise - return this.get(key).then(function (response) { - error.model = response[SRC]; + return this.get(key).then(function (res) { + error.model = res[SRC]; return $q.reject(error); }); } diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index c449ed5f7b..447519633c 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -68,7 +68,7 @@ define( } // Retry persistence (overwrite) for this set of failed attempts - function retry(failures) { + function retry(failuresToRetry) { var models = {}; // Cache a copy of the model @@ -92,17 +92,17 @@ define( } // Cache the object models we might want to save - failures.forEach(cacheModel); + failuresToRetry.forEach(cacheModel); // Strategy here: // * Cache all of the models we might want to save (above) // * Refresh all domain objects (so they are latest versions) // * Re-insert the cached domain object models // * Invoke persistence again - return $q.all(failures.map(refresh)).then(function () { - return $q.all(failures.map(remutate)); + return $q.all(failuresToRetry.map(refresh)).then(function () { + return $q.all(failuresToRetry.map(remutate)); }).then(function () { - return $q.all(failures.map(persist)); + return $q.all(failuresToRetry.map(persist)); }); } @@ -114,8 +114,8 @@ define( } // Discard changes associated with a failed save - function discardAll(failures) { - return $q.all(failures.map(discard)); + function discardAll(failuresToDiscard) { + return $q.all(failuresToDiscard.map(discard)); } // Handle user input (did they choose to overwrite?) diff --git a/platform/persistence/queue/src/PersistenceQueueHandler.js b/platform/persistence/queue/src/PersistenceQueueHandler.js index 3a394a1e54..511685b350 100644 --- a/platform/persistence/queue/src/PersistenceQueueHandler.js +++ b/platform/persistence/queue/src/PersistenceQueueHandler.js @@ -57,20 +57,20 @@ define( failureHandler = this.failureHandler; // Handle a group of persistence invocations - function persistGroup(ids, persistences, domainObjects, queue) { + function persistGroup(groupIds, persistenceCaps, domainObjs, pQueue) { var failures = []; // Try to persist a specific domain object function tryPersist(id) { // Look up its persistence capability from the provided // id->persistence object. - var persistence = persistences[id], - domainObject = domainObjects[id]; + var persistence = persistenceCaps[id], + domainObject = domainObjs[id]; // Put a domain object back in the queue // (e.g. after Overwrite) function requeue() { - return queue.put(domainObject, persistence); + return pQueue.put(domainObject, persistence); } // Handle success @@ -103,7 +103,7 @@ define( } // Try to persist everything, then handle any failures - return $q.all(ids.map(tryPersist)).then(handleFailure); + return $q.all(groupIds.map(tryPersist)).then(handleFailure); } return persistGroup(ids, persistences, domainObjects, queue); diff --git a/platform/representation/src/TemplateLinker.js b/platform/representation/src/TemplateLinker.js index 8637819d63..e248ebd1de 100644 --- a/platform/representation/src/TemplateLinker.js +++ b/platform/representation/src/TemplateLinker.js @@ -154,12 +154,12 @@ define( activeTemplateUrl = templateUrl; } - function changeTemplate(ext) { - ext = ext || {}; - if (ext.templateUrl) { - changeTemplateUrl(self.getPath(ext)); - } else if (ext.template) { - showTemplate(ext.template); + function changeTemplate(templateExt) { + templateExt = templateExt || {}; + if (templateExt.templateUrl) { + changeTemplateUrl(self.getPath(templateExt)); + } else if (templateExt.template) { + showTemplate(templateExt.template); } else { removeElement(); } diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 101c718669..b610bb022d 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -178,8 +178,8 @@ define([ }); if (Array.isArray(model.composition)) { - model.composition.forEach(function (id) { - provider.scheduleForIndexing(id); + model.composition.forEach(function (idToIndex) { + provider.scheduleForIndexing(idToIndex); }); } }; diff --git a/platform/telemetry/src/TelemetryQueue.js b/platform/telemetry/src/TelemetryQueue.js index 3017906802..dadb34d3df 100644 --- a/platform/telemetry/src/TelemetryQueue.js +++ b/platform/telemetry/src/TelemetryQueue.js @@ -93,11 +93,11 @@ define( // Look up an object in the queue that does not have a value // assigned to this key (or, add a new one) - function getFreeObject(key) { - var index = counts[key] || 0, object; + function getFreeObject(k) { + var index = counts[k] || 0, object; // Track the largest free position for this key - counts[key] = index + 1; + counts[k] = index + 1; // If it's before the end of the queue, add it there if (index < queue.length) { diff --git a/platform/telemetry/src/TelemetrySubscription.js b/platform/telemetry/src/TelemetrySubscription.js index 0334c29455..7cf524b184 100644 --- a/platform/telemetry/src/TelemetrySubscription.js +++ b/platform/telemetry/src/TelemetrySubscription.js @@ -84,8 +84,8 @@ define( // Look up domain objects which have telemetry capabilities. // This will either be the object in view, or object that // this object delegates its telemetry capability to. - function promiseRelevantObjects(domainObject) { - return delegator.promiseTelemetryObjects(domainObject); + function promiseRelevantObjects(domainObj) { + return delegator.promiseTelemetryObjects(domainObj); } function updateValuesFromPool() { @@ -114,16 +114,16 @@ define( // Look up metadata associated with an object's telemetry - function lookupMetadata(domainObject) { + function lookupMetadata(domainObj) { var telemetryCapability = - domainObject.getCapability("telemetry"); + domainObj.getCapability("telemetry"); return telemetryCapability && telemetryCapability.getMetadata(); } // Update the latest telemetry data for a specific // domain object. This will notify listeners. - function update(domainObject, series) { + function update(domainObj, series) { var count = series && series.getPointCount(); // Only schedule notification if there isn't already @@ -136,21 +136,21 @@ define( // Update the latest-value table if (count > 0) { - pool.put(domainObject.getId(), { + pool.put(domainObj.getId(), { domain: series.getDomainValue(count - 1), range: series.getRangeValue(count - 1), - datum: self.makeDatum(domainObject, series, count - 1) + datum: self.makeDatum(domainObj, series, count - 1) }); } } // Prepare a subscription to a specific telemetry-providing // domain object. - function subscribe(domainObject) { + function subscribe(domainObj) { var telemetryCapability = - domainObject.getCapability("telemetry"); + domainObj.getCapability("telemetry"); return telemetryCapability.subscribe(function (telemetry) { - update(domainObject, telemetry); + update(domainObj, telemetry); }); } diff --git a/platform/telemetry/test/TelemetryAggregatorSpec.js b/platform/telemetry/test/TelemetryAggregatorSpec.js index b99901a307..39ac5a9c9a 100644 --- a/platform/telemetry/test/TelemetryAggregatorSpec.js +++ b/platform/telemetry/test/TelemetryAggregatorSpec.js @@ -38,7 +38,7 @@ define( }; } - function mockProvider(key, index) { + function makeMockProvider(key, index) { var provider = jasmine.createSpyObj( "provider" + index, ["requestTelemetry", "subscribe"] @@ -57,7 +57,7 @@ define( mockQ.all.andReturn(mockPromise([])); mockUnsubscribes = []; - mockProviders = ["a", "b", "c"].map(mockProvider); + mockProviders = ["a", "b", "c"].map(makeMockProvider); aggregator = new TelemetryAggregator(mockQ, mockProviders); });