Skip to content

Commit

Permalink
Merge pull request #2236 from sconwayaus/fix_konstant_style
Browse files Browse the repository at this point in the history
Fixing naming style for constant expressions
  • Loading branch information
hzeller authored Sep 17, 2024
2 parents 2785d9b + b71988a commit 5046534
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions verilog/analysis/checkers/enum_name_style_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ using verible::LintViolation;
using verible::SyntaxTreeContext;
using verible::matcher::Matcher;

static constexpr absl::string_view style_default_regex = "[a-z_0-9]+(_t|_e)";
static constexpr absl::string_view kDefaultStyleRegex = "[a-z_0-9]+(_t|_e)";

EnumNameStyleRule::EnumNameStyleRule()
: style_regex_(
std::make_unique<re2::RE2>(style_default_regex, re2::RE2::Quiet)) {}
std::make_unique<re2::RE2>(kDefaultStyleRegex, re2::RE2::Quiet)) {}

const LintRuleDescriptor &EnumNameStyleRule::GetDescriptor() {
static const LintRuleDescriptor d{
Expand All @@ -61,7 +61,7 @@ const LintRuleDescriptor &EnumNameStyleRule::GetDescriptor() {
"to "
"https://github.com/chipsalliance/verible/tree/master/verilog/tools/"
"lint#readme for more detail on verible regex patterns.",
.param = {{"style_regex", std::string(style_default_regex),
.param = {{"style_regex", std::string(kDefaultStyleRegex),
"A regex used to check enum type name style."}},
};
return d;
Expand Down
4 changes: 2 additions & 2 deletions verilog/analysis/checkers/package_filename_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ using verible::TextStructureView;
// Register the lint rule
VERILOG_REGISTER_LINT_RULE(PackageFilenameRule);

static constexpr absl::string_view optional_suffix = "_pkg";
static constexpr absl::string_view kOptionalSuffix = "_pkg";

static constexpr absl::string_view kMessage =
"Package declaration name must match the file name "
Expand Down Expand Up @@ -106,7 +106,7 @@ void PackageFilenameRule::Lint(const TextStructureView &text_structure,
GetPackageNameToken(*package_match.match);
if (!package_name_token) continue;
absl::string_view package_id = package_name_token->text();
auto package_id_plus_suffix = absl::StrCat(package_id, optional_suffix);
auto package_id_plus_suffix = absl::StrCat(package_id, kOptionalSuffix);
if ((package_id != unitname) && (package_id_plus_suffix != unitname)) {
violations_.insert(verible::LintViolation(
*package_name_token,
Expand Down
6 changes: 3 additions & 3 deletions verilog/analysis/checkers/signal_name_style_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ using verible::LintViolation;
using verible::SyntaxTreeContext;
using verible::matcher::Matcher;

static constexpr absl::string_view style_default_regex = "[a-z_0-9]+";
static constexpr absl::string_view kDefaultStyleRegex = "[a-z_0-9]+";

SignalNameStyleRule::SignalNameStyleRule()
: style_regex_(
std::make_unique<re2::RE2>(style_default_regex, re2::RE2::Quiet)) {}
std::make_unique<re2::RE2>(kDefaultStyleRegex, re2::RE2::Quiet)) {}

const LintRuleDescriptor &SignalNameStyleRule::GetDescriptor() {
static const LintRuleDescriptor d{
Expand All @@ -65,7 +65,7 @@ const LintRuleDescriptor &SignalNameStyleRule::GetDescriptor() {
"expects \"lower_snake_case\". Refer to "
"https://github.com/chipsalliance/verible/tree/master/verilog/tools/"
"lint#readme for more detail on verible regex patterns.",
.param = {{"style_regex", std::string(style_default_regex),
.param = {{"style_regex", std::string(kDefaultStyleRegex),
"A regex used to check signal names style."}},
};
return d;
Expand Down

0 comments on commit 5046534

Please sign in to comment.