Browse Source

Merge pull request #18687 from Chocobo1/codeql

GHA CI: add CodeQL scanning
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
f16e903623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/ci_macos.yaml
  2. 17
      .github/workflows/ci_ubuntu.yaml
  3. 12
      .github/workflows/ci_webui.yaml
  4. 14
      .github/workflows/helper/codeql/cpp.yaml
  5. 11
      .github/workflows/helper/codeql/js.yaml
  6. 4
      src/webui/www/private/rename_files.html
  7. 1
      src/webui/www/private/scripts/piecesbar.js
  8. 2
      src/webui/www/private/scripts/prop-files.js

4
.github/workflows/ci_macos.yaml

@ -84,7 +84,7 @@ jobs: @@ -84,7 +84,7 @@ jobs:
sudo cmake --install build
- name: Build qBittorrent (Qt5)
if: ${{ startsWith(matrix.qt_version, 5) }}
if: startsWith(matrix.qt_version, 5)
run: |
CXXFLAGS="$CXXFLAGS -Werror -Wno-error=deprecated-declarations" \
LDFLAGS="$LDFLAGS -gz" \
@ -103,7 +103,7 @@ jobs: @@ -103,7 +103,7 @@ jobs:
cmake --build build --target check
- name: Build qBittorrent (Qt6)
if: ${{ startsWith(matrix.qt_version, 6) }}
if: startsWith(matrix.qt_version, 6)
run: |
CXXFLAGS="$CXXFLAGS -Wno-gnu-zero-variadic-macro-arguments -Werror -Wno-error=deprecated-declarations" \
LDFLAGS="$LDFLAGS -gz" \

17
.github/workflows/ci_ubuntu.yaml

@ -4,6 +4,7 @@ on: [pull_request, push] @@ -4,6 +4,7 @@ on: [pull_request, push]
permissions:
actions: write
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -65,8 +66,16 @@ jobs: @@ -65,8 +66,16 @@ jobs:
cmake --build build
sudo cmake --install build
# to avoid scanning 3rdparty codebases, initialize it just before building qbt
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON') && startsWith(matrix.qt_version, 6)
with:
config-file: ./.github/workflows/helper/codeql/cpp.yaml
languages: cpp
- name: Build qBittorrent (Qt5)
if: ${{ startsWith(matrix.qt_version, 5) }}
if: startsWith(matrix.qt_version, 5)
run: |
CXXFLAGS="$CXXFLAGS -Werror -Wno-error=deprecated-declarations" \
LDFLAGS="$LDFLAGS -gz" \
@ -85,7 +94,7 @@ jobs: @@ -85,7 +94,7 @@ jobs:
DESTDIR="qbittorrent" cmake --install build
- name: Build qBittorrent (Qt6)
if: ${{ startsWith(matrix.qt_version, 6) }}
if: startsWith(matrix.qt_version, 6)
run: |
CXXFLAGS="$CXXFLAGS -Werror" \
LDFLAGS="$LDFLAGS -gz" \
@ -104,6 +113,10 @@ jobs: @@ -104,6 +113,10 @@ jobs:
cmake --build build --target check
DESTDIR="qbittorrent" cmake --install build
- name: Run CodeQL analysis
uses: github/codeql-action/analyze@v2
if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON') && startsWith(matrix.qt_version, 6)
- name: Prepare build artifacts
run: |
mkdir upload

12
.github/workflows/ci_webui.yaml

@ -2,7 +2,8 @@ name: CI - WebUI @@ -2,7 +2,8 @@ name: CI - WebUI
on: [pull_request, push]
permissions: {}
permissions:
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -36,3 +37,12 @@ jobs: @@ -36,3 +37,12 @@ jobs:
run: |
npm run format
git diff --exit-code
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/workflows/helper/codeql/js.yaml
languages: javascript
- name: Run CodeQL analysis
uses: github/codeql-action/analyze@v2

14
.github/workflows/helper/codeql/cpp.yaml

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
name: "CodeQL config for C++"
queries:
- uses: security-and-quality
query-filters:
- exclude:
id: cpp/commented-out-code
- exclude:
id: cpp/include-non-header
- exclude:
id: cpp/loop-variable-changed
- exclude:
id: cpp/useless-expression

11
.github/workflows/helper/codeql/js.yaml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
name: "CodeQL config for Javascript"
paths-ignore:
- "**/lib/*"
queries:
- uses: security-and-quality
query-filters:
- exclude:
id: js/superfluous-trailing-arguments

4
src/webui/www/private/rename_files.html

@ -68,8 +68,10 @@ @@ -68,8 +68,10 @@
}
// Register keyboard events to modal window
// https://github.com/qbittorrent/qBittorrent/pull/18687#discussion_r1135045726
var keyboard;
if (!keyboard) {
var keyboard = new Keyboard({
keyboard = new Keyboard({
defaultEventType: 'keydown',
events: {
'Escape': function(event) {

1
src/webui/www/private/scripts/piecesbar.js

@ -106,7 +106,6 @@ window.qBittorrent.PiecesBar = (() => { @@ -106,7 +106,6 @@ window.qBittorrent.PiecesBar = (() => {
}
function refresh(force) {
const start = Date.now();
if (!this.parentNode)
return;

2
src/webui/www/private/scripts/prop-files.js

@ -564,7 +564,7 @@ window.qBittorrent.PropFiles = (function() { @@ -564,7 +564,7 @@ window.qBittorrent.PropFiles = (function() {
};
const multiFileRename = function(hash) {
const win = new MochaUI.Window({
new MochaUI.Window({
id: 'multiRenamePage',
title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]",
data: { hash: hash, selectedRows: torrentFilesTable.selectedRows },

Loading…
Cancel
Save