Skip to content

fix: linting/formatting results in scrollable window, more cross refs #48

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

Merged
merged 3 commits into from
Jun 10, 2025

Conversation

m-jahn
Copy link
Member

@m-jahn m-jahn commented Jun 7, 2025

  • linting and formatting were previous confined to a 20 lines code block
  • now we have more space to show linting/formatting results with scrollable code blocks
  • cross references added to go from tables and workflow page top to the lint/format section
  • updated 1 README badge

Summary by CodeRabbit

  • Documentation
    • Updated deployment workflow badge and link in the README.
    • Enhanced workflow documentation by adding clickable reference links to failed linting and formatting badges.
    • Improved workflow page readability with scrollable containers and line numbers for failed linting/formatting outputs.
    • Enabled automatic heading anchors for Markdown headings up to level 2 in the documentation.

Copy link
Contributor

coderabbitai bot commented Jun 7, 2025

📝 Walkthrough

"""

Walkthrough

The updates modify documentation templates, workflow badge references, and output display for quality checks. The README's deployment badge is updated, Sphinx documentation configuration is changed to enable heading anchors, and the function for truncating quality check outputs now allows a configurable line limit. No public APIs or logic are otherwise altered.

Changes

Files/Paths Change Summary
README.md Updated deployment workflow badge and link to reference the "deploy" workflow instead of "pages-build-deployment".
source/_templates/all_standardized_workflows.md Changed failed quality check badges to clickable reference badges with repo links in the workflow table.
source/_templates/workflow_page.md Enhanced badge referencing and output display for linting/formatting failures; added scrollable containers and anchors.
source/build_wf_pages.py Modified check_qc_output to accept a max_lines parameter (default 200) for output truncation; added slugify filter.
source/build_wf_tables.py Added slugify function and registered it as a Jinja2 filter in the workflow tables builder.
source/conf.py Added myst_heading_anchors = 2 to Sphinx config to generate heading anchors up to level 2.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Sphinx
    participant Template
    participant build_wf_pages.py

    User->>Sphinx: Build documentation
    Sphinx->>Template: Render workflow page
    Template->>build_wf_pages.py: Call check_qc_output(qc_item, max_lines=200)
    build_wf_pages.py-->>Template: Return truncated QC output
    Template-->>Sphinx: Rendered page with enhanced badges and output display
    Sphinx-->>User: Serve documentation with updated badges and headings
Loading

Suggested reviewers

  • johanneskoester
  • cmeesters
  • tedil
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
source/_templates/workflow_page.md (2)

147-156: Refactor inline scroll container styling

Inline styles reduce maintainability and consistency. Extract the scrollable container styles (height, overflow, padding) into a CSS class in your Sphinx theme or custom CSS file. Also, remove the trailing space in the closing tag (</div ></div>).


167-176: Extract inline styles for formatting results container

Similarly, move the inline scroll-container styling into a dedicated CSS class and correct the closing tag (</div ></div>). This will keep the template cleaner and consistent.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efed3cc and 8433b3e.

📒 Files selected for processing (5)
  • README.md (1 hunks)
  • source/_templates/all_standardized_workflows.md (1 hunks)
  • source/_templates/workflow_page.md (2 hunks)
  • source/build_wf_pages.py (1 hunks)
  • source/conf.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest type annotations for functions that are defined inside of functions or methods. Do not suggest type annotation of the `s...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • source/conf.py
  • source/build_wf_pages.py
🪛 markdownlint-cli2 (0.17.2)
source/_templates/workflow_page.md

143-143: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


163-163: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: generate-catalog
🔇 Additional comments (5)
README.md (1)

4-4:

✅ Verification successful

Verify the updated workflow name exists.

The badge update looks correct, but please ensure the "deploy" workflow exists in the repository.


🏁 Script executed:

#!/bin/bash
# Description: Verify the deploy workflow exists in the repository
# Expected: The deploy.yml workflow file should exist

fd -t f "deploy.yml" .github/workflows/

Length of output: 68


“deploy” workflow badge validated

The file .github/workflows/deploy.yml exists, so the badge now correctly points to a valid workflow. Approving the update.

source/conf.py (1)

61-61: LGTM: Enables heading anchors for improved navigation.

This setting correctly enables automatic anchor generation for headings, supporting the cross-reference improvements mentioned in the PR objectives.

source/_templates/all_standardized_workflows.md (1)

25-25:

✅ Verification successful

Verify anchor targets exist in workflow pages.

The cross-reference implementation looks correct, converting simple badges to clickable reference badges.


🏁 Script executed:

#!/bin/bash
# Description: Verify that corresponding anchor targets exist in workflow page templates
# Expected: Should find anchor definitions matching the reference format

rg -A 3 -B 3 "formatting-|linting-" source/_templates/workflow_page.md

Length of output: 670


Cross-reference anchor targets confirmed.

Verified in source/_templates/workflow_page.md that the anchors

  • (linting-{{ wf["full_name"] }})
  • (formatting-{{ wf["full_name"] }})

exist and match the reference badges in all_standardized_workflows.md. Approving these changes.

source/build_wf_pages.py (2)

29-29: LGTM: Configurable line limit improves flexibility.

The addition of the max_lines parameter with a default of 200 is a good improvement that maintains backward compatibility while allowing more content to be displayed.


34-35: LGTM: Proper implementation of configurable truncation.

The truncation logic correctly uses the new max_lines parameter instead of the hardcoded value, supporting the PR objective of showing more content in scrollable containers.

🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 34-37: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

Copy link

@cademirch cademirch left a comment

Choose a reason for hiding this comment

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

Looks good to me @m-jahn!

@cmeesters
Copy link
Member

@m-jahn I will be on a conference for the next week. Also, I am not familiar with the code base in the first place. Still, it looks good at first glance. Mind addressing the coderabbit's comments (I sometimes outright dismiss them, as they are bullshit; sometimes they are really helpful because I missed something).

NB I would not know how to test the web setup.

@m-jahn
Copy link
Member Author

m-jahn commented Jun 9, 2025

@cmeesters yes you're right, the code rabbit comments can be helpful, I try to address them. Regarding how to test the catalog locally, there is a new section on the README which describes the steps needed to build the catalog and test-deploy the web page. These are exactly the steps that I use to test changes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
source/_templates/workflow_page.md (2)

35-35: Excellent resolution of anchor sanitization issues.

The badges now correctly use the slugify filter to generate safe anchor references, addressing the previous concerns about invalid characters in wf["full_name"] breaking HTML anchors.

Also applies to: 41-41


139-139: Properly slugified section anchors match badge references.

The section anchors consistently use slugified workflow names, ensuring they properly match the badge references and maintain valid HTML anchor syntax.

Also applies to: 159-159

🧹 Nitpick comments (1)
source/build_wf_pages.py (1)

31-38: Simplify by removing unnecessary else clauses.

The else clauses after return statements are unnecessary and can be removed for cleaner code.

 def check_qc_output(qc_item, max_lines=200):
     if qc_item is None:
         return None
-    else:
-        result = qc_item.split("\n")
-        if len(result) > max_lines:
-            return "\n".join(result[:max_lines]) + "\n\n... (truncated)"
-        else:
-            return "\n".join(result)
+    
+    result = qc_item.split("\n")
+    if len(result) > max_lines:
+        return "\n".join(result[:max_lines]) + "\n\n... (truncated)"
+    return "\n".join(result)
🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 31-38: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)


[refactor] 35-38: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8433b3e and c728762.

📒 Files selected for processing (4)
  • source/_templates/all_standardized_workflows.md (1 hunks)
  • source/_templates/workflow_page.md (2 hunks)
  • source/build_wf_pages.py (3 hunks)
  • source/build_wf_tables.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/_templates/all_standardized_workflows.md
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest type annotations for functions that are defined inside of functions or methods. Do not suggest type annotation of the `s...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • source/build_wf_tables.py
  • source/build_wf_pages.py
🧬 Code Graph Analysis (2)
source/build_wf_tables.py (1)
source/build_wf_pages.py (1)
  • slugify (41-45)
source/build_wf_pages.py (1)
source/build_wf_tables.py (1)
  • slugify (19-23)
🪛 markdownlint-cli2 (0.17.2)
source/_templates/workflow_page.md

143-143: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


163-163: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🪛 Pylint (3.3.7)
source/build_wf_pages.py

[refactor] 31-38: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)


[refactor] 35-38: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: generate-catalog
🔇 Additional comments (8)
source/build_wf_tables.py (3)

2-2: Import added for slugify functionality.

The re module import is appropriately added to support the new slugify function.


19-23: Well-implemented slugify function.

The slugify function correctly converts strings to URL-friendly format with proper handling of edge cases (trimming leading/trailing hyphens).


101-101: Slugify filter registration enables template functionality.

Correctly registers the slugify function as a Jinja2 filter, enabling its use in templates via the |slugify syntax.

source/build_wf_pages.py (4)

2-2: Import added for slugify functionality.

The re module import supports the new slugify function implementation.


30-30: Improved configurability for output truncation.

Great improvement! The max_lines parameter makes the truncation limit configurable (defaulting to 200 lines vs. the previous hardcoded 20), providing much more useful output.


41-45: Consistent slugify implementation across files.

The slugify function is identical to the one in build_wf_tables.py, ensuring consistent slug generation behavior across the codebase.


56-56: Slugify filter enables template anchor generation.

Properly registers the slugify function as a Jinja2 filter for template use, supporting the anchor generation functionality in workflow templates.

source/_templates/workflow_page.md (1)

147-156: Enhanced output display with scrollable containers.

Great UX improvement! The scrollable containers with fixed height (400px) and line numbers provide much better presentation of long linting/formatting results compared to the previous truncated approach.

Also applies to: 167-176

@m-jahn m-jahn merged commit 0fdac2a into snakemake:main Jun 10, 2025
3 checks passed
@m-jahn m-jahn deleted the dev branch June 10, 2025 06:24
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.

3 participants