Skip to content

Latest commit

 

History

History
1382 lines (923 loc) · 21.8 KB

File metadata and controls

1382 lines (923 loc) · 21.8 KB

Settings Reference

alignment.consecutive.assignments

Type: boolean

Default: false

When true, cfformat will attempt to align consecutive variable assignments, named function call arguments, and struct key value pairs.

// alignment.consecutive.assignments: true
var a  = 1;
var ab = 2;

// alignment.consecutive.assignments: false
var a = 1;
var ab = 2;

alignment.consecutive.params

Type: boolean

Default: false

When true, cfformat will attempt to align the attributes of consecutive params.

// alignment.consecutive.params: true
param name="a"       type="string";
param name="abcdefg" type="string";

// alignment.consecutive.params: false
param name="a" type="string";
param name="abcdefg" type="string";

alignment.consecutive.properties

Type: boolean

Default: false

When true, cfformat will attempt to align the attributes of consecutive properties.

// alignment.consecutive.properties: true
property name="requestService" inject="coldbox:requestService";
property name="log"            inject="logbox:logger:{this}";

// alignment.consecutive.properties: false
property name="requestService" inject="coldbox:requestService";
property name="log" inject="logbox:logger:{this}";

alignment.doc_comments

Type: boolean

Default: false

When true, cfformat will attempt to align the @param descriptions and @throws descriptions in doc comments.

// alignment.doc_comments: true
/**
 * @name test
 * @b    another param
 */

// alignment.doc_comments: false
/**
 * @name test
 * @b another param
 */

array.empty_padding

Type: boolean

Default: false

When true, empty arrays are padded with a space.

// array.empty_padding: true
myArray = [ ];

// array.empty_padding: false
myArray = [];

array.multiline.comma_dangle

Type: boolean

Default: false

Whether to use a dangling comma after the last array element when an array is printed on multiple lines.

// array.multiline.comma_dangle: true
myArray = [
    1,
    2,
    3,
    4,
];

// array.multiline.comma_dangle: false
myArray = [
    1,
    2,
    3,
    4
];

array.multiline.element_count

Type: integer

Default: 4

When an array has this number of elements or more, print it onto multiple lines.

array.multiline.leading_comma

Type: boolean

Default: false

Whether to use a leading comma when an array is printed on multiple lines.

// array.multiline.leading_comma: true
myArray = [
      1
    , 2
    , 3
    , 4
];

// array.multiline.leading_comma: false
myArray = [
    1,
    2,
    3,
    4
];

array.multiline.leading_comma.padding

Type: boolean

Default: true

Whether to insert a space after leading commas when an array is printed on multiple lines.

// array.multiline.leading_comma.padding: true
myArray = [
      1
    , 2
    , 3
    , 4
];

// array.multiline.leading_comma.padding: false
myArray = [
     1
    ,2
    ,3
    ,4
];

array.multiline.min_length

Type: integer

Default: 40

No matter how many elements an array has, if it is shorter than this length, keep it on one line.

array.padding

Type: boolean

Default: false

When true, non-empty arrays are padded with spaces.

// array.padding: true
myArray = [ 1, 2 ];

// array.padding: false
myArray = [1, 2];

binary_operators.newline_indent

Type: boolean

Default: false

Whether to indent the line when a binary operator is preceded by a newline, and to indent the following line when a binary operator is followed by a newline.

// binary_operators.newline_indent: true
a = b &&
    c;

a = b
    && c;

// binary_operators.newline_indent: false
a = b &&
c;

a = b
&& c;

binary_operators.padding

Type: boolean

Default: true

Whether to pad binary operators with spaces.

// binary_operators.padding: true
a = 1 + 2;

// binary_operators.padding: false
a=1+2;

brackets.padding

Type: boolean

Default: false

When true, bracketed accessors are padded with spaces.

// brackets.padding: true
a[ 'mykey' ][ 1 ] = 7;

// brackets.padding: false
a['mykey'][1] = 7;

comment.asterisks

Type: string

Values: ["align", "indent", "ignored"]

