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
9 changes: 9 additions & 0 deletions .github/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
steps:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Install cargo-audit
run: cargo install --locked cargo-audit
- name: Build project
run: cargo build
33 changes: 33 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Quality Gate

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]

jobs:
quality-gate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Install cargo-audit
run: cargo install --locked cargo-audit

- name: Rust format check
run: cargo fmt --check

- name: Rust lint (clippy)
run: cargo clippy -- -D warnings

- name: Rust tests
run: cargo test

- name: Rust security audit
run: cargo audit
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,8 @@ pub fn execute_text_search(
code: "UnsupportedEncoding".to_string(),
message: format!("File is not valid UTF-8: {path}"),
})?;
let mut line_no = 1usize;
let mut line_start = 0usize;
for line in content.split_inclusive('\n') {
for (line_no, line) in (1usize..).zip(content.split_inclusive('\n')) {
for capture in regex.find_iter(line) {
if matches.len() == max_results {
truncated = true;
Expand All @@ -466,7 +465,6 @@ pub fn execute_text_search(
});
}
line_start += line.len();
line_no += 1;
}
}

Expand Down
Loading