mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
ci: check for clang tidy errors in libtransmission (#5188)
This commit is contained in:
parent
bfa62f6116
commit
b354337720
4 changed files with 57 additions and 4 deletions
53
.github/workflows/actions.yml
vendored
53
.github/workflows/actions.yml
vendored
|
@ -65,6 +65,7 @@ jobs:
|
||||||
get_changes tests CMakeLists.txt cmake third-party libtransmission utils tests
|
get_changes tests CMakeLists.txt cmake third-party libtransmission utils tests
|
||||||
get_changes utils CMakeLists.txt cmake third-party libtransmission utils
|
get_changes utils CMakeLists.txt cmake third-party libtransmission utils
|
||||||
get_changes web CMakeLists.txt cmake third-party libtransmission web
|
get_changes web CMakeLists.txt cmake third-party libtransmission web
|
||||||
|
cat "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
code-style:
|
code-style:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -174,6 +175,58 @@ jobs:
|
||||||
- name: Test with sanitizers
|
- name: Test with sanitizers
|
||||||
run: cmake -E chdir obj ctest -j $(nproc) --build-config Debug --output-on-failure
|
run: cmake -E chdir obj ctest -j $(nproc) --build-config Debug --output-on-failure
|
||||||
|
|
||||||
|
clang-tidy-libtransmission:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs: [ what-to-make ]
|
||||||
|
if: ${{ needs.what-to-make.outputs.test-style == 'true' }}
|
||||||
|
steps:
|
||||||
|
- name: Show Configuration
|
||||||
|
run: |
|
||||||
|
echo '${{ toJSON(needs) }}'
|
||||||
|
echo '${{ toJSON(runner) }}'
|
||||||
|
cat /etc/os-release
|
||||||
|
- name: Get Dependencies
|
||||||
|
run: |
|
||||||
|
set -ex
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
clang \
|
||||||
|
clang-tidy \
|
||||||
|
cmake \
|
||||||
|
gettext \
|
||||||
|
libcurl4-openssl-dev \
|
||||||
|
libdeflate-dev \
|
||||||
|
libevent-dev \
|
||||||
|
libfmt-dev \
|
||||||
|
libminiupnpc-dev \
|
||||||
|
libnatpmp-dev \
|
||||||
|
libpsl-dev \
|
||||||
|
libssl-dev \
|
||||||
|
ninja-build \
|
||||||
|
npm
|
||||||
|
- name: Get Source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
path: src
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cmake \
|
||||||
|
-S src \
|
||||||
|
-B obj \
|
||||||
|
-G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DCMAKE_CXX_COMPILER='clang++' \
|
||||||
|
-DCMAKE_C_COMPILER='clang' \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=pfx \
|
||||||
|
-DRUN_CLANG_TIDY=ON
|
||||||
|
- name: Make
|
||||||
|
run: cmake --build obj --config Debug --target libtransmission.a 2>&1 | tee makelog
|
||||||
|
- name: Test for warnings
|
||||||
|
run: |
|
||||||
|
if grep 'warning:' makelog; then exit 1; fi
|
||||||
|
|
||||||
macos-11:
|
macos-11:
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
needs: [ what-to-make ]
|
needs: [ what-to-make ]
|
||||||
|
|
|
@ -853,7 +853,7 @@ void initField(tr_torrent const* const tor, tr_stat const* const st, tr_variant*
|
||||||
tr_variantInitList(initme, n);
|
tr_variantInitList(initme, n);
|
||||||
for (tr_file_index_t i = 0; i < n; ++i)
|
for (tr_file_index_t i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
tr_variantListAddInt(initme, tr_torrentFile(tor, i).wanted);
|
tr_variantListAddInt(initme, tr_torrentFile(tor, i).wanted ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2429,14 +2429,14 @@ size_t tr_torrentFindFileToBuf(tr_torrent const* tor, tr_file_index_t file_num,
|
||||||
return tr_strvToBuf(tr_torrentFindFile(tor, file_num), buf, buflen);
|
return tr_strvToBuf(tr_torrentFindFile(tor, file_num), buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tr_torrent::setDownloadDir(std::string_view path, bool isNewTorrent)
|
void tr_torrent::setDownloadDir(std::string_view path, bool is_new_torrent)
|
||||||
{
|
{
|
||||||
download_dir = path;
|
download_dir = path;
|
||||||
markEdited();
|
markEdited();
|
||||||
setDirty();
|
setDirty();
|
||||||
refreshCurrentDir();
|
refreshCurrentDir();
|
||||||
|
|
||||||
if (isNewTorrent)
|
if (is_new_torrent)
|
||||||
{
|
{
|
||||||
if (session->shouldFullyVerifyAddedTorrents() || !torrent_init_helpers::isNewTorrentASeed(this))
|
if (session->shouldFullyVerifyAddedTorrents() || !torrent_init_helpers::isNewTorrentASeed(this))
|
||||||
{
|
{
|
||||||
|
|
|
@ -582,7 +582,7 @@ public:
|
||||||
this->error_string = errmsg;
|
this->error_string = errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDownloadDir(std::string_view path, bool isNewTorrent = false);
|
void setDownloadDir(std::string_view path, bool is_new_torrent = false);
|
||||||
|
|
||||||
void refreshCurrentDir();
|
void refreshCurrentDir();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue