style: Use any
or all
instead of for
loop (SIM110) (#4404)
#9200
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CodeQL | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- '**/*.html' | |
- '**/*.md' | |
- '**/*.txt' | |
schedule: | |
# Check every Saturday at 18:36 | |
- cron: 36 18 * * 6 | |
permissions: {} | |
jobs: | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-22.04 | |
permissions: | |
security-events: write | |
actions: read | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
language: | |
- c-cpp | |
- python | |
concurrency: | |
group: ${{ github.workflow }}-${{ | |
github.event_name == 'pull_request' && | |
github.head_ref || github.sha }}-${{ matrix.language }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up Python | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: '3.x' | |
- name: Install non-Python dependencies | |
if: ${{ matrix.language == 'c-cpp' }} | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y wget git gawk findutils | |
xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ | |
sudo apt-get install -y --no-install-recommends --no-install-suggests | |
- uses: rui314/setup-mold@0bf4f07ef9048ec62a45f9dbf2f098afa49695f0 # v1 | |
if: ${{ matrix.language == 'c-cpp' }} | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 | |
with: | |
languages: ${{ matrix.language }} | |
config-file: ./.github/codeql/codeql-config.yml | |
- name: Create installation directory | |
run: | | |
mkdir "${HOME}/install" | |
- name: Set LD_LIBRARY_PATH for compilation | |
run: | | |
echo "LD_LIBRARY_PATH=${HOME}/install/lib" >> $GITHUB_ENV | |
- name: Set number of cores for compilation | |
run: | | |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV | |
- name: Build | |
if: ${{ matrix.language == 'c-cpp' }} | |
env: | |
CFLAGS: -std=gnu11 | |
CXXFLAGS: -std=c++11 | |
run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install" | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 | |
with: | |
category: "/language:${{matrix.language}}" |