Skip to content

Commit ed254b2

Browse files
author
Thomas Heuschling
committed
Merge recent commits from master
2 parents 152ff6a + 15d7ccb commit ed254b2

8 files changed

Lines changed: 45 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
--variable=colorlinks
4343
--variable=papersize:a4
4444
-o svlint_MANUAL_${{github.ref_name}}.pdf
45-
- uses: actions/upload-artifact@v3
45+
- uses: actions/upload-artifact@v4
4646
with:
4747
name: pdf
4848
path: svlint_MANUAL_${{github.ref_name}}.pdf

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Change Log
22

3-
## [Unreleased](https://github.com/dalance/svlint/compare/v0.9.3...Unreleased) - ReleaseDate
3+
## [Unreleased](https://github.com/dalance/svlint/compare/v0.9.4...Unreleased) - ReleaseDate
4+
5+
## [v0.9.4](https://github.com/dalance/svlint/compare/v0.9.3...v0.9.4) - 2025-09-11
6+
7+
* [Changed] Ignore compiler directive if commented in style_directives [#308](https://github.com/dalance/svlint/pull/308)
8+
* [Added] Add rule to prevent mixing operators with confusing precedence [#301](https://github.com/dalance/svlint/pull/301)
9+
* [Fixed] Fix crash in style_keyword_0or1space [#300](https://github.com/dalance/svlint/pull/300)
10+
* [Added] feat: add style_keyword_1spaceornewline rule [#297](https://github.com/dalance/svlint/pull/297)
11+
* [Added] feat: add support for file encoding detection [#294](https://github.com/dalance/svlint/pull/294)
412

513
## [v0.9.3](https://github.com/dalance/svlint/compare/v0.9.2...v0.9.3) - 2024-06-03
614

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "svlint"
3-
version = "0.9.3"
3+
version = "0.9.4"
44
authors = ["dalance@gmail.com"]
55
repository = "https://github.com/dalance/svlint"
66
keywords = ["SystemVerilog", "Verilog", "lint", "svls"]

MANUAL.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ Compiler directives should not cause whitespace issues or hide in other code.
408408
`resetall
409409
/* This FILE is `__FILE__ */
410410
/* This LINE is `__LINE__ */
411+
// This directive is commented `celldefine
412+
module testmodule(); //Those directives are also commented `ifdef FOO Foo `else Bar `endif
413+
endmodule
411414
`include "testcases/syntaxrules/pass/blocking_assignment_in_always_ff.sv"
412415
`define FOO 5
413416
`ifdef FOO
@@ -418,17 +421,18 @@ Compiler directives should not cause whitespace issues or hide in other code.
418421
`endif
419422
`undef FOO
420423
`undefineall
421-
424+
`ifdef FOO // `ifdef BAR
425+
`endif
422426
```
423427

424-
### Fail Example (1 of 3)
428+
### Fail Example (1 of 4)
425429
```systemverilog
426430
module `ifdef FOO Foo `else Bar `endif
427431
(); // ifdef, else, and endif are on a single line.
428432
endmodule
429433
```
430434

431-
### Fail Example (2 of 3)
435+
### Fail Example (2 of 4)
432436
```systemverilog
433437
`ifdef FOO
434438
`ifdef BAR
@@ -439,7 +443,7 @@ endmodule
439443
`endif
440444
```
441445

442-
### Fail Example (3 of 3)
446+
### Fail Example (3 of 4)
443447
```systemverilog
444448
module M ();
445449
always_comb
@@ -455,6 +459,12 @@ module M ();
455459
endmodule
456460
```
457461

462+
### Fail Example (4 of 4)
463+
```systemverilog
464+
`ifdef FOO // The ifdef is not commented and indented
465+
`endif
466+
```
467+
458468
### Explanation
459469

460470
Check that (most) preprocessor and compiler directives are not indented, and

snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: svlint
2-
version: &version v0.9.3
2+
version: &version v0.9.4
33
summary: SystemVerilog linter
44
description: |
55
A lint checker supporting SystemVerilog ( IEEE Std. 1800-2017 )

src/textrules/style_directives.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use regex::Regex;
55
#[derive(Default)]
66
pub struct StyleDirectives {
77
re: Option<Regex>,
8+
re_comment: Option<Regex>,
89
}
910

1011
impl TextRule for StyleDirectives {
@@ -46,20 +47,23 @@ impl TextRule for StyleDirectives {
4647

4748
self.re = Some(Regex::new(format!("^(.+)`({})", keywords).as_str()).unwrap());
4849
}
50+
if self.re_comment.is_none() {
51+
self.re_comment = Some(Regex::new(format!(r"//").as_str()).unwrap());
52+
}
4953
let re = self.re.as_ref().unwrap();
54+
let re_comment = self.re_comment.as_ref().unwrap();
5055

5156
if let Some(caps) = re.captures(line) {
5257
if let Some(m) = caps.get(1) {
53-
TextRuleResult::Fail {
54-
offset: 0,
55-
len: m.as_str().chars().count(),
58+
if !re_comment.is_match(m.as_str()) {
59+
return TextRuleResult::Fail {
60+
offset: 0,
61+
len: m.as_str().chars().count(),
62+
}
5663
}
57-
} else {
58-
TextRuleResult::Pass
5964
}
60-
} else {
61-
TextRuleResult::Pass
6265
}
66+
TextRuleResult::Pass
6367
}
6468

6569
fn name(&self) -> String {

testcases/textrules/fail/style_directives.sv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ module M ();
2222
b = e;
2323
`endif
2424
endmodule
25+
////////////////////////////////////////////////////////////////////////////////
26+
`ifdef FOO // The ifdef is not commented and indented
27+
`endif

testcases/textrules/pass/style_directives.sv

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
`resetall
1313
/* This FILE is `__FILE__ */
1414
/* This LINE is `__LINE__ */
15+
// This directive is commented `celldefine
16+
module testmodule(); //Those directives are also commented `ifdef FOO Foo `else Bar `endif
17+
endmodule
1518
`include "testcases/syntaxrules/pass/blocking_assignment_in_always_ff.sv"
1619
`define FOO 5
1720
`ifdef FOO
@@ -22,4 +25,5 @@
2225
`endif
2326
`undef FOO
2427
`undefineall
25-
28+
`ifdef FOO // `ifdef BAR
29+
`endif

0 commit comments

Comments
 (0)