Commit graph

7 commits

Author SHA1 Message Date
Otavio Salvador e2edb3e405 scripts: Allow use of bash outside of /bin
Even though bash is commonly available as /bin/bash there are
exceptions (e.g NixOS). This commit allow the use of the scripts in my
environment and is generic.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-03-08 11:11:10 +01:00
Tomasz Bursztyka 7544263050 scripts: Fix documunt referenc for coccicheck
s/applications/guides

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 17:44:44 +02:00
Peter Bigot 15ed58652e scripts/cocci: add Zephyr macro file
Zephyr uses some defines to provide additional information about the
item being declared.  When unrecognized these can confuse the
Coccinelle parser so that it does not apply semantic patches in
situations where they should be applied.

Add a macro file that extends the Coccinelle builtin macro file with
some identifiers that are specific to Zephyr.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-05 06:15:04 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Himanshu Jha b2fa9db074 scripts: coccicheck: Add support for SPFLAGS
SPFLAGS allows to pass additional flags supported by
spatch during transformation.

Both short notation `-f=` and `--sp-flag=` can be used
to pass the flag to the coccicheck.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2019-02-07 08:12:20 -05:00
Himanshu Jha 200e847ace scripts: coccicheck: Improve continuous run operation
The current implementation of continuous run operation using
command `./scripts/coccicheck` i.e., without specifying any options,
`coccicheck` default runs in `report` mode with all available
coccinelle scripts present at `scripts/coccinelle/`.

Not all scripts have report mode implemented in them, which
leads to failure of coccicheck.

With this new implementation we choose whatever available mode
is present in coccinelle script and pass it to MODE variable
without stopping continuous coverage.

And perhaps if there are plans to add `coccicheck` as a sanity
checker in future to the Zephyr automated CI, then certainly we
want the warnings/errors produced by scripts to be less verbose
to the users.

Therefore, in this new implementation we prioritise the modes as:

1. report
2. context
3. patch
and lastly falling to
4. org

Lastly, in order to differentiate between outputs of various
coccinelle scripts being run, `x------x` separator has been used
to make reports mode readable.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-12-05 15:14:05 -05:00
Himanshu Jha dce9141fb1 Coccinelle: Add support for Coccinelle infrastructure
'coccicheck' target is used to initiate Coccinelle checker. It
can be called via four different modes that generate different
output corresponding the mode.

The four modes are:

* 'patch' proposes a fix, when possible.
* 'report' generates a list in the following format:
	file:line:column-column: message
* 'context' highlights lines of interest and their context in
   a diff-like style. Lines of interest are indicated with '-'.
* 'org' generates a report in the Org mode format of Emacs.

The 'coccicheck' front-end can be called with suitable arguments:

* --mode=<mode>: specify the mode for processsing.
* --cocci=<path/to/foo.cocci>: specify the SmPL file to use.
* --verbose=<1>: enable verbose output.

Run `./scripts/coccicheck --help` for more detailed info
on various options available.

With the above arguments the coccinelle transformation engine
runs on the entire/part of the source code tree depending on
various options supplied to the coccicheck sanity checker.

More detailed documentation can be found at:
doc/application/coccinelle.rst

Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
2018-10-02 14:03:39 -07:00