Skip to content

Commit

Permalink
improve regex pattern that captures version number
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
2bndy5 and coderabbitai[bot] authored Nov 23, 2024
1 parent 4c4f20a commit ddccd00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp-linter/src/clang_tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub struct ClangVersions {
fn capture_clang_version(clang_tool: &PathBuf) -> Result<String> {
let output = Command::new(clang_tool).arg("--version").output()?;
let stdout = String::from_utf8_lossy(&output.stdout);
let version_pattern = Regex::new(r"version\s*(\d+\.\d+\.\d+)").unwrap();
let version_pattern = Regex::new(r"(?i)version\s*([\d.]+)").unwrap();
let captures = version_pattern.captures(&stdout).ok_or(anyhow!(
"Failed to find version number in `{} --version` output",
clang_tool.to_string_lossy()
Expand Down

0 comments on commit ddccd00

Please sign in to comment.