The following function will throw a Unexpected line break before "{" block-opening-brace-space-before. It should probably allow for a new-line if requires or ensures are preset.
While possible to use a single space, it's a little weird
Current behaviour
This fails block-opening-brace-space-before:
double method_name (int x, double d)
requires (x > 0 && x < 10)
requires (d >= 0.0 && d <= 1.0)
ensures (result >= 0.0 && result <= 10.0)
{
return d * x;
}
This passes:
double method_name (int x, double d)
requires (x > 0 && x < 10)
requires (d >= 0.0 && d <= 1.0)
ensures (result >= 0.0 && result <= 10.0) {
return d * x;
}
Temporary solution
For now, we could just disable this check for the linter.
This is how it looks like:
private ArrayList<File> get_children (File folder, ArrayList<File> _children = new ArrayList<File> ())
requires (folder.query_file_type (FileQueryInfoFlags.NONE, null) == FileType.DIRECTORY) // vala-lint:block-opening-brace-space-before
{
// .......
return _children;
}
Soltuion
Ideally have an exception for contrat programming keywords like requires and ensures. Even the documentation on vala.dev styles the code this way:
Reference: Contract Programming on docs.vala.dev
The following function will throw a
Unexpected line break before "{" block-opening-brace-space-before. It should probably allow for a new-line if requires or ensures are preset.While possible to use a single space, it's a little weird
Current behaviour
This fails
block-opening-brace-space-before:This passes:
Temporary solution
For now, we could just disable this check for the linter.
This is how it looks like:
Soltuion
Ideally have an exception for contrat programming keywords like requires and ensures. Even the documentation on vala.dev styles the code this way:
Reference: Contract Programming on docs.vala.dev