When enabled, if every line after the first of a block comment starts with a *, they will be aligned. Setting this to "ignored" means no alignment will be done.

// comment.asterisks: "align"
{
    /**
     * a comment
     */
}

// comment.asterisks: "indent"
{
    /**
    * a comment
    */
}

// comment.asterisks: "ignored"
{
    /**
      * a comment
    */
}

for_loop_semicolons.padding

Type: boolean

Default: true

When true, insert a space after for loop semicolons.

// for_loop_semicolons.padding: true
for (var i = 0; i < 10; i++) {
}

// for_loop_semicolons.padding: false
for (var i = 0;i < 10;i++) {
}

function_anonymous.empty_padding

Type: boolean

Default: false

When true, pad anonymous function declarations that have no parameters with a space.

// function_anonymous.empty_padding: true
function( ) {
}

// function_anonymous.empty_padding: false
function() {
}

function_anonymous.group_to_block_spacing

Type: string

Values: ["spaced", "compact", "newline"]

How to space from the anonymous function parameters to the function block.

// function_anonymous.group_to_block_spacing: "spaced"
function() {
}

// function_anonymous.group_to_block_spacing: "compact"
function(){
}

// function_anonymous.group_to_block_spacing: "newline"
function()
{
}

function_anonymous.multiline.comma_dangle

Type: boolean

Default: false

Whether to use a dangling comma after the last anonymous function parameter when the parameters are printed on multiple lines.

// function_anonymous.multiline.comma_dangle: true
function(
    a,
    b,
    c,
    d,
) {
};

// function_anonymous.multiline.comma_dangle: false
function(
    a,
    b,
    c,
    d
) {
};

function_anonymous.multiline.element_count

Type: integer

Default: 4

When an anonymous function declaration has this number of parameters, split them onto multiple lines.

function_anonymous.multiline.leading_comma

Type: boolean

Default: false

Whether to use a leading comma when anonymous function declaration parameters are printed on multiple lines.

// function_anonymous.multiline.leading_comma: true
function(
      a
    , b
    , c
    , d
) {
}

// function_anonymous.multiline.leading_comma: false
function(
    a,
    b,
    c,
    d
) {
}

function_anonymous.multiline.leading_comma.padding

Type: boolean

Default: true

Whether to insert a space after leading commas when anonymous function declaration parameters are printed on multiple lines.

// function_anonymous.multiline.leading_comma.padding: true
function(
      a
    , b
    , c
    , d
) {
}

// function_anonymous.multiline.leading_comma.padding: false
function(
     a
    ,b
    ,c
    ,d
) {
}

function_anonymous.multiline.min_length

Type: integer

Default: 40

No matter how many parameters an anonymous function declaration has, if they can be printed in this many columns or less, keep them on one line.

function_anonymous.padding

Type: boolean

Default: false

Whether to pad non-empty anonymous function declarations with spaces.

// function_anonymous.padding: true
function( a, b ) {
}

// function_anonymous.padding: false
function(a, b) {
}

function_anonymous.spacing_to_group

Type: boolean

Default: false

Whether to space a function keyword from following group.

// function_anonymous.spacing_to_group: true
function () {
}

// function_anonymous.spacing_to_group: false
function() {
}

function_call.casing.builtin

Type: string

Values: ["cfdocs", "pascal", "ignored"]

Formats builtin function call casing. The default is to match cfdocs.org data. An alternative is to always capitalize the first letter (pascal). Set this setting to "ignored" to leave casing as is.

// function_call.casing.builtin: "cfdocs"
arrayAppend(myarray, 1);

// function_call.casing.builtin: "pascal"
ArrayAppend(myarray, 1);

// function_call.casing.builtin: "ignored"
ARRAYAPPEND(myarray, 1);

function_call.casing.userdefined

Type: string

Values: ["ignored", "camel", "pascal"]

Formats user defined function call casing. The default is to leave as is (this is set to "ignored"). Alternatives are to always capitalize the first letter (pascal), or always lower case it (camel).

// function_call.casing.userdefined: "ignored"
myFunc();

// function_call.casing.userdefined: "camel"
myFunc();

