Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --verify option to verilog-formatter. #2062

Merged
merged 8 commits into from
Dec 23, 2023

Conversation

kbrunham-intel
Copy link
Contributor

@kbrunham-intel kbrunham-intel commented Dec 20, 2023

Adds a --verify option to verilog-formatter.

This change is inspired by similar options on many other formatting tools to allow a check of any formatting required and then return a non-zero error code if the file would be formatted. This allows the tool with the --verify option to be easily integrated into CICD style-check flows that ensure all source files are formatted correctly.

This change includes 2 tests for this new option.

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (e76f7fc) 92.95% compared to head (7bed532) 92.95%.

Files Patch % Lines
verilog/tools/formatter/verilog_format.cc 82.60% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2062   +/-   ##
=======================================
  Coverage   92.95%   92.95%           
=======================================
  Files         357      357           
  Lines       26412    26424   +12     
=======================================
+ Hits        24550    24562   +12     
  Misses       1862     1862           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@hzeller hzeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this is a good idea! Just a few comments.

verilog/tools/formatter/verilog_format.cc Outdated Show resolved Hide resolved
verilog/tools/formatter/verilog_format.cc Outdated Show resolved Hide resolved
verilog/tools/formatter/verilog_format.cc Outdated Show resolved Hide resolved
verilog/tools/formatter/verilog_format.cc Outdated Show resolved Hide resolved
verilog/tools/formatter/verilog_format.cc Outdated Show resolved Hide resolved
@hzeller hzeller requested a review from fangism December 21, 2023 11:14
@hzeller
Copy link
Collaborator

hzeller commented Dec 21, 2023

To fix the formatting complaints of the VerifyFormatting CI action, run .github/bin/run-clang-format.sh

@kbrunham-intel kbrunham-intel changed the title Added --check option to verilog-formatter. Added --verify option to verilog-formatter. Dec 21, 2023
Copy link
Collaborator

@fangism fangism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this beats writing to a temporary file and then comparing.

@kbrunham-intel
Copy link
Contributor Author

@hzeller : Have I met all your expectations based on the code review? If so, please also approve.

I don't have write access to this repo, so I will also need you to merge it.

@hzeller hzeller merged commit 9cb4509 into chipsalliance:master Dec 23, 2023
30 of 31 checks passed
@hzeller
Copy link
Collaborator

hzeller commented Dec 23, 2023

Thanks, merged!

@kbrunham-intel kbrunham-intel deleted the feat/add_dryrun_option branch December 23, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants