Skip to contentSkip to conversation

Additional linting in meta-layer repotest

DISCUSSION Patrick Williams 1 participant 2 messages Oct 27, 2021 – Nov 3, 2021

lore
Share & tools
lore
#0 lore raw

Hello,

Ed recently added a test-phase called 'repotest'[1,2] in the openbmc/openbmc repository that allows us to perform sanity checking on commits at that level beyond a simple "does this compile". The initial checking he added was to ensure that no new patches are added to the tree (in violation of our meta-layer coding guidelines).

I'm adding[3] additional capabilities to this script to enable linting in the repository. This will run shellcheck for shell scripts and eslint for JSON (Some might be unaware that Manoj added JSON linting with eslint as part of our normal unit-test / formatting scripts[4] as well). Once this is in place new commits will fail CI if they add new shellscripts that violate shellcheck rules or JSON with invalid parsing.

Currently, there is quite an extensive list of 'exempted' scripts (~100) which already fail shellcheck rules. It is quite likely that some of these are real bugs, so I would strongly urge if you are the maintainer of one of the meta-layers holding an 'exempted' script that you look over the shellcheck failures. Hopefully over the next few months we will greatly reduce the number of scripts in this exemption list by cleaning up the issues.

1. https://lore.kernel.org/openbmc/CAH2-KxDe6hR1V-Lz1k8cdD11jEquy4UhR4LfLhg37E5EG42EJg@mail.gmail.com/
2. https://github.com/openbmc/openbmc/blob/master/meta-phosphor/scripts/run-repotest
3. https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48349
4. https://github.com/openbmc/openbmc-build-scripts/blob/master/scripts/format-code.sh#L31

Signature · 1 line
Patrick Williams
#1 lore raw
Quoted 22 lines · Patrick Williams

Hello,

Ed recently added a test-phase called 'repotest'[1,2] in the openbmc/openbmc repository that allows us to perform sanity checking on commits at that level beyond a simple "does this compile". The initial checking he added was to ensure that no new patches are added to the tree (in violation of our meta-layer coding guidelines).

I'm adding[3] additional capabilities to this script to enable linting in the repository. This will run shellcheck for shell scripts and eslint for JSON (Some might be unaware that Manoj added JSON linting with eslint as part of our normal unit-test / formatting scripts[4] as well). Once this is in place new commits will fail CI if they add new shellscripts that violate shellcheck rules or JSON with invalid parsing.

Currently, there is quite an extensive list of 'exempted' scripts (~100) which already fail shellcheck rules. It is quite likely that some of these are real bugs, so I would strongly urge if you are the maintainer of one of the meta-layers holding an 'exempted' script that you look over the shellcheck failures. Hopefully over the next few months we will greatly reduce the number of scripts in this exemption list by cleaning up the issues.

Quoted 6 lines

1. https://lore.kernel.org/openbmc/CAH2-KxDe6hR1V-Lz1k8cdD11jEquy4UhR4LfLhg37E5EG42EJg@mail.gmail.com/
2. https://github.com/openbmc/openbmc/blob/master/meta-phosphor/scripts/run-repotest
3. https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/48349
4. https://github.com/openbmc/openbmc-build-scripts/blob/master/scripts/format-code.sh#L31

Signature · 1 line
Patrick Williams

This is now merged.

Signature · 1 line
Patrick Williams