// function_call.casing.userdefined: "pascal"
MyFunc();

function_call.empty_padding

Type: boolean

Default: false

When true, function calls with no arguments are padded with a space.

// function_call.empty_padding: true
myFunc( );

// function_call.empty_padding: false
myFunc();

function_call.multiline.comma_dangle

Type: boolean

Default: false

Whether to use a dangling comma after the last function call argument when the arguments are printed on multiple lines.

// function_call.multiline.comma_dangle: true
test(
    1,
    2,
    3,
    4,
);

// function_call.multiline.comma_dangle: false
test(
    1,
    2,
    3,
    4
);

function_call.multiline.element_count

Type: integer

Default: 4

When a function call has this number of arguments, split them onto multiple lines.

function_call.multiline.leading_comma

Type: boolean

Default: false

Whether to use a leading comma when function call arguments are printed on multiple lines.

// function_call.multiline.leading_comma: true
myFunc(
      1
    , 2
    , 3
    , 4
);

// function_call.multiline.leading_comma: false
myFunc(
    1,
    2,
    3,
    4
);

function_call.multiline.leading_comma.padding

Type: boolean

Default: true

Whether to insert a space after leading commas when function call arguments are printed on multiple lines.

// function_call.multiline.leading_comma.padding: true
myFunc(
      1
    , 2
    , 3
    , 4
);

// function_call.multiline.leading_comma.padding: false
myFunc(
     1
    ,2
    ,3
    ,4
);

function_call.multiline.min_length

Type: integer

Default: 40

No matter how many arguments a function call has, if they can be printed inline in this many columns or less, keep them on one line.

function_call.padding

Type: boolean

Default: false

Whether to pad function call arguments with spaces.

// function_call.padding: true
myFunc( 1, 2 );

// function_call.padding: false
myFunc(1, 2);

function_declaration.empty_padding

Type: boolean

Default: false

When true, pad function declarations that have no parameters with a space.

// function_declaration.empty_padding: true
function example( ) {
}

// function_declaration.empty_padding: false
function example() {
}

function_declaration.group_to_block_spacing

Type: string

Values: ["spaced", "compact", "newline"]

How to space from the function parameters to the function block.

// function_declaration.group_to_block_spacing: "spaced"
function example() {
}

// function_declaration.group_to_block_spacing: "compact"
function example(){
}

// function_declaration.group_to_block_spacing: "newline"
function example()
{
}

function_declaration.multiline.comma_dangle

Type: boolean

Default: false

Whether to use a dangling comma after the last function parameter when the parameters are printed on multiple lines.

// function_declaration.multiline.comma_dangle: true
function test(
    a,
    b,
    c,
    d,
) {
};

// function_declaration.multiline.comma_dangle: false
function test(
    a,
    b,
    c,
    d
) {
};

function_declaration.multiline.element_count

Type: integer

Default: 4

When a function declaration has this number of parameters, split them onto multiple lines.

function_declaration.multiline.leading_comma

Type: boolean

Default: false

Whether to use a leading comma when function declaration parameters are printed on multiple lines.

// function_declaration.multiline.leading_comma: true
function example(
      a
    , b
    , c
    , d
) {
}

// function_declaration.multiline.leading_comma: false
function example(
    a,
    b,
    c,
    d
) {
}

function_declaration.multiline.leading_comma.padding

Type: boolean

Default: true

Whether to insert a space after leading commas when function declaration parameters are printed on multiple lines.

// function_declaration.multiline.leading_comma.padding: true
function example(
      a
    , b
    , c
    , d
) {
}

// function_declaration.multiline.leading_comma.padding: false
function example(
     a
    ,b
    ,c
    ,d
) {
}

function_declaration.multiline.min_length

Type: integer

Default: 40

No matter how many parameters a function declaration has, if they can be printed in this many columns or less, keep them on one line.

function_declaration.padding

Type: boolean

Default: false

Whether to pad non-empty function declarations with spaces.

// function_declaration.padding: true
function example( a, b ) {
}

// function_declaration.padding: false
function example(a, b) {
}

