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

Centralize perl lint checks #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

josegomezr
Copy link
Contributor

  • Introduced simplified version of tools/perlcritic.

    The perlcritic wrapper provided under tools/perlcritic will resolve itself
    and append the common perl critic policies defined in this repo automatically
    providing a seamless experience.

  • Introduced simplified version tools/tidyall [warning, is breaking].

    This is a full rework of the script to perform the same tidy version detection
    in perl instead of deep bash + sed.

    It'll validate the tidy version and run tidyall afterwards.

    Support for the --force flag is also provided transparently.

    The breaking change comes from the fact that the bash script provided a façade
    over tidyall transforming arguments. This is deleted in favor of the real
    tidyall arguments.

Downstream repositories will inherit this tools through the subrepo pull workflow.

poo#138416

@josegomezr josegomezr force-pushed the unify_perltidy branch 2 times, most recently from 1823dc9 to 4112c8d Compare October 25, 2023 20:11
.perltidyrc Show resolved Hide resolved
josegomezr added a commit to josegomezr/openQA that referenced this pull request Oct 25, 2023
josegomezr added a commit to josegomezr/os-autoinst that referenced this pull request Oct 25, 2023
josegomezr added a commit to josegomezr/os-autoinst that referenced this pull request Oct 25, 2023
josegomezr added a commit to josegomezr/os-autoinst that referenced this pull request Oct 25, 2023
josegomezr added a commit to josegomezr/os-autoinst that referenced this pull request Oct 25, 2023
tools/tidyall Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
@josegomezr josegomezr force-pushed the unify_perltidy branch 4 times, most recently from 0a8ca65 to bb7290a Compare October 26, 2023 16:41
Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

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

well, see the style warnings that you introduced I woul say :)

.github/workflows/perl-prove.yml Outdated Show resolved Hide resolved
t/01-make-update-deps.t Outdated Show resolved Hide resolved
@josegomezr
Copy link
Contributor Author

josegomezr commented Nov 8, 2023

I tried experimenting on annotations for failed tests, but the test infrastructure lacks a lot on controlling the output.

Brute-forcing my way with a GH annotation get's me to a not-so-reliable regex, see it here for the regex and a sample output match:

https://regex101.com/r/9HVPpB/1

The furthest I could get was to get which test failed, in: josegomezr/perl-design-patterns: t/lib/TAP/Formatter/GitHubAction.pm).

I'll backtrack on that one until a simpler solution rises, for now it'll just be a red check when tests fail.

tools/perlcritic Show resolved Hide resolved
tools/update-deps Show resolved Hide resolved
xt/01-make-update-deps.t Outdated Show resolved Hide resolved
@josegomezr josegomezr force-pushed the unify_perltidy branch 3 times, most recently from 9d3d348 to 36b4039 Compare November 8, 2023 15:23
cpanfile Outdated Show resolved Hide resolved
Copy link
Collaborator

@perlpunk perlpunk left a comment

Choose a reason for hiding this comment

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

