<commit_before># Reference {#reference}

Now that you've stepped through the developer guide like a champ, we have some reference materials for you. This would be a great place to bookmark and refer back to when you have questions about elementary development.

# Code Style {#code-style}

The purpose of this guide is to provide clean and accurate instructions on
writing good code across all elementary projects. This guideline is to be
followed on every file, in order to keep our code consistent and readable. We
are also inheriting some of the GNOME's Vala guidelines to keep our code
consistent with other Vala programs.

If the guidelines here proposed are followed, newcomers to elementary
development will be more easily able to join the development and
understand code. Besides, it'll make it easier for all developers to work on
applications that they don't usually work on, because the code will be
consistent. Finally, as <NAME> said - "Code is much more often read
than written", so having nicely written code is crucial.

## Whitespace {#whitespace}

There is no trailing whitespace at the end of a line, whether it's empty or
not. There is also no empty line after declaring a function:


    public string get_text () {
        string text = search_entry.get_text ();
        return text;
    }

White space comes before opening parentheses:


    public string get_text () {}
    if (a == 5) {
        return 4;
    }

    for (i = 0; i < maximum; i++) {}
    my_function_name ();
    Object my_instance = new Object ();

Whitespace goes in all maths-related code, between numbers and operators.


    c = n * 2 + 4;
<commit_msg>Code style docs for newlines after }'s (#2168)<commit_after># Reference {#reference}

Now that you've stepped through the developer guide like a champ, we have some reference materials for you. This would be a great place to bookmark and refer back to when you have questions about elementary development.

# Code Style {#code-style}

The purpose of this guide is to provide clean and accurate instructions on
writing good code across all elementary projects. This guideline is to be
followed on every file, in order to keep our code consistent and readable. We
are also inheriting some of the GNOME's Vala guidelines to keep our code
consistent with other Vala programs.

If the guidelines here proposed are followed, newcomers to elementary
development will be more easily able to join the development and
understand code. Besides, it'll make it easier for all developers to work on
applications that they don't usually work on, because the code will be
consistent. Finally, as <NAME> said - "Code is much more often read
than written", so having nicely written code is crucial.

## Whitespace {#whitespace}

There is no trailing whitespace at the end of a line, whether it's empty or
not. There is also no empty line after declaring a function:


    public string get_text () {
        string text = search_entry.get_text ();
        return text;
    }

White space comes before opening parentheses:


    public string get_text () {}
    if (a == 5) {
        return 4;
    }

    for (i = 0; i < maximum; i++) {}
    my_function_name ();
    Object my_instance = new Object ();

Whitespace goes in all maths-related code, between numbers and operators.


    c = n * 2 + 4;

Lines consisting of closing brackets (`}` or `)`) should be followed by an empty 
line, except when followed by another closing bracket or an `else` statement.


    if (condition) {
        // ...
    } else {
        // ...
    }

    // other code


{'fraction_non_alphanumeric': 0.0606145251396648, 'fraction_numerical': 0.003910614525139665, 'mean_word_length': 3.459526774595268, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1034656', 'n_tokens_mistral': 957, 'n_tokens_neox': 882, 'n_words': 518}