function_declaration.spacing_to_group

Type: boolean

Default: false

Whether to space a function name from following group.

// function_declaration.spacing_to_group: true
function example () {
}

// function_declaration.spacing_to_group: false
function example() {
}

indent_size

Type: integer

Default: 4

Each indent level or tab is equivalent to this many spaces.

// indent_size: 4
do {
    myFunc();
}

// indent_size: 2
do {
  myFunc();
}

keywords.block_to_keyword_spacing

Type: string

Values: ["spaced", "compact", "newline"]

Spacing for keywords following a block.

// keywords.block_to_keyword_spacing: "spaced"
if (true) {
} else {
}

// keywords.block_to_keyword_spacing: "compact"
if (true) {
}else {
}

// keywords.block_to_keyword_spacing: "newline"
if (true) {
}
else {
}

keywords.empty_group_spacing

Type: boolean

Default: false

Whether to pad empty keyword groups.

// keywords.empty_group_spacing: true
if ( ) {
}

// keywords.empty_group_spacing: false
if () {
}

keywords.group_to_block_spacing

Type: string

Values: ["spaced", "compact", "newline"]

Spacing from a keyword group to the following block.

// keywords.group_to_block_spacing: "spaced"
if (true) {
}

// keywords.group_to_block_spacing: "compact"
if (true){
}

// keywords.group_to_block_spacing: "newline"
if (true)
{
}

keywords.padding_inside_group

Type: boolean

Default: false

Whether to pad inside non-empty keyword groups.

// keywords.padding_inside_group: true
if ( true ) {
}

// keywords.padding_inside_group: false
if (true) {
}

keywords.spacing_to_block

Type: string

Values: ["spaced", "compact", "newline"]

Spacing from a keyword to the following block.

// keywords.spacing_to_block: "spaced"
do {
}

// keywords.spacing_to_block: "compact"
do{
}

// keywords.spacing_to_block: "newline"
do
{
}

keywords.spacing_to_group

Type: boolean

Default: true

Whether to space a keyword from following group.

// keywords.spacing_to_group: true
if (true) {
}

// keywords.spacing_to_group: false
if(true) {
}

max_columns

Type: integer

Default: 120

When rendering a delimited item (struct, array, function call, function declaration parameters), this is the maximum number of columns to render on one line before splitting the elements onto multiple lines.

metadata.key_value.padding

Type: boolean

Default: false

Whether to pad the key value separator when printing metadata attributes for a component or function declaration.

// metadata.key_value.padding: true
component extends = "base.component" output = false {


}

// metadata.key_value.padding: false
component extends="base.component" output=false {


}

metadata.multiline.element_count

Type: integer

Default: 4

When a component or function declaration has this number of metadata attributes or more, print it onto multiple lines.

metadata.multiline.min_length

Type: integer

Default: 40

No matter how many metadata attributes a component or function declaration has, if it is shorter than this length, keep it on one line.

method_call.chain.multiline

Type: integer

Default: 3

When a method call chain has this many method calls, always split them onto multiple lines.

newline

Type: string

Values: ["os", "\n", "\r\n"]

The new line character(s) to use. The default is "os" which uses \r\n on Windows, and \n otherwise.

param.key_value.padding

Type: boolean

Default: false

Whether to pad the key value separator when printing param attributes.

// param.key_value.padding: true
param name = "abc";

// param.key_value.padding: false
param name="abc";

param.multiline.element_count

Type: integer

Default: 4

When a param has this number of attributes or more, print it onto multiple lines.

param.multiline.min_length

Type: integer

Default: 40

No matter how many attributes a param has, if it is shorter than this length, keep it on one line.

parentheses.padding

Type: boolean

Default: false

Whether to pad the contents of a group.

// parentheses.padding: true
a = ( 1 + 2 );

// parentheses.padding: false
a = (1 + 2);

property.key_value.padding

Type: boolean

Default: false

Whether to pad the key value separator when printing property attributes.

// property.key_value.padding: true
property name = "test";

// property.key_value.padding: false
property name="test";

property.multiline.element_count

Type: integer

Default: 4

