Skip to content

Commit 7ccedff

Browse files
authored
Merge pull request #12 from cloudfunnels/copilot/fix-build-and-deploy-pipeline
Fix GitHub Actions pipeline failures across CI, docs, and release workflows
2 parents 796466b + c51ac49 commit 7ccedff

File tree

13 files changed

+617
-200
lines changed

13 files changed

+617
-200
lines changed

.github/mlc_config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
},
66
{
77
"pattern": "^https://localhost"
8+
},
9+
{
10+
"pattern": "^https://crates\\.io/crates/rust-guardian"
11+
},
12+
{
13+
"pattern": "^https://crates\\.io/me"
14+
},
15+
{
16+
"pattern": "^https://crates\\.io/$"
17+
},
18+
{
19+
"pattern": "^CONTRIBUTING\\.md$"
820
}
921
],
1022
"replacementPatterns": [],

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ jobs:
114114
uses: dtolnay/rust-toolchain@nightly
115115

116116
- name: Install minimal-versions
117-
run: cargo install cargo-minimal-versions
117+
run: |
118+
cargo install cargo-minimal-versions
119+
cargo install cargo-hack
118120
119121
- name: Check minimal versions
120122
run: cargo minimal-versions check

CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing to Rust Guardian
2+
3+
Thank you for your interest in contributing to Rust Guardian!
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/rust-guardian.git`
9+
3. Create a new branch: `git checkout -b feature/your-feature-name`
10+
11+
## Development Setup
12+
13+
### Prerequisites
14+
15+
- Rust 1.70 or higher
16+
- Cargo (comes with Rust)
17+
18+
### Building
19+
20+
```bash
21+
cargo build
22+
```
23+
24+
### Running Tests
25+
26+
```bash
27+
cargo test
28+
```
29+
30+
### Running Locally
31+
32+
```bash
33+
cargo run -- check src/
34+
```
35+
36+
## Code Quality
37+
38+
Before submitting a pull request, make sure your code:
39+
40+
1. Passes all tests: `cargo test`
41+
2. Passes clippy checks: `cargo clippy --all-targets --all-features -- -D warnings`
42+
3. Is properly formatted: `cargo fmt --all -- --check`
43+
44+
## Submitting Changes
45+
46+
1. Commit your changes with clear, descriptive commit messages
47+
2. Push to your fork
48+
3. Create a pull request against the `main` branch
49+
4. Describe your changes in the PR description
50+
51+
## Questions?
52+
53+
If you have questions, please open an issue on GitHub.
54+
55+
## License
56+
57+
By contributing to Rust Guardian, you agree that your contributions will be licensed under the MIT License.

src/analyzer/mod.rs

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ impl Analyzer {
7373
}
7474

7575
let effective_severity = config.effective_severity(category, rule);
76-
pattern_engine.add_rule(rule, effective_severity).map_err(|e| {
77-
GuardianError::config(format!(
78-
"Failed to add rule '{}' in category '{}': {}",
79-
rule.id, category_name, e
80-
))
81-
})?;
76+
pattern_engine
77+
.add_rule(rule, effective_severity)
78+
.map_err(|e| {
79+
GuardianError::config(format!(
80+
"Failed to add rule '{}' in category '{}': {}",
81+
rule.id, category_name, e
82+
))
83+
})?;
8284
}
8385
}
8486

@@ -92,7 +94,12 @@ impl Analyzer {
9294
let path_filter = PathFilter::new(config.paths.patterns.clone(), ignore_file)
9395
.map_err(|e| GuardianError::config(format!("Failed to create path filter: {e}")))?;
9496

95-
Ok(Self { config, pattern_engine, path_filter, rust_analyzer: RustAnalyzer::new() })
97+
Ok(Self {
98+
config,
99+
pattern_engine,
100+
path_filter,
101+
rust_analyzer: RustAnalyzer::new(),
102+
})
96103
}
97104

98105
/// Create an analyzer with default configuration
@@ -120,23 +127,29 @@ impl Analyzer {
120127
let mut all_violations = Vec::new();
121128

122129
// Apply pattern matching
123-
let matches = self.pattern_engine.analyze_file(file_path, &content).map_err(|e| {
124-
GuardianError::analysis(
125-
file_path.display().to_string(),
126-
format!("Pattern analysis failed: {e}"),
127-
)
128-
})?;
130+
let matches = self
131+
.pattern_engine
132+
.analyze_file(file_path, &content)
133+
.map_err(|e| {
134+
GuardianError::analysis(
135+
file_path.display().to_string(),
136+
format!("Pattern analysis failed: {e}"),
137+
)
138+
})?;
129139

130140
all_violations.extend(self.pattern_engine.matches_to_violations(matches));
131141

132142
// Apply Rust-specific analysis for .rs files
133143
if self.rust_analyzer.handles_file(file_path) {
134-
let rust_violations = self.rust_analyzer.analyze(file_path, &content).map_err(|e| {
135-
GuardianError::analysis(
136-
file_path.display().to_string(),
137-
format!("Rust analysis failed: {e}"),
138-
)
139-
})?;
144+
let rust_violations = self
145+
.rust_analyzer
146+
.analyze(file_path, &content)
147+
.map_err(|e| {
148+
GuardianError::analysis(
149+
file_path.display().to_string(),
150+
format!("Rust analysis failed: {e}"),
151+
)
152+
})?;
140153
all_violations.extend(rust_violations);
141154
}
142155

@@ -238,18 +251,20 @@ impl Analyzer {
238251
let violations = Arc::new(Mutex::new(Vec::new()));
239252
let errors = Arc::new(Mutex::new(Vec::new()));
240253

241-
files.par_iter().for_each(|file_path| match self.analyze_file(file_path) {
242-
Ok(file_violations) => {
243-
if let Ok(mut v) = violations.lock() {
244-
v.extend(file_violations);
254+
files
255+
.par_iter()
256+
.for_each(|file_path| match self.analyze_file(file_path) {
257+
Ok(file_violations) => {
258+
if let Ok(mut v) = violations.lock() {
259+
v.extend(file_violations);
260+
}
245261
}
246-
}
247-
Err(e) => {
248-
if let Ok(mut errs) = errors.lock() {
249-
errs.push((file_path.clone(), e));
262+
Err(e) => {
263+
if let Ok(mut errs) = errors.lock() {
264+
errs.push((file_path.clone(), e));
265+
}
250266
}
251-
}
252-
});
267+
});
253268

254269
// Handle errors
255270
let errors = Arc::try_unwrap(errors)
@@ -548,14 +563,20 @@ impl Analyzer {
548563
})?;
549564

550565
// Test max_files limitation
551-
let options = AnalysisOptions { max_files: Some(1), ..Default::default() };
566+
let options = AnalysisOptions {
567+
max_files: Some(1),
568+
..Default::default()
569+
};
552570

553571
let report = self.analyze_directory(root, &options)?;
554572

555573
if report.summary.total_files != 1 {
556574
return Err(GuardianError::analysis(
557575
"validation".to_string(),
558-
format!("Expected 1 file with max_files=1, got {}", report.summary.total_files),
576+
format!(
577+
"Expected 1 file with max_files=1, got {}",
578+
report.summary.total_files
579+
),
559580
));
560581
}
561582

0 commit comments

Comments
 (0)