Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/run-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,37 +182,31 @@ jobs:
run: uvx nox -s test -- --profile ci

- name: Install clang v19
if: runner.os == 'Linux'
uses: ./.github/install-clang-action
with:
version: '19'

- name: Collect Coverage for clang v19
if: runner.os == 'Linux'
env:
CLANG_VERSION: '19'
run: uvx nox -s test -- --profile ci

- name: Install clang v20
if: runner.os == 'Linux'
uses: ./.github/install-clang-action
with:
version: '20'

- name: Collect Coverage for clang v20
if: runner.os == 'Linux'
env:
CLANG_VERSION: '20'
run: uvx nox -s test -- --profile ci

- name: Install clang v21
if: runner.os == 'Linux'
uses: ./.github/install-clang-action
with:
version: '21'

- name: Collect Coverage for clang v21
if: runner.os == 'Linux'
env:
CLANG_VERSION: '21'
run: uvx nox -s test -- --profile all
Expand Down
16 changes: 10 additions & 6 deletions cpp-linter/src/clang_tools/clang_tidy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ impl MakeSuggestions for TidyAdvice {
}
}

/// A regex pattern to capture the clang-tidy note header.
const NOTE_HEADER: &str = r"^(.+):(\d+):(\d+):\s(\w+):(.*)\[([a-zA-Z\d\-\.]+),?[^\]]*\]$";

/// Parses clang-tidy stdout.
///
/// Here it helps to have the JSON database deserialized for normalizing paths present
Expand All @@ -138,7 +141,7 @@ fn parse_tidy_output(
tidy_stdout: &[u8],
database_json: &Option<Vec<CompilationUnit>>,
) -> Result<TidyAdvice> {
let note_header = Regex::new(r"^(.+):(\d+):(\d+):\s(\w+):(.*)\[([a-zA-Z\d\-\.]+)\]$").unwrap();
let note_header = Regex::new(NOTE_HEADER).unwrap();
let fixed_note =
Regex::new(r"^.+:(\d+):\d+:\snote: FIX-IT applied suggested code changes$").unwrap();
let mut found_fix = false;
Expand Down Expand Up @@ -354,8 +357,7 @@ mod test {
common_fs::FileObj,
};

use super::run_clang_tidy;
use super::TidyNotification;
use super::{run_clang_tidy, TidyNotification, NOTE_HEADER};

#[test]
fn clang_diagnostic_link() {
Expand Down Expand Up @@ -397,13 +399,15 @@ mod test {

#[test]
fn test_capture() {
let src = "tests/demo/demo.hpp:11:11: warning: use a trailing return type for this function [modernize-use-trailing-return-type]";
let pat = Regex::new(r"^(.+):(\d+):(\d+):\s(\w+):(.*)\[([a-zA-Z\d\-\.]+)\]$").unwrap();
let src = "tests/demo/demo.hpp:11:11: \
warning: use a trailing return type for this function \
[modernize-use-trailing-return-type,-warnings-as-errors]";
let pat = Regex::new(NOTE_HEADER).unwrap();
let cap = pat.captures(src).unwrap();
assert_eq!(
cap.get(0).unwrap().as_str(),
format!(
"{}:{}:{}: {}:{}[{}]",
"{}:{}:{}: {}:{}[{},-warnings-as-errors]",
cap.get(1).unwrap().as_str(),
cap.get(2).unwrap().as_str(),
cap.get(3).unwrap().as_str(),
Expand Down
2 changes: 1 addition & 1 deletion cpp-linter/tests/demo/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*'
WarningsAsErrors: ''
WarningsAsErrors: '*'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: 'file'
Expand Down
Loading