Over a million developers have joined DZone.

How to enforce coding guide lines using CFML Code Formatter

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

It’s common when working in a team to have specific coding standards or coding style. What’s difficult is to adhere to these coding standards and to enforce these within a team. CFML code formatter in ColdFusion Builder 2 is just the right tool to help you do this. Using the highly customizable code formatter preferences and export/Import functionality, you can easily create rules for specific coding style and share them across team.

CFML Code formatter – a small intro

CFML Code formatter supports formatting of CFML code along with support to format mixed code within CFML (code with html, java script and CSS in a CFML file). Also Code formatter can be customized to suit your coding style. It comes with lots of options to control how code gets formatted. If you are not aware of how to customize Code formatter, you can do this by navigating to Windows->Preferences->ColdFusion->profile->editor->Formatter page.

Code Formatter Preference Page

 

 

Creating New Formatting Profile

Customized Code Formatter preferences are saved in profiles. Formatting profile is nothing more than a set of rules. Code formatter formats code based on these rules. This allows you to easily save different coding styles as profiles. Creating a new profile is easy. Click on Add button on Code formatter preference page to open up Formatting preference dialog. Make changes as per your requirement and save these as new profile. While making changes to preferences you can see the effect of your changes in preview section.

Code Formatter Preference Dialog

Code Formatter Preference Dialog

 

How Do I share the profile I created?

Once you have created your own formatting profile you can export is to xml files using export functionality on Code formatter preference page.

You can share this exported profile within your team. Using the import functionality others can import this formatting profile and use it to format code. This makes it possible for everyone to use same code formatter preferences and adhere to accepted coding style.

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of sandeep , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}