Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Sagan committed May 15, 2021
1 parent 9d2e26d commit 198b208
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 4 additions & 7 deletions verilog/analysis/verilog_linter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <memory>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -334,19 +333,17 @@ absl::Status PrintRuleInfo(std::ostream* os,
return absl::OkStatus();
}

static void appendCitation(CustomCitationMap& citations,
absl::string_view rule_raw) {
static void AppendCitation(CustomCitationMap& citations,
const absl::string_view& rule_raw) {
const size_t eq_pos = rule_raw.find(':');
if (!eq_pos || eq_pos == absl::string_view::npos) return;
const size_t rule_id_end = eq_pos;
const size_t rule_citation_beg = eq_pos + 1;
absl::string_view rule_id = rule_raw.substr(0, rule_id_end);
absl::string_view citation =
rule_raw.substr(rule_citation_beg, rule_raw.size() - rule_citation_beg);
std::string filtered_citation =
absl::StrReplaceAll(citation, {{"\\\n", "\n"}});

citations[rule_id] = std::move(filtered_citation);
citations[rule_id] = absl::StrReplaceAll(citation, {{"\\\n", "\n"}});
}

CustomCitationMap ParseCitations(absl::string_view text) {
Expand All @@ -359,7 +356,7 @@ CustomCitationMap ParseCitations(absl::string_view text) {
continue;
}
auto rule_subs = text.substr(rule_begin, rule_end - rule_begin);
appendCitation(citations, rule_subs);
AppendCitation(citations, rule_subs);
rule_begin = rule_end + 1;
rule_end = text.find('\n', rule_begin);
}
Expand Down
16 changes: 16 additions & 0 deletions verilog/tools/lint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ Additionally, the `--rules_config` flag can be used to read configuration stored
in a file. The syntax is the same as above, except the rules can be also
separated with the newline character.

## Custom citations

The `--lint_rule_citations` flag allows to load custom description for specified rules.
It accepts the path to file with prepared configuration.
The file should contain the rule set with appropriate description.
The rules are separeted with newline sign. When new lines are desired, just escape them with `\` sign.

### Example file configuration:

```
struct-union-name-style:multi\
line\
example
signal-name-style:single line example
```

## Waiving Lint Violations {#lint-waiver}

### In-file waiver comments
Expand Down

0 comments on commit 198b208

Please sign in to comment.