-
Notifications
You must be signed in to change notification settings - Fork 15
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
Unconditionally format generated code but in CI #1085
Conversation
Rely on utility `cmake/hpc-coding-conventions/bin/format`
0e5cd27
to
d41d501
Compare
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1085 +/- ##
===========================================
+ Coverage 70.18% 88.61% +18.42%
===========================================
Files 188 169 -19
Lines 25627 12474 -13153
===========================================
- Hits 17987 11054 -6933
+ Misses 7640 1420 -6220 ☔ View full report in Codecov by Sentry. |
Logfiles from GitLab pipeline #157028 (:white_check_mark:) have been uploaded here! Status and direct links: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just few clarification questions otherwise LGTM
@@ -25,14 +24,20 @@ | |||
|
|||
LOGGING_FORMAT = "%(levelname)s:%(name)s: %(message)s" | |||
LOGGER = logging.getLogger("NMODLCodeGen") | |||
CLANG_FORMAT_EXECUTABLE = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pure nitpick: it's not really aclang-format
executable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLANG_FORMAT_COMMAND
then :)
@property | ||
def within_ci(self): | ||
"""Return True if code is running in a continuous-integration environment, else otherwise""" | ||
for varname in ["CI", "CI_PIPELINE_ID", "AZURE_ENV_NAME"]: | ||
if varname in os.environ: | ||
return True | ||
return False | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering why we need it i.e. what happens if the files are formatted in CI as well? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to understand this but couldn't quite figure it out from looking at our current CMake files and CI scripts...
if self.language == "c++" and self.app.clang_format: | ||
LOGGER.debug("Formatting C++ file %s", str(file)) | ||
subprocess.check_call(self.app.clang_format + ["-i", str(file)]) | ||
if self.language == "c++" and not self.app.within_ci: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A clarification question: if user doesn't have "compatible" clang format installed on his/her machine, what happens in this case? .i.e. if there is no clang-format installed or of a different version than we support, user will still be able to build the nmodl without any error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is taken care of from within the coding convention tool that wraps clang-format?
Rely on utility
cmake/hpc-coding-conventions/bin/format