When a property has this number of attributes or more, print it onto multiple lines.

property.multiline.min_length

Type: integer

Default: 40

No matter how many attributes a property has, if it is shorter than this length, keep it on one line.

strings.attributes.quote

Type: string

Values: ["single", "double", "ignored"]

Whether to use a single or double quote for attribute values. If set to "ignored", leaves attribute value quotes as they are found.

// strings.attributes.quote: "single"
http url='www.google.com';
param name='key';

// strings.attributes.quote: "double"
http url="www.google.com";
param name="key";

// strings.attributes.quote: "ignored"
http url='www.google.com';
param name="key";

strings.convertNestedQuotes

Type: boolean

Default: true

Whether to convert the quote character for strings that contain quotes within them.

// strings.convertNestedQuotes: true
a = '''';

// strings.convertNestedQuotes: false
a = "'";

strings.quote

Type: string

Values: ["single", "double", "ignored"]

Whether to use a single or double quote for strings. If set to "ignored", leaves string quotes as they are found.

// strings.quote: "single"
a = 'One';
b = 'Two';

// strings.quote: "double"
a = "One";
b = "Two";

// strings.quote: "ignored"
a = "One";
b = 'Two';

struct.empty_padding

Type: boolean

Default: false

When true, non-empty structs are padded with spaces.

// struct.empty_padding: true
myStruct = { };

// struct.empty_padding: false
myStruct = {};

struct.multiline.comma_dangle

Type: boolean

Default: false

Whether to use a dangling comma after the last struct element when an struct is printed on multiple lines.

// struct.multiline.comma_dangle: true
myStruct = {
    a: 1,
    b: 2,
    c: 3,
    d: 4,
};

// struct.multiline.comma_dangle: false
myStruct = {
    a: 1,
    b: 2,
    c: 3,
    d: 4
};

struct.multiline.element_count

Type: integer

Default: 4

When a struct has this number of elements or more, print it onto multiple lines.

struct.multiline.leading_comma

Type: boolean

Default: false

Whether to use a leading comma when an struct is printed on multiple lines.

// struct.multiline.leading_comma: true
myStruct = {
      a: 1
    , b: 2
    , c: 3
    , d: 4
};

// struct.multiline.leading_comma: false
myStruct = {
    a: 1,
    b: 2,
    c: 3,
    d: 4
};

struct.multiline.leading_comma.padding

Type: boolean

Default: true

Whether to insert a space after leading commas when an struct is printed on multiple lines.

// struct.multiline.leading_comma.padding: true
myStruct = {
      a: 1
    , b: 2
    , c: 3
    , d: 4
};

// struct.multiline.leading_comma.padding: false
myStruct = {
     a: 1
    ,b: 2
    ,c: 3
    ,d: 4
};

struct.multiline.min_length

Type: integer

Default: 40

No matter how many elements an struct has, if it is shorter than this length, keep it on one line.

struct.padding

Type: boolean

Default: false

Whether to pad non-empty structs with spaces.

// struct.padding: true
myStruct = { a: 1, b: 2 };

// struct.padding: false
myStruct = {a: 1, b: 2};

struct.quote_keys

Type: boolean

Default: false

When true, struct keys are quoted.

// struct.quote_keys: true
myStruct = {'a': 1, 'b': 2};

// struct.quote_keys: false
myStruct = {a: 1, 'b': 2};

struct.separator

Default: ": "

The key value separator to use in structs - it must contain either a single : or = and be no more than 3 characters in length.

// struct.separator: ": "
myStruct = {a: 1, b: 2};

// struct.separator: " = "
myStruct = {a = 1, b = 2};

// struct.separator: " : "
myStruct = {a : 1, b : 2};

// struct.separator: "="
myStruct = {a=1, b=2};

tab_indent

Type: boolean

Default: false

Whether to indent using tab characters or not.

tags.lowercase

Type: boolean

Default: true

When true, tag names are lowercased. If false, tag name case is left as is.

<cfif a eq b>
    <div></div>
</cfif>

<CFIF a eq b>
    <DIV></DIV>
</CFIF>