# Reconsider checking the apps scripts with ShellCheck

**URL:** <https://forum.yunohost.org/t/reconsider-checking-the-apps-scripts-with-shellcheck/28185>\
**Category:** Apps packaging\
**Tags:** english\
**Created:** [January 22, 2024, 7:08pm UTC](https://forum.yunohost.org/t/reconsider-checking-the-apps-scripts-with-shellcheck/28185 "2024-01-22T19:08:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuba-orlik](https://forum.yunohost.org/user_avatar/forum.yunohost.org/kuba-orlik/32/7760_2.png) [@kuba-orlik](https://forum.yunohost.org/u/kuba-orlik)\
**Post date:** [January 22, 2024, 7:08pm UTC](https://forum.yunohost.org/t/reconsider-checking-the-apps-scripts-with-shellcheck/28185/1 "2024-01-22T19:08:30Z")

</div>

Creating a new topic because @moutonjr1’s [Best pracices: using ShellCheck to sanitize scripts](https://forum.yunohost.org/t/best-pracices-using-shellcheck-to-sanitize-scripts/9152) has been closed.

I’d propose reconsidering using ShellCheck. I believe it could save time fixing issues that could have been automatically prevented, like this one:

> <https://github.com/YunoHost-Apps/influxdb_v2_ynh/pull/4/files>

and let contributors focus their limited resources on other areas of the project 💪

---

<div class="post-metadata">

**Author:** ![Aleks](https://forum.yunohost.org/user_avatar/forum.yunohost.org/aleks/32/1704_2.png) [@Aleks](https://forum.yunohost.org/u/Aleks)\
**Post date:** [January 22, 2024, 8:52pm UTC](https://forum.yunohost.org/t/reconsider-checking-the-apps-scripts-with-shellcheck/28185/2 "2024-01-22T20:52:40Z")

</div>

(Related discussion : [add shellcheck config by OniriCorpe · Pull Request #220 · YunoHost/example\_ynh · GitHub](https://github.com/YunoHost/example_ynh/pull/220) )

(Personal opinion from a few days ago on the chat

> yyyyah heuarg i should get more familiar with shellcheck, i was kind of like “meh it’s gonna spit out so many errors” and i’m like “uuuugh yet another file” but not really a good argument
> 
> and then i’m like zhgfmvflfv we should really have packaging v3 to drastically reduce the amount of bash code _again_ rather than micro-managing the current syntax 😑
> 
> but maybe displaying the shellcheck results in the linter could be gud, should give this a try

Basically yes but if we suddently add this in the linter this may be overwhelming idk, should give this a try

---

<div class="post-metadata">

**Author:** ![Salamandar](https://forum.yunohost.org/user_avatar/forum.yunohost.org/salamandar/32/440_2.png) [@Salamandar](https://forum.yunohost.org/u/Salamandar)\
**Post date:** [January 31, 2024, 3:31pm UTC](https://forum.yunohost.org/t/reconsider-checking-the-apps-scripts-with-shellcheck/28185/3 "2024-01-31T15:31:31Z")

</div>

tl;dr the issues are :

- the helpers have some weird syntaxes that shellchecks struggles (kinda easily fixable)
- shellcheck doesn’t really like non-constant source, so that doesn’t work : [https://github.com/YunoHost/yunohost/blob/4897f72974fff30b168a40bf55bf917395cca4cc/share/helpers#L6](https://github.com/YunoHost/yunohost/blob/4897f72974fff30b168a40bf55bf917395cca4cc/share/helpers#L6)
- the manifest variables aren’t defined in bash _per se_, we need some tweaks to tell shellcheck “yea yea, those variables are defined don’t worry”. (We could actually silence “undefined variables” warnings)
- the variables used in templates (` __MYVAR__ `) aren’t used in bash _per se_ either, so shellcheck thinks the variables are unused → IMHO we could just silence “unused variable” warnings.
