-
Notifications
You must be signed in to change notification settings - Fork 0
Fix empty global conf #1
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
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes errors that occur when the global configuration pseudocode2_options is not set in the Sphinx config file. It also includes documentation improvements and examples for custom indentation control.
- Adds a defensive check to handle
Nonevalues forglobal_optsin the directive code - Updates documentation to improve clarity and fix minor wording issues
- Adds a new "Tips" section demonstrating manual indentation control using LaTeX's
\hspacecommand
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
sphinxcontrib/pseudocode2/__init__.py |
Adds null safety check for global_opts to prevent errors when config is not set |
docs/source/index.rst |
Fixes heading underline length, improves wording, updates links, and adds Tips section with indentation examples |
docs/source/demo.rst |
Adds reference anchor and example lines demonstrating custom indentation with \hspace |
README.md |
Improves wording, updates links, adds period to priority rule, and includes Tips section with indentation examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| env = getattr(self, "env", None) | ||
| app = getattr(env, "app", None) if env is not None else None | ||
| global_opts = getattr(app.config, "pseudocode2_options", {}) if app is not None else {} | ||
| global_opts = global_opts if global_opts is not None else {} |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant. Line 62 uses getattr(app.config, 'pseudocode2_options', {}) which already provides {} as the default when the attribute doesn't exist. The getattr function never returns None in this case—it returns the provided default {}. If a user explicitly sets pseudocode2_options = None in their config, that would be a configuration error that should be caught earlier or documented as invalid.
| global_opts = global_opts if global_opts is not None else {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR solves the case where app.config has the attribute 'pseudocode2_options' whose value is None.
docs/source/index.rst
Outdated
| Tips | ||
| ===================================================== | ||
|
|
||
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'psuedo.js' to 'pseudo.js'.
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command | |
| - Custom (Manual) indentation Control: ``pseudocode.js`` and ``algorithmic`` do not have a built-in way (a single command |
README.md
Outdated
|
|
||
| ## Tips | ||
|
|
||
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'psuedo.js' to 'pseudo.js'.
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command | |
| - Custom (Manual) indentation Control: ``pseudo.js`` and ``algorithmic`` do not have a built-in way (a single command |
Fix errors when no global config
pseudocode2_optionsis set.