There are a lot of things I could comment on.
But I think we should discuss how this should be tested and which existing repositories should use which tools already. Not sure what @okurz had in mind.
I think one necessary step for approval is that this is tested on one of our repos. (For example the tools/update-deps doesn't compile with your changes :)

So I would suggest doing a draft PR with this branch as a subrepo:

git subrepo clone --force [email protected]:josegomezr/os-autoinst-common.git external/os-autoinst-common -b unify_perltidy

Comment on lines 12 to 18
runs-on: ubuntu-latest
name: "Perltidy"
container:
image: perldocker/perl-tester:5.26
steps:
- uses: actions/checkout@v4
- run: GITHUB_ACTIONS=1 ./tools/tidyall --check-only --all --quiet
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think with this we would be getting the latest Perl::Tidy that is installed in that container, so people will have to install that version locally. It will not be in sync with https://build.opensuse.org/package/show/devel:openQA:Leap:15.5/perl-Perl-Tidy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is still requiring some love, I have a pending experiment making this image (perl-tester) in OBS with openqa dependencies instead. I think I spotted something like that already there.

.gitignore Outdated Show resolved Hide resolved
cpanfile Show resolved Hide resolved
lib/OpenQA/Test/PatchDeparse.pm Outdated Show resolved Hide resolved
tools/perlcritic Outdated Show resolved Hide resolved
tools/tidyall Outdated Show resolved Hide resolved
tools/tidyall Outdated Show resolved Hide resolved
tools/tidyall Outdated Show resolved Hide resolved
tools/update-deps Outdated Show resolved Hide resolved
tools/tidyall Outdated Show resolved Hide resolved
Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

I guess the last commit should be squashed into the commit that introduced the code.

README.md Outdated Show resolved Hide resolved
lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm Outdated Show resolved Hide resolved
@lkocman
Copy link

lkocman commented Nov 27, 2023

Our perl interpret is inherited from SUSE:SLE-15-SP3:Update. So the right question is whether sles can update it. mlschroe should be able to tell us, we're ahead of beta2 so still possible imho.

@lkocman
Copy link

lkocman commented Nov 27, 2023

https://jira.suse.com/browse/PED-7392

@@ -39,8 +40,7 @@ update_spec();
update_cpanfile($modules_by_target);
update_dockerfile($dockerfile) if $dockerfile;

sub update_dockerfile {
my ($dockerfile) = @_;
sub update_dockerfile ($dockerfile) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I just tried this out in os-autoinst. The script doesn't compile because you still need to enable signatures

@josegomezr
Copy link
Contributor Author

josegomezr commented Dec 6, 2023

Adding a bit more of activity here:

In the PoC on my fork of the example distribution (available here I've:

  • Brought all applicable configs & tooling from this branch.
  • Setup the checks (these are copied because github doesn't tolerate symlinks for security reasons).
  • Fixed the perlcritic warnings.
  • The OpenQA scheduling job has a safeguard to avoid having the test in red when there's no API keys configured.

Addenda:
Bonus:

  • Simplified the GitHub Actions workflows for the isotovideo invocation.
    • Artifacts! It's possible to download test execution results from the isotovideo invocation.
    • And of the repo can customize how to run isotovideo via a matrix config as a means of a simplified scheduling experience.

@okurz
Copy link
Member

okurz commented Dec 7, 2023

@josegomezr it's getting hard to see where we are going overall. I suggest you split out commits from https://github.com/os-autoinst/os-autoinst-common/pull/30/commits into separate PRs that we can get merged and "out of sight" and then rebase here and see what's left.

josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Dec 14, 2023
- Introducing `tools/tidyall` an improved wrapper over perl's
  `tidyall`. It does version detection directly in perl and
  exposes the underlying `tidyall` CLI.

- Adds a complementary GitHub Action to run `tools/tidyall`
  automatically on Pull Requests & Master.

- Brings bare minimum dependencies.yaml for running
  `tools/tidyall`.

  Adjusted `tools/update-deps` to produce a `cpanfile` alone
  (without needing an `.spec` file first).

- Applied tidy rules.

Branched off os-autoinst#30.
@josegomezr josegomezr mentioned this pull request Dec 14, 2023
josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Dec 14, 2023
- Introducing `tools/perlcritic` an improved wrapper over
  perl's `perlcritic`.

  It automatically appends this project's policies that are
  defined under the `openqa` theme.

- Adds a complementary GitHub Action to run `tools/perlcritic`
  automatically on Pull Requests & Master.

- Fixed `perlcritics` complaints.

Branched off os-autoinst#30.
@josegomezr josegomezr mentioned this pull request Dec 14, 2023
@josegomezr
Copy link
Contributor Author

@josegomezr it's getting hard to see where we are going overall. I suggest you split out commits from https://github.com/os-autoinst/os-autoinst-common/pull/30/commits into separate PRs that we can get merged and "out of sight" and then rebase here and see what's left.

#31 & #32 branch off this discussion. Please have a look, they can be merged in isolation. And after that I'll get back this one and finish-off any pending piece.

josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Dec 15, 2023
- Introducing `tools/perlcritic` an improved wrapper over
  perl's `perlcritic`.

  It automatically appends this project's policies that are
  defined under the `openqa` theme.

- Adds a complementary GitHub Action to run `tools/perlcritic`
  automatically on Pull Requests & Master.

- Fixed `perlcritics` complaints.

Branched off os-autoinst#30.

Co-authored-by: Oliver Kurz <[email protected]>
Co-authored-by: Martchus <[email protected]>
josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Dec 15, 2023
- Introducing `tools/perlcritic` an improved wrapper over
  perl's `perlcritic`.

  It automatically appends this project's policies that are
  defined under the `openqa` theme.

- Adds a complementary GitHub Action to run `tools/perlcritic`
  automatically on Pull Requests & Master.

- Fixed `perlcritics` complaints.

Branched off os-autoinst#30.

Co-authored-by: Oliver Kurz <[email protected]>
Co-authored-by: Martchus <[email protected]>
@foursixnine
Copy link
Member

foursixnine commented Jan 12, 2024

@okurz what is needed for this PR to be merged, aside from resolving the coflicts, etc?. I see that there's at least one discussion open, also because looking at the ticket, looks like we're waiting on @os-autoinst/tools-team for all of the related PRs.

And since @josegomezr is back to SCC, I would like to know who is going to take over these changes, since it has taken 3 months, and still can't be closed.

PS: Before @okurz comes saying again that "I'm asking the team to work faster", the answer is no, but it looks that you prefer to make work more complicated that it should, and being in emergency mode all the time doesn't really help.

@okurz
Copy link
Member

okurz commented Jan 12, 2024

@okurz what is needed for this PR to be merged, aside from resolving the coflicts, etc?. I see that there's at least one discussion open, also because looking at the ticket, looks like we're waiting on @os-autoinst/tools-team for all of the related PRs.

I don't really know what's needed as there had been already quite some changes in the related PRs, e.g. #31, so I suggest to rebase first.

And since @josegomezr is back to SCC, I would like to know who is going to take over these changes, since it has taken 3 months, and still can't be closed.

It might fit probably somewhere with https://progress.opensuse.org/issues/108527 but it's better to make that explicit by taking over https://progress.opensuse.org/issues/138416 into the backlog of qe-tools, agreed?

@foursixnine
Copy link
Member

@okurz what is needed for this PR to be merged, aside from resolving the coflicts, etc?. I see that there's at least one discussion open, also because looking at the ticket, looks like we're waiting on @os-autoinst/tools-team for all of the related PRs.

I don't really know what's needed as there had been already quite some changes in the related PRs, e.g. #31, so I suggest to rebase first.

And since @josegomezr is back to SCC, I would like to know who is going to take over these changes, since it has taken 3 months, and still can't be closed.

It might fit probably somewhere with https://progress.opensuse.org/issues/108527 but it's better to make that explicit by taking over https://progress.opensuse.org/issues/138416 into the backlog of qe-tools, agreed?

Sounds like a plan! We can have a chat about the things that are related kind of soonish, and at some other point dig a bit more into https://progress.opensuse.org/issues/108527

@josegomezr
Copy link
Contributor Author

josegomezr commented Jan 14, 2024

You'all can ask me too, I moved team not organizations...

#32 is missing. after it's merged what's pending is:

  • Wording on documentation.
  • Tests on update-deps provided that this very same repo requries a very limited subset of packages (lint rules).

That should serve a good baseline to continue downstreaming the tools in #31 & #32 to os-autoinst & openqa.

psa: I'm very bad with technology...

Copy link
Contributor

mergify bot commented Jan 14, 2024

This pull request is now in conflicts. Could you fix it? 🙏

josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Jan 14, 2024
- Introducing `tools/perlcritic` an improved wrapper over
  perl's `perlcritic`.

  It automatically appends this project's policies that are
  defined under the `openqa` theme.

- Adds a complementary GitHub Action to run `tools/perlcritic`
  automatically on Pull Requests & Master.

- Fixed `perlcritics` complaints.

Branched off os-autoinst#30.

Co-authored-by: Oliver Kurz <[email protected]>
Co-authored-by: Martchus <[email protected]>
josegomezr added a commit to josegomezr/os-autoinst-common that referenced this pull request Jan 14, 2024
- Introducing `tools/perlcritic` an improved wrapper over
  perl's `perlcritic`.

  It automatically appends this project's policies that are
  defined under the `openqa` theme.

- Adds a complementary GitHub Action to run `tools/perlcritic`
  automatically on Pull Requests & Master.

- Fixed `perlcritics` complaints.

Branched off os-autoinst#30.

Co-authored-by: Oliver Kurz <[email protected]>
Co-authored-by: Martchus <[email protected]>
@okurz
Copy link
Member

okurz commented Jan 15, 2024

With

merged can you now rebase here to fix the conflicts?

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.

7 participants