# Magic IGRAPH\_CHECK

**URL:** <https://igraph.discourse.group/t/magic-igraph-check/274>\
**Category:** Development\
**Created:** [6 June 2020 08:23 UTC](https://igraph.discourse.group/t/magic-igraph-check/274 "2020-06-06T08:23:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iosonofabio](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/iosonofabio/32/16_2.png) [@iosonofabio](https://igraph.discourse.group/u/iosonofabio)\
**Post date:** [6 June 2020 08:23 UTC](https://igraph.discourse.group/t/magic-igraph-check/274/1 "2020-06-06T08:23:46Z")

</div>

What about all function calls within igraph get automatically wrapped in IGRAPH\_CHECK by the compiler/preprocessor if they define a variable:

int err\_code

?

I’m a little unsure how to get it done in practice but we could set it up and then slowly change that return variable name into all appropriate functions to simplify the code.

What do you guys think?

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [8 June 2020 19:29 UTC](https://igraph.discourse.group/t/magic-igraph-check/274/2 "2020-06-08T19:29:52Z")

</div>

Might it be an idea to setup a linter for checking PRs instead of building a preprocessor? That way, we could perhaps check more things when submittings PRs. Making sure that `IGRAPH_CHECK` is called is just one thing, we could then perhaps also check

- Matching number of `IGRAPH_FINALLY` and `IGRAPH_FINALLY_CLEAN`.
- Whether `IGRAPH_SUCCESS` is properly returned.
- Whether `IGRAPH_FINALLY` signature matches object definition.
- …

---

<div class="post-metadata">

**Author:** ![iosonofabio](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/iosonofabio/32/16_2.png) [@iosonofabio](https://igraph.discourse.group/u/iosonofabio)\
**Post date:** [8 June 2020 22:25 UTC](https://igraph.discourse.group/t/magic-igraph-check/274/3 "2020-06-08T22:25:31Z")

</div>

Oh I like the linter idea. Less automatic that can fail and more convention enforcement. Let me do a little research. Had anyone written I’ve if those?
