Update `checkstyle` workflow env to ubuntu-20.04
- `checkstyle` workflow uses ubuntu-20.04 environment - improved `mancheck.sh` readability Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12713
This commit is contained in:
parent
ad15fb430a
commit
64e88992b6
|
@ -6,7 +6,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checkstyle:
|
checkstyle:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -4096,7 +4096,7 @@ cksum_record_compare(const void *x1, const void *x2)
|
||||||
const cksum_record_t *l = (cksum_record_t *)x1;
|
const cksum_record_t *l = (cksum_record_t *)x1;
|
||||||
const cksum_record_t *r = (cksum_record_t *)x2;
|
const cksum_record_t *r = (cksum_record_t *)x2;
|
||||||
int arraysize = ARRAY_SIZE(l->cksum.zc_word);
|
int arraysize = ARRAY_SIZE(l->cksum.zc_word);
|
||||||
int difference;
|
int difference = 0;
|
||||||
|
|
||||||
for (int i = 0; i < arraysize; i++) {
|
for (int i = 0; i < arraysize; i++) {
|
||||||
difference = TREE_CMP(l->cksum.zc_word[i], r->cksum.zc_word[i]);
|
difference = TREE_CMP(l->cksum.zc_word[i], r->cksum.zc_word[i]);
|
||||||
|
|
|
@ -210,12 +210,14 @@ zfs_get_hdrversion(const zfs_zstdhdr_t *blob)
|
||||||
static inline void
|
static inline void
|
||||||
zfs_set_hdrversion(zfs_zstdhdr_t *blob, uint32_t version)
|
zfs_set_hdrversion(zfs_zstdhdr_t *blob, uint32_t version)
|
||||||
{
|
{
|
||||||
|
/* cppcheck-suppress syntaxError */
|
||||||
BF32_SET(blob->raw_version_level, 0, 24, version);
|
BF32_SET(blob->raw_version_level, 0, 24, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
zfs_set_hdrlevel(zfs_zstdhdr_t *blob, uint8_t level)
|
zfs_set_hdrlevel(zfs_zstdhdr_t *blob, uint8_t level)
|
||||||
{
|
{
|
||||||
|
/* cppcheck-suppress syntaxError */
|
||||||
BF32_SET(blob->raw_version_level, 24, 8, level);
|
BF32_SET(blob->raw_version_level, 24, 8, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,9 @@ modules_uninstall: modules_uninstall-@ac_system@
|
||||||
|
|
||||||
cppcheck-Linux:
|
cppcheck-Linux:
|
||||||
@CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \
|
@CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \
|
||||||
--inline-suppr --suppress=noValidConfiguration \
|
--inline-suppr \
|
||||||
|
--suppress=unmatchedSuppression \
|
||||||
|
--suppress=noValidConfiguration \
|
||||||
--enable=warning,information -D_KERNEL \
|
--enable=warning,information -D_KERNEL \
|
||||||
--include=@LINUX_OBJ@/include/generated/autoconf.h \
|
--include=@LINUX_OBJ@/include/generated/autoconf.h \
|
||||||
--include=@top_srcdir@/zfs_config.h \
|
--include=@top_srcdir@/zfs_config.h \
|
||||||
|
|
|
@ -533,12 +533,14 @@ nvt_add_nvpair(nvlist_t *nvl, nvpair_t *nvp)
|
||||||
uint64_t index = hash & (priv->nvp_nbuckets - 1);
|
uint64_t index = hash & (priv->nvp_nbuckets - 1);
|
||||||
|
|
||||||
ASSERT3U(index, <, priv->nvp_nbuckets);
|
ASSERT3U(index, <, priv->nvp_nbuckets);
|
||||||
|
// cppcheck-suppress nullPointerRedundantCheck
|
||||||
i_nvp_t *bucket = tab[index];
|
i_nvp_t *bucket = tab[index];
|
||||||
|
|
||||||
/* insert link at the beginning of the bucket */
|
/* insert link at the beginning of the bucket */
|
||||||
i_nvp_t *new_entry = NVPAIR2I_NVP(nvp);
|
i_nvp_t *new_entry = NVPAIR2I_NVP(nvp);
|
||||||
ASSERT3P(new_entry->nvi_hashtable_next, ==, NULL);
|
ASSERT3P(new_entry->nvi_hashtable_next, ==, NULL);
|
||||||
new_entry->nvi_hashtable_next = bucket;
|
new_entry->nvi_hashtable_next = bucket;
|
||||||
|
// cppcheck-suppress nullPointerRedundantCheck
|
||||||
tab[index] = new_entry;
|
tab[index] = new_entry;
|
||||||
|
|
||||||
priv->nvp_nentries++;
|
priv->nvp_nentries++;
|
||||||
|
@ -3270,6 +3272,8 @@ NVS_BUILD_XDRPROC_T(u_longlong_t);
|
||||||
static int
|
static int
|
||||||
nvs_xdr_nvp_op(nvstream_t *nvs, nvpair_t *nvp)
|
nvs_xdr_nvp_op(nvstream_t *nvs, nvpair_t *nvp)
|
||||||
{
|
{
|
||||||
|
ASSERT(nvs != NULL && nvp != NULL);
|
||||||
|
|
||||||
data_type_t type;
|
data_type_t type;
|
||||||
char *buf;
|
char *buf;
|
||||||
char *buf_end = (char *)nvp + nvp->nvp_size;
|
char *buf_end = (char *)nvp + nvp->nvp_size;
|
||||||
|
@ -3278,7 +3282,7 @@ nvs_xdr_nvp_op(nvstream_t *nvs, nvpair_t *nvp)
|
||||||
bool_t ret = FALSE;
|
bool_t ret = FALSE;
|
||||||
XDR *xdr = nvs->nvs_private;
|
XDR *xdr = nvs->nvs_private;
|
||||||
|
|
||||||
ASSERT(xdr != NULL && nvp != NULL);
|
ASSERT(xdr != NULL);
|
||||||
|
|
||||||
/* name string */
|
/* name string */
|
||||||
if ((buf = NVP_NAME(nvp)) >= buf_end)
|
if ((buf = NVP_NAME(nvp)) >= buf_end)
|
||||||
|
|
|
@ -199,7 +199,6 @@ vdev_geom_orphan(struct g_consumer *cp)
|
||||||
* async removal support to invoke a close on this
|
* async removal support to invoke a close on this
|
||||||
* vdev once it is safe to do so.
|
* vdev once it is safe to do so.
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress All
|
|
||||||
SLIST_FOREACH(elem, priv, elems) {
|
SLIST_FOREACH(elem, priv, elems) {
|
||||||
// cppcheck-suppress uninitvar
|
// cppcheck-suppress uninitvar
|
||||||
vdev_t *vd = elem->vd;
|
vdev_t *vd = elem->vd;
|
||||||
|
|
|
@ -657,6 +657,7 @@ hostid_read(uint32_t *hostid)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
size = stat.size;
|
size = stat.size;
|
||||||
|
// cppcheck-suppress sizeofwithnumericparameter
|
||||||
if (size < sizeof (HW_HOSTID_MASK)) {
|
if (size < sizeof (HW_HOSTID_MASK)) {
|
||||||
filp_close(filp, 0);
|
filp_close(filp, 0);
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
|
@ -865,7 +865,9 @@ do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz,
|
||||||
start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4];
|
start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4];
|
||||||
end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
|
end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
|
||||||
} else {
|
} else {
|
||||||
|
// cppcheck-suppress arrayIndexOutOfBoundsCond
|
||||||
start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4];
|
start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4];
|
||||||
|
// cppcheck-suppress arrayIndexOutOfBoundsCond
|
||||||
end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1];
|
end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,7 +1014,9 @@ find_composition_start(size_t uv, uchar_t *s, size_t sz)
|
||||||
start_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4];
|
start_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4];
|
||||||
end_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
|
end_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
|
||||||
} else {
|
} else {
|
||||||
|
// cppcheck-suppress arrayIndexOutOfBoundsCond
|
||||||
start_id = u8_composition_b4_tbl[uv][b3_tbl][b4];
|
start_id = u8_composition_b4_tbl[uv][b3_tbl][b4];
|
||||||
|
// cppcheck-suppress arrayIndexOutOfBoundsCond
|
||||||
end_id = u8_composition_b4_tbl[uv][b3_tbl][b4 + 1];
|
end_id = u8_composition_b4_tbl[uv][b3_tbl][b4 + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086,SC2250
|
||||||
|
|
||||||
|
trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT
|
||||||
|
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
echo "Usage: $0 manpage-directory..."
|
echo "Usage: $0 manpage-directory..."
|
||||||
|
@ -25,7 +27,6 @@ fi
|
||||||
|
|
||||||
IFS="
|
IFS="
|
||||||
"
|
"
|
||||||
|
|
||||||
files="$(find "$@" -type f -name '*[1-9]*')" || exit 1
|
files="$(find "$@" -type f -name '*[1-9]*')" || exit 1
|
||||||
|
|
||||||
add_excl="$(awk '
|
add_excl="$(awk '
|
||||||
|
@ -38,6 +39,15 @@ add_excl="$(awk '
|
||||||
|
|
||||||
# Redirect to file instead of 2>&1ing because mandoc flushes inconsistently(?) which tears lines
|
# Redirect to file instead of 2>&1ing because mandoc flushes inconsistently(?) which tears lines
|
||||||
# https://github.com/openzfs/zfs/pull/12129/checks?check_run_id=2701608671#step:5:3
|
# https://github.com/openzfs/zfs/pull/12129/checks?check_run_id=2701608671#step:5:3
|
||||||
etmp="$(mktemp)"
|
stdout_file="$(mktemp)"
|
||||||
! { mandoc -Tlint $files 2>"$etmp"; cat "$etmp"; rm -f "$etmp"; } |
|
stderr_file="$(mktemp)"
|
||||||
grep -vE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl >&2
|
mandoc -Tlint $files 1>"$stdout_file" 2>"$stderr_file"
|
||||||
|
result_file="$(mktemp)"
|
||||||
|
grep -vhE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl "$stdout_file" "$stderr_file" > "$result_file"
|
||||||
|
|
||||||
|
if [ -s "$result_file" ]; then
|
||||||
|
cat "$result_file"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "no errors found"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue