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

Finish updating CTS to pass pylint and pyflake #3820

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

clumens
Copy link
Contributor

@clumens clumens commented Feb 5, 2025

I originally also wanted to include pylint and pyflake as part of "make check", but then I'd have to BuildRequires them and I don't think we want to do that (I haven't checked, but those tools may not be in all supported OSes).

Copy link
Contributor

@nrwahl2 nrwahl2 left a comment

Choose a reason for hiding this comment

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

Looking good.

I didn't look closely at the "drop make_test_group" commit. You and I have talked about other possible approaches in Slack, so it's not worth the tedium of review until we've settled on one.

@clumens
Copy link
Contributor Author

clumens commented Feb 10, 2025

This PR is already too big. I'm going to split it into one that's everything before dealing with make_test_group, and another that's that and everything after it.

@clumens clumens added the review: in progress PRs that are currently being reviewed label Feb 11, 2025
Just like everything else in cts/, we need to tell pylint to not worry
about import order, file names, or comparisons at the top of the file.
A bunch of these strings are giant anyway and run well past the 80
character mark.  Several were still continued onto a second line even
though none of them are the longest description.  So just condense them
into single lines.
This is just the standard technique of inverting conditionals in order
to return early, and then unindenting all the code after the
conditional.
This is just referenced in one spot, there's no need to have it be a
variable.
Fixing this is a larger problem than is addressable in this patch set -
it requires rethinking how cts-scheduler is put together, which I don't
want to work on at the moment.  In the interest of running pylint and
pyflake as part of the CI process without failing every build, I'm
disabling this warning for now.
Yes, we know there's a lot of duplicate code in some of our regression
test tools.  In the interest of running pylint and pyflake as part of
the CI process without failing every build, I'm disabling this warning
for now.
This is a list of generated python scripts that can have pylint and
pyflake run against them.  It exists because we were working on these
scripts one at a time, and I didn't want to overwhelm the results with
tons of errors from scripts we hadn't gotten around to yet.

The problem with this is that sometimes, we forget to add scripts to the
list.  That's the case with cts-cli, which is why it still needs to be
converted to using f-strings.

When we convert cts-schemas to python, this can all go away and we can
use test_SCRIPTS instead.
The string substitutions I was doing with s.format() through the
apply_substitutions function won't work once we move to f-strings.  I
don't think that function is doing anything special, however, so we can
just get rid one substitution it's performing at a time.

This removes all uses of {shadow} that don't occur in a string with some
other substitution.
Just like the previous commit, there's still places where we can't
completely switch over to f-strings for performing this substition, so
it has to stay in the apply_substitutions function for now.

However, there are several places we no longer need to call that
function because the only thing we were substituting was cts_cli_home.

Additionally, test_home wasn't being substituted anywhere so it can go.
@clumens
Copy link
Contributor Author

clumens commented Feb 17, 2025

Updated to address review comments, including a new patch at the end to deal with extra whitespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review: in progress PRs that are currently being reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants