Apigee code review tool / Plugin

Not applicable

Is there any custom Apigee code review (static code analysis) tool / Plugins available for reviewing Apigee proxy / policies ?

Similar to the ones we have in Java world.

Thanks,

Swapnil

Solved Solved
2 8 3,628
2 ACCEPTED SOLUTIONS

I'm using https://github.com/apigee/apigeelint 

 

Static code analysis for Apigee proxy and sharedflow bundles to encourage API developers to use best practices and avoid anti-patterns.

This utility is intended to capture the best practices knowledge from across Apigee including our Global Support Center team, Customer Success, Engineering, and our product team in a tool that will help developers create more scalable, performant, and stable API bundles using the Apigee DSL.

View solution in original post

8 REPLIES 8

Not applicable

@Swapnil Raverkar I assume you are talking about code review of Apigee Proxy Code and possibly Java Code used in Callouts etc? It looks like there are multiple questions in there really. Static Code Analysis could be done using tools like Checkmarx, but that would be more from a security standpoint, but if you really want to put a process in place for a CI like system then you should think of using something like https://code.google.com/p/gerrit/ that will force a team of greater than 1 to get into the hygiene or discipline of code reviews and it just makes it more natural and harder to check in code without a peer review, hope this helps. and hope you are doing well!

Hi Kris,

Thanks for the information, i am doing good. Basically we are looking for a customized code review / static code analysis tool for Apigee XMLs (Proxy & policies) in terms of naming conventions / nomenclatures to begin with which can be configurable. This is to ensure that our teams follow a coding standard across the organization for Apigee proxies.

For Java callouts, yes we can definitely use the available tools & plugins.

Thanks,

Swapnil

Not applicable

Currently the simple answer is no, but I think it is a great suggestion. Now for the not so simple answer.. For the non-xml code I have been known to use plugins like PMD for the java callouts and jslint for javascript

e.g.

<plugin>
	<groupId>com.cj.jshintmojo</groupId>
	<artifactId>jshint-maven-plugin</artifactId>
	<version>1.6.0</version>
	<executions>
		<execution>
			<id>jslint</id>
			<phase>package</phase>
			<goals>
					<goal>lint</goal>
			</goals>
		</execution>
	</executions>
	<configuration>  
		<directories>
			<directory>apiproxy/resources/jsc</directory>
			<directory>node</directory>
		</directories>
		<excludes>
			<exclude>node/node_modules</exclude>
		</excludes>
		<reporter>html</reporter>
			<reportFile>lintReport.html</reportFile>
	</configuration>
</plugin>

Hope this helps

Not applicable

I keep a wish list of things I want to get to... An Apigee Bundle Linter is on that list. Someday I may get to that!

Not applicable

Hi @Swapnil Raverkar, for JavaScript Policies or Node.js code you can leverage JSLint, JSHint, ESLint. I have setup Apigee Grunt to leverage these Plugins:

jshint: {
  options: { //see options reference http://www.jshint.com/docs/options/
  	curly: true,
  	eqeqeq: true,
  	eqnull: true,
  	browser: true,
  	asi : true,
  	debug : true,
  	undef : true,
  	unused : true,
  	maxcomplexity : 5,
  	reporter: require('jshint-stylish')
  },
  all: ['Gruntfile.js', 'apiproxy/**/*.js', 'tests/**/*.js', 'tasks/*.js']
},
eslint: {                               // task
	options: {
        config: 'grunt/conf/eslint.json',     // custom config
        rulesdir: ['grunt/conf/rules']        // custom rules
    },
    target: ['Gruntfile.js', 'target/apiproxy/**/*.js', 'tests/**/*.js', 'tasks/*.js']                 // array of files
},

You can find a full example of this here: https://github.com/apigeecs/apigee-deploy-grunt-plugin/blob/master/Gruntfile.js#L112-L131

For XML policies and flows. I haven't seen one though.

I'm using https://github.com/apigee/apigeelint 

 

Static code analysis for Apigee proxy and sharedflow bundles to encourage API developers to use best practices and avoid anti-patterns.

This utility is intended to capture the best practices knowledge from across Apigee including our Global Support Center team, Customer Success, Engineering, and our product team in a tool that will help developers create more scalable, performant, and stable API bundles using the Apigee DSL.

As one of the original contributors to ApigeeLint I strong encourage participation in the community. Plugins are relatively straightforward to create and we would all benefit from your expertise!