mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
check line width not needed (#9820)
* check line width not needed (cargo fmt checks this) * Fixing test to work in release mode.
This commit is contained in:
@@ -269,16 +269,6 @@ check-signed-tag:
|
|||||||
script:
|
script:
|
||||||
- ./.maintain/gitlab/check_signed.sh
|
- ./.maintain/gitlab/check_signed.sh
|
||||||
|
|
||||||
check-line-width:
|
|
||||||
stage: check
|
|
||||||
image: paritytech/tools:latest
|
|
||||||
<<: *kubernetes-env
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
|
|
||||||
script:
|
|
||||||
- ./.maintain/gitlab/check_line_width.sh
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
test-dependency-rules:
|
test-dependency-rules:
|
||||||
stage: check
|
stage: check
|
||||||
image: paritytech/tools:latest
|
image: paritytech/tools:latest
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# check if line width of rust source files is not beyond x characters
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
BASE_ORIGIN="origin"
|
|
||||||
BASE_BRANCH_NAME="master"
|
|
||||||
LINE_WIDTH="120"
|
|
||||||
GOOD_LINE_WIDTH="100"
|
|
||||||
BASE_BRANCH="${BASE_ORIGIN}/${BASE_BRANCH_NAME}"
|
|
||||||
git fetch ${BASE_ORIGIN} ${BASE_BRANCH_NAME} --depth 100
|
|
||||||
BASE_HASH=$(git merge-base ${BASE_BRANCH} HEAD)
|
|
||||||
|
|
||||||
git diff --name-only ${BASE_HASH} -- \*.rs | ( while read file
|
|
||||||
do
|
|
||||||
if [ ! -f ${file} ];
|
|
||||||
then
|
|
||||||
echo "Skipping removed file."
|
|
||||||
elif git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $LINE_WIDTH + 1 ))\}"
|
|
||||||
then
|
|
||||||
if [ -z "${FAIL}" ]
|
|
||||||
then
|
|
||||||
echo "| error!"
|
|
||||||
echo "| Lines must not be longer than ${LINE_WIDTH} characters."
|
|
||||||
echo "| "
|
|
||||||
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
|
|
||||||
echo "|"
|
|
||||||
FAIL="true"
|
|
||||||
fi
|
|
||||||
echo "| file: ${file}"
|
|
||||||
git diff ${BASE_HASH} -- ${file} \
|
|
||||||
| grep -n "^+.\{$(( $LINE_WIDTH + 1))\}"
|
|
||||||
echo "|"
|
|
||||||
else
|
|
||||||
if git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
|
|
||||||
then
|
|
||||||
if [ -z "${FAIL}" ]
|
|
||||||
then
|
|
||||||
echo "| warning!"
|
|
||||||
echo "| Lines should be longer than ${GOOD_LINE_WIDTH} characters only in exceptional circumstances!"
|
|
||||||
echo "| "
|
|
||||||
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
|
|
||||||
echo "|"
|
|
||||||
fi
|
|
||||||
echo "| file: ${file}"
|
|
||||||
git diff ${BASE_HASH} -- ${file} | grep -n "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
|
|
||||||
echo "|"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
test -z "${FAIL}"
|
|
||||||
)
|
|
||||||
@@ -537,7 +537,10 @@ mod bags {
|
|||||||
|
|
||||||
// Panics in case of duplicate tail insert (which would result in an infinite loop).
|
// Panics in case of duplicate tail insert (which would result in an infinite loop).
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic = "system logic error: inserting a node who has the id of tail"]
|
#[cfg_attr(
|
||||||
|
debug_assertions,
|
||||||
|
should_panic = "system logic error: inserting a node who has the id of tail"
|
||||||
|
)]
|
||||||
fn insert_node_duplicate_tail_panics_with_debug_assert() {
|
fn insert_node_duplicate_tail_panics_with_debug_assert() {
|
||||||
ExtBuilder::default().build_and_execute(|| {
|
ExtBuilder::default().build_and_execute(|| {
|
||||||
let node = |id, prev, next, bag_upper| Node::<Runtime> { id, prev, next, bag_upper };
|
let node = |id, prev, next, bag_upper| Node::<Runtime> { id, prev, next, bag_upper };
|
||||||
@@ -548,7 +551,9 @@ mod bags {
|
|||||||
|
|
||||||
// when inserting a duplicate id that is already the tail
|
// when inserting a duplicate id that is already the tail
|
||||||
assert_eq!(bag_1000.tail, Some(4));
|
assert_eq!(bag_1000.tail, Some(4));
|
||||||
bag_1000.insert_node_unchecked(node(4, None, None, bag_1000.bag_upper)); // panics
|
assert_eq!(bag_1000.iter().count(), 3);
|
||||||
|
bag_1000.insert_node_unchecked(node(4, None, None, bag_1000.bag_upper)); // panics in debug
|
||||||
|
assert_eq!(bag_1000.iter().count(), 3); // in release we expect it to silently ignore the request.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user