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
Use more comprehensive auto-formatting tools for Python and C #384
Conversation
fa05410
to
0baf148
Compare
On Fedora, Podman is better-supported and has support for CGroupsV2. Fall back to Docker if it is unavailable (such as in the CI environment). Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
0baf148
to
bec0c6a
Compare
@@ -55,16 +71,16 @@ function mmd_run_docker_tests { | |||
$SCRIPT_DIR/$MMD_OS/Dockerfile.deps.tmpl > $SCRIPT_DIR/$MMD_OS/Dockerfile.deps.$MMD_RELEASE | |||
sed -e "s/@RELEASE@/$MMD_OS:$MMD_RELEASE/" $SCRIPT_DIR/$MMD_OS/Dockerfile.tmpl > $SCRIPT_DIR/$MMD_OS/Dockerfile-$MMD_RELEASE | |||
|
|||
sudo docker build \ | |||
$MMD_BUILDAH \ |
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.
Based on travis failure, is sudo
still needed here and below?
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.
Yeah, sudo is needed for docker
but not podman
. I'll fix that up. Thanks.
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.
Though that failure is actually different; I was relying on /dev/zero not having the executable flag, but apparently on Ubuntu (where the tests are kicked off), it does... 🤦♂️
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.
Nope, that was wrong. I was just missing a variable. I think I will still try to find a less "clever" way of doing this, though.
bec0c6a
to
a07f74f
Compare
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.
This looks great to me. Just one small doc fixup request.
Now if we can just figure out what valgrind is complaining about. (I suppose re-ordering the includes could cause something odd to happen.)
@@ -109,7 +109,7 @@ modulemd_subdocument_info_get_mdversion (ModulemdSubdocumentInfo *self); | |||
*/ | |||
void | |||
modulemd_subdocument_info_set_yaml (ModulemdSubdocumentInfo *self, | |||
const gchar *contents); | |||
const gchar *yaml); |
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.
It looks like my feedback on the first version of this PR got lost...
The naming of the second parameter name should be consistent across the gtk-doc, function declaration, and function implementation. Either change @contents
to @yaml
in the doc above, or vice versa here and in the .c
file.
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.
Yeah, not sure how that happened.
modulemd/clang_simple_version.sh
Outdated
@@ -0,0 +1,4 @@ | |||
#!/usr/bin/sh | |||
|
|||
$1 --version | awk -F 'LLVM version' '{print $2}' - | awk '{print $1}' |
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.
$1 --version | awk -F 'LLVM version' '{print $2}' - | awk '{print $1}' | |
$1 --version | awk '/LLVM version/ {print $NF}' - |
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.
Nice trick. I'll use that.
modulemd/modulemd-module-stream.c
Outdated
updated_stream = modulemd_module_stream_upgrade_to_v2 ( | ||
current_stream, &nested_error); | ||
updated_stream = | ||
modulemd_module_stream_upgrade_to_v2 (current_stream); | ||
if (!updated_stream) | ||
{ | ||
g_propagate_error (error, g_steal_pointer (&nested_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.
Hmmm. Since nested_error
was dropped as a parameter to modulemd_module_stream_upgrade_to_v2()
, there isn't (and never was) an nested error to propagate here.
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.
Now if we can just figure out what valgrind is complaining about. (I suppose re-ordering the includes could cause something odd to happen.)
Valgrind is choking on the dup()
to fcntl()
change. I'm trying to figure out why, but if it takes much longer I may just disable that check.
When run under valgrind, fcntl(fd, F_DUPFD_CLOEXEC)
returns -1
and EINVAL
. Which according to fcntl(2)
means "the kernel does not recognize this value". (Since valgrind overrides fcntl() so it can track resources, it seems like it may be a bug in valgrind itself.)
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.
The issue is that the clang-tidy conversion isn't actually safe. It needs to have a third argument, zero. I've fixed that and it seems to work now.
a07f74f
to
bccd2ff
Compare
This syntax guarantees that the file descriptor is closed on exec() Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
bccd2ff
to
c0ae949
Compare
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
https://black.readthedocs.io Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
c0ae949
to
ebaf12b
Compare
I think I've finally worked the bugs out of this PR. Hopefully the CI will pass this time... |
And it looks like CI is passing finally! |
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.
Sorry, I should have noticed the missing third argument to fcntl()
.
All looks good to me now! Thanks for all that clean-up.
These patches switch our tests from running autopep8 to running black instead. This autoformatter includes some niceties as enforcing the same style of quotes everywhere and does a better job of aligning on the column boundaries.
They also add support for using
clang-tidy
instead ofclang-format
on systems with at least version 9.0.0 ofclang-tidy
.I separated the patches that update all of the syntax from the patch that adds the auto-formatters to make review simpler.
I also noticed that .pyc and .pyo files weren't included in .gitignore while working on this, so there's a patch for that as well.
These patches are built atop #383 because that PR includes some fixes that clang-tidy revealed were needed.