apigee / apigeelint

Static code analysis for Apigee proxy bundles to encourage API developers to use best practices and avoid anti-patterns.
Apache License 2.0
91 stars 71 forks source link

BUG: External plugins not being run since v2.44.0 #409

Closed gislikonrad closed 7 months ago

gislikonrad commented 8 months ago

When attempting to run external plugins, they aren't being loaded since v2.44.0. v2.43.0 works fine.

gislikonrad commented 8 months ago

Doing some research, I found out that the external plugins are being run, but the message isn't being reported because an exception is being thrown. This is caused by fcda555, where the if statements in Bundle.prototype.addMessage were changed from msg.entity.hasOwnProperty("getElement") to typeof msg.entity.getElement == 'function'. That change causes the getElement function to actually be invoked, since the function wasn't strictly on the entity, but it was on the prototype.

Now, sometimes when linting a bundle, the name of the bundle gets set to "undefined", which ends up being turned into a bundle path of <path>/undefined. When the getEntity method is being invoked, it attempts to read the file from this undefined path and throws an exception when it's not able to, and the message isn't added to the results.

gislikonrad commented 8 months ago

The cases where a plugin name is set to "undefined" is when it's a new proxy/sharedflow and doesn't have the xml in the root of the apiproxy/sharedflow.

ssvaidyanathan commented 7 months ago

Can you please test with v2.47.0