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

Modules lint output sorting #2077

Merged
merged 7 commits into from
Dec 5, 2022
Merged

Modules lint output sorting #2077

merged 7 commits into from
Dec 5, 2022

Conversation

awgymer
Copy link
Contributor

@awgymer awgymer commented Nov 30, 2022

The current modules lint behaviour sorts the test messages by message then by module_name (this is done by python string-sorting i.e. alphabetically).

Personally I find this somewhat unintuitive to grok.

Current output:

Screenshot 2022-11-30 at 11 02 16

This PR changes the default sort order to use the lint_test test name, then the module_name, then finally the message.

Screenshot 2022-11-30 at 11 01 32

It also adds the option to order by module_name first. This is a personal preference - feel free to quibble the inclusion.

Screenshot 2022-11-30 at 11 01 49

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@awgymer awgymer linked an issue Nov 30, 2022 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Merging #2077 (e8aa448) into dev (ea9dd92) will increase coverage by 0.01%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##              dev    #2077      +/-   ##
==========================================
+ Coverage   67.98%   67.99%   +0.01%     
==========================================
  Files          43       43              
  Lines        5597     5602       +5     
==========================================
+ Hits         3805     3809       +4     
- Misses       1792     1793       +1     
Impacted Files Coverage Δ
nf_core/modules/lint/__init__.py 83.24% <87.50%> (-0.27%) ⬇️
nf_core/__main__.py 58.65% <100.00%> (+0.13%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mashehu
Copy link
Contributor

mashehu commented Nov 30, 2022

Not sure about the different shades of the row. It was alternating between rows before, but now seems to group them. Do we need the different shades? @ewels 👀

@awgymer
Copy link
Contributor Author

awgymer commented Nov 30, 2022

You know I didn't actually notice how that changed, I would need to look at the logic to see how it decides what to highlight. But personally I do like that it seems to highlight the "groups" of rows.

I think it alternates highlighting between groups based on the module name.

Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Can't remember how the varying colours works now. I added it to try to aid readability, which is pretty poor for this output.

nf_core/__main__.py Outdated Show resolved Hide resolved
@@ -732,8 +732,16 @@ def create_test_yml(ctx, tool, run_tests, output, force, no_prompts):
@click.option("-w", "--fail-warned", is_flag=True, help="Convert warn tests to failures")
@click.option("--local", is_flag=True, help="Run additional lint tests for local modules")
@click.option("--passed", is_flag=True, help="Show passed tests")
@click.option(
Copy link
Member

Choose a reason for hiding this comment

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

This is for nf-core modules lint but maybe you also want it for nf-core lint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to pipeline linting. Called it sort_by for consistency across commands but did consider if it should be module_sort_by in pipeline lint

Copy link
Member

Choose a reason for hiding this comment

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

I personally like sort_by more, I find module_sort_by a bit more confusing. Should we merge? are you happy with it @awgymer ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok that's good then. Happy to merge if this gets an approving review

Copy link
Member

Choose a reason for hiding this comment

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

sorry, I thought it was already approved 😅

@mashehu
Copy link
Contributor

mashehu commented Dec 2, 2022

Can't remember how the varying colours works now. I added it to try to aid readability, which is pretty poor for this output.

btw. this is the source for the alternating colors:

https://github.com/nf-core/tools/blob/dev/nf_core/modules/lint/__init__.py#L377

@awgymer
Copy link
Contributor Author

awgymer commented Dec 5, 2022

Can't remember how the varying colours works now. I added it to try to aid readability, which is pretty poor for this output.

btw. this is the source for the alternating colors:

https://github.com/nf-core/tools/blob/dev/nf_core/modules/lint/__init__.py#L377

Indeed it colours rows in grouping of module name. I don't think it was ever guaranteed to be alternating every row.

If you (or anyone) has a preference for changing it then happy to implement something different in future but will merge this PR now.

@awgymer awgymer merged commit c0f8c66 into nf-core:dev Dec 5, 2022
@awgymer awgymer deleted the modules-lint-sort branch December 5, 2022 11:06
@mashehu
Copy link
Contributor

mashehu commented Dec 5, 2022

Oh, we forgot to mention that new option in the changelog. Can you open a PR for that, @awgymer?

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.

Order module linting output by test name first.
4 participants