Skip to content

Commit

Permalink
Merge pull request #18687 from Chocobo1/codeql
Browse files Browse the repository at this point in the history
GHA CI: add CodeQL scanning
  • Loading branch information
Chocobo1 authored Mar 15, 2023
2 parents 0bb0829 + fa30b70 commit f16e903
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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" \
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/ci_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: [pull_request, push]

permissions:
actions: write
security-events: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -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" \
Expand All @@ -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" \
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/ci_webui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 changes: 14 additions & 0 deletions .github/workflows/helper/codeql/cpp.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions .github/workflows/helper/codeql/js.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 1 deletion src/webui/www/private/rename_files.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/webui/www/private/scripts/piecesbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ window.qBittorrent.PiecesBar = (() => {
}

function refresh(force) {
const start = Date.now();
if (!this.parentNode)
return;

Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/prop-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit f16e903

Please sign in to comment.