提交 0d95ee9d 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 4b5f3b83
流水线 #168056 已失败 于阶段
用时 48 秒
......@@ -3,4 +3,6 @@
*.bak
*.out
*.html
user_output*.txt
user_*
*.pyc
__pycache__
......@@ -6,13 +6,12 @@ stages:
- code-analysis
variables:
TEACHERCHECK_REPO: "engintime/cpp-lab/teachers-packet/cpp-language/Lab107.git"
TEACHERCHECK_REPO: ""
.codecode-runner: &codecode-runner
tags:
- ubuntu-16.04
- short-job
- intranet
.codecode-analysis-runner: &codecode-analysis-runner
tags:
......@@ -25,7 +24,7 @@ case1:
stage: case1
<<: *codecode-runner
script:
- python3 .vscode/test.py ci
- python3 .vscode/test.py ./app.exe ci
only:
- master
......@@ -34,34 +33,13 @@ teacher-check1:
<<: *codecode-runner
script:
- make
- count=$(find . -name "input*.txt" | wc -l)
- git clone ${CODECODE_PROTOCOL}gitlab-ci-token:${CI_JOB_TOKEN}@${CODECODE_DOMAIN}/${CI_PROJECT_FORKSOURCE} template
- cd template && git checkout -b fork_position ${CI_PROJECT_FORKPOS} && cd ..
- cd template && git checkout -b fork_position ${CI_PROJECT_FORKPOS} && cd ..
- diff template/.gitlab-ci.yml .gitlab-ci.yml -b -B -y -i --suppress-common-lines
- diff template/.vscode/comtool.py .vscode/comtool.py -b -B -y -i --suppress-common-lines
- diff template/.vscode/test.py .vscode/test.py -b -B -y -i --suppress-common-lines
- for i in $(seq 1 1 $count);
do
./app.exe < input${i}.txt > /dev/null;
echo "正在检查input${i}.txt文件的一致性";
diff template/input${i}.txt input${i}.txt -b -B -y -i --suppress-common-lines;
echo "正在检查output${i}.txt文件的一致性";
diff template/output${i}.txt output${i}.txt -b -B -y -i --suppress-common-lines;
done
- fileidentity.sh
- if [ -n "$TEACHERCHECK_REPO" ];
then
git clone ${CODECODE_PROTOCOL}gitlab-ci-token:${CI_JOB_TOKEN}@${CODECODE_DOMAIN}/${TEACHERCHECK_REPO} teacher_check;
extracount=$(cd teacher_check && find . -name "input*.txt" | wc -l);
for i in $(seq 1 1 $extracount);
do
echo "正在检查附加算例case${i}";
./app.exe < teacher_check/input${i}.txt > user_output${i}.txt;
diff teacher_check/output${i}.txt user_output${i}.txt -b -B -y -i -W 100;
done
source extracase.sh;
fi;
- diff template/.vscode/teacher-check.py .vscode/teacher-check.py -b -B -y -i --suppress-common-lines
# - python3 .vscode/teacher-check.py ./app.exe "${TEACHERCHECK_REPO}" "${CODECODE_PROTOCOL}gitlab-ci-token:${CI_JOB_TOKEN}@${CODECODE_DOMAIN}/${TEACHERCHECK_REPO}"
only:
- master
when: manual
......@@ -71,12 +49,10 @@ code-analysis:
stage: code-analysis
<<: *codecode-analysis-runner
script:
- make
- ./app.exe < input1.txt > /dev/null
- mkdir -p build
- python3 .vscode/code-analysis.py ./app.exe
- cppcheck -v --force --enable=all --xml -I./ ./ 2> ./build/cppcheck-report.xml
- bash -c 'find ./ -regex ".*\.c\|.*\.h" | vera++ -S -s -d -c ./build/vera-report.xml'
- valgrind --xml=yes --xml-file=./build/valgrind-report.xml ./app.exe < input1.txt > /dev/null
- sonar-scanner -Dsonar.projectKey=ProjectKey-$CI_PROJECT_ID -Dsonar.projectName=$CI_PROJECT_NAME -Dsonar.links.homepage=$CI_PROJECT_URL -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.url=$CODECODE_PROTOCOL$CODECODE_DOMAIN
allow_failure: true
only:
......
  • Developer

    代码质量分析发现了 5 个问题。

    • 0 blocker
    • 🚫 2 critical
    • 1 major
    • 🔽 2 minor
    • 0 info

    注意: 存在下列问题的代码行在本次提交中没有发生变更,无法使用代码行评论的方式进行报告。所以将下列问题汇总显示在这里(点击问题链接可以转到对应的源代码行):

    1. 🚫 [Mismatched free() / delete / delete []: Address 0x5ab6c80 is 0 bytes inside a block of size 4 alloc'd (Stack 1)

    0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 0x400A55: main (main.cpp:8)](https://www.codecode.net/engintime-cs/teacher-group/shx/Test/test-vscode-cpp-win/blob/0d95ee9d791d229524c1aed94cc021a9baa0fd8b/main.cpp#L8) 📘

    1. 🚫 [Mismatched free() / delete / delete []: Address 0x5ab6c80 is 0 bytes inside a block of size 4 alloc'd (Stack 0)

    0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 0x400B8D: main (main.cpp:29)](https://www.codecode.net/engintime-cs/teacher-group/shx/Test/test-vscode-cpp-win/blob/0d95ee9d791d229524c1aed94cc021a9baa0fd8b/main.cpp#L29) 📘

    1. Mismatching allocation and deallocation: z 📘
    2. 🔽 Cppcheck cannot find all the include files. Cppcheck can check the code without the include files found. But the results will probably be more accurate if all the include files are found. Please check your project's include directories and add all of them as include directories for Cppcheck. To see what files Cppcheck cannot find use --check-config. (ProjectKey-169407) 📘
    3. 🔽 Variable 'z' is allocated memory that is never used. 📘
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论