#372 Use `sort_key` attribute for sorting checks in `--display-checks`
Merged 4 years ago by ngompa. Opened 4 years ago by mkrupcale.
mkrupcale/FedoraReview checks-sort-key  into  master

@@ -158,7 +158,7 @@ 

                      if checks == []:

                          continue

                      print("Group: " + group)

-                     for c in sorted(checks):

+                     for c in sorted(checks, key=lambda c: int(c.sort_key)):

                          print("    {}: {}".format(c.name, c.text))

                  print()

  

Previously, errors such as

TypeError: '<' not supported between instances of 'RCheckCheckMacro' and 'RCheckBuildRequires'

would result from trying to sort the check classes directly, which don't implement the __lt__ method for sorting.

This fix uses the sort_key attribute inherited from AbstractCheck to sort the checks.

  • src/FedoraReview/review_helper.py: Use sort_key attribute for sorting checks

@mkrupcale Could you please rebase on current master? I can't merge until you do.

rebased onto e7da059

4 years ago

@ngompa Done. Is this always required even without merge conflicts?

I'm not sure. I think if Pagure itself can do the rebase without issue, it'll just do it (fast-forward merge).

Pull-Request has been merged by ngompa

4 years ago
Metadata