aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/dev_style.txt
Commit message (Collapse)AuthorAge
* refactor: replace manual header guards with #pragma oncedundargoc2023-11-12
| | | | | It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard.
* docs(style): add guideline for fixing compiler error on switch statementFamiu Haque2023-10-10
| | | | | | Problem: Certain compilers (primarily GCC) do not recognize an exhaustive enum switch statement as being exhaustive. This manifests in the form of compiler errors in exhaustive switch statements where each case has a return statement but there isn't a catch-all return statements. These compiler errors are spurious in the context of the Neovim codebase. So #25533 added the `UNREACHABLE` macro to denote apart of the code that's unreachable, which was used after every such switch statement to tell the compiler to treat the switch statement as exhaustive. However, the macro is mentioned nowhere in the style guide,and new contributors would not have any natural way of learning about it as it stands now. This would lead to confusion when they inevitably encounter one of these compiler errors. Solution: Add a style guideline which shows how to use the `UNREACHABLE` macro to fix these compiler errors.
* refactor: allow not having a `default` case for enumFamiu Haque2023-10-10
| | | | | | Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added. Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases.
* docs: use `abort()` for unreachable `default:` case in CFamiu Haque2023-10-07
| | | | | | Problem: The style guide currently recommends having a `default:` case for switch statements that are not conditional on an enumerated value. Additionally, it recommends using `assert(false)` if `default:` is unreachable. This is problematic because `assert()` only runs on debug builds, which may lead to confusing breakages in release builds. Moreover, this suggestion is followed nowhere in the C code and `abort()` is used everywhere instead. Solution: Suggest using `abort()` instead of `assert(false)`, that way the program always terminates if a logically unreachable case is reached.
* docs: add language annotation to Nvim manualChristian Clason2022-12-02
|
* docs(dev-style): remove rules covered by uncrustifydundargoc2022-10-21
| | | | | There's no reason for contributors to learn rules that can be automated away.
* docs(dev-style): remove rule about variable declarations (#20446)kylo2522022-10-15
| | | | The other style rules such as "initialize variables in the declaration" should already take care of this rule automatically.
* docs: fix/remove invalid URLs #20647Justin M. Keyes2022-10-14
|
* docs: documenting struct members inline #18783Javier Lopez2022-06-06
| | | | | | | | Without the proper comments, doxygen doesn't understand the comment belongs to the struct member: https://www.doxygen.nl/manual/docblocks.html#memberdoc [skip ci]
* docs(dev-style): remove rules covered by uncrustify #18767dundargoc2022-05-30
| | | | Uncrustify is the source of truth where possible. See also https://github.com/neovim/neovim/pull/18563
* build(clint): remove redundant checks #18698dundargoc2022-05-22
| | | | | Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. See also https://github.com/neovim/neovim/pull/18563
* ci(clint): remove clint.py line length check #18574dundargoc2022-05-15
| | | | | uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. See also https://github.com/neovim/neovim/pull/18563
* ci(clint): remove check for include orderDundar Goc2022-05-14
| | | | | | Uncrustify and clang-format are already both excellent at ordering includes; this isn't something we need to check for ourselves. Also remove the section on include order in the dev-style documentation.
* doc(dev_style.txt): misc updatesJustin M. Keyes2021-09-23
|
* doc: convert neovim style guide to vim doc.Dundar Göc2021-09-23