-
Notifications
You must be signed in to change notification settings - Fork 547
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
[WIP] Unpin rstcheck dependency and update to version 6.x #2344
base: devel
Are you sure you want to change the base?
Conversation
- Removed the version pin(5.0.0) for rstcheck to allow updates to the latest version (6.x). - Updated the rstcheck.py script to handle changes in the rstcheck-core API and output format. Signed-off-by: Ganesh Hubale <ganeshhubale03@gmail.com>
- Corrected YAML formatting issues, ensuring valid syntax for rstcheck validation. - Fixed malformed tables by aligning columns and ensuring consistent formatting. - Addressed unreferenced and duplicate hyperlink targets, ensuring proper references or removal of unused targets. - Adjusted invalid code block types (e.g., switching from yaml to ini or text) for compatibility with rstcheck. - Resolved custom role (ansplugin) issues by either ignoring the role. Signed-off-by: Ganesh Hubale <ganeshhubale03@gmail.com>
The following files are automatically generated and should not be modified outside of the Ansible release process:
Please double-check your changes. |
Hi @oraNod , While I’ve resolved the majority of syntax and parsing errors, the AttributeError issue still persists. This seems to be caused by an existing bug in the rstcheck_core library. Below is the error message for reference:
Would it be acceptable to ignore this issue given its root cause in the library? I appreciate your guidance on how to proceed. |
@ganeshhubale Hi, I've looked through the errors in your branch. It seems there are some more instances of the missing language in code blocks triggering that error. For example, However it also looks like there are some cases of this bug showing up: rstcheck/rstcheck-core#63 I've observed this with the Have you been able to successfully ignore this? I've attempted via
|
@oraNod yes, I agree with you. about this issue - rstcheck/rstcheck-core#63 - Can we open this?
code block:
Please help me with next steps. Thanks! |
@ganeshhubale Thanks for keeping going with this! That looks promising. I guess it's a bit weird though because info seems to be the default level according to the docs. I also don't particularly like the idea of adding an rstcheck cfg file to the repo anyway to avoid clutter. I did try to add a section to the project toml but it didn't appear to have an effect. Anyway... Thinking about next steps:
|
@oraNod You can push to this branch. As I am not getting what I can update to these files? |
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.
There are quite a few changes of yaml
to ini
. This is wrong in most cases. It usually should be yaml
or yaml+jinja
(depending on whether strings are templated).
@@ -18,7 +18,7 @@ Once installed, you can reference a collection content by its fully qualified co | |||
|
|||
This works for roles or any type of plugin distributed within the collection: | |||
|
|||
.. code-block:: yaml | |||
.. code-block:: ini |
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.
Shouldn't this be yaml+jinja
? This is definitely not an INI file.
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.
Exactly.
@@ -90,7 +90,7 @@ A collection skeleton is a directory that looks like a collection directory but | |||
|
|||
An example ``galaxy.yml.j2`` file that accepts an optional dictionary variable ``dependencies`` could look like this: | |||
|
|||
.. code-block:: yaml | |||
.. code-block:: ini |
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.
I think this should be jinja
, since it is a Jinja template (that will end up as YAML, but right now is not YAML). INI is definitely wrong here.
@@ -1,63 +1,34 @@ | |||
"""Sanity test using rstcheck and sphinx.""" | |||
from __future__ import annotations |
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.
Please keep the header.
import re | ||
import subprocess | ||
from rstcheck_core.runner import RstcheckMainRunner | ||
from rstcheck_core.config import RstcheckConfig |
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.
So are you using rstcheck or rstcheck-core?
Since we call rstcheck from a script, we could simply enumerate all files that we want to be checked and ask rstcheck to only check these. |
Excellent suggestion @felixfontein cheers |
@ganeshhubale I pushed a commit with a few more language specifiers for code-blocks. It appears that I'll try to take a more detailed look at this tomorrow or early next week. Thanks again for working on this. |
@@ -208,7 +208,7 @@ The ``Socket path does not exist or cannot be found`` and ``Unable to connect t | |||
|
|||
For example: | |||
|
|||
.. code-block:: none | |||
.. code-block:: json |
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.
.. code-block:: json | |
.. code-block:: ansible-output |
@@ -221,7 +221,7 @@ For example: | |||
|
|||
or | |||
|
|||
.. code-block:: none | |||
.. code-block:: json |
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.
.. code-block:: json | |
.. code-block:: ansible-output |
@@ -267,7 +267,7 @@ The ``unable to open shell`` message means that the ``ansible-connection`` daemo | |||
|
|||
For example: | |||
|
|||
.. code-block:: none | |||
.. code-block:: console |
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.
.. code-block:: console | |
.. code-block:: ansible-output |
@@ -276,7 +276,7 @@ For example: | |||
or: | |||
|
|||
|
|||
.. code-block:: none | |||
.. code-block:: console |
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.
.. code-block:: console | |
.. code-block:: ansible-output |
@@ -128,7 +128,7 @@ SSH key authentication on Windows works in the same way as SSH key authenticatio | |||
|
|||
One difference is that the ``authorized_keys`` file for admin users is not located in the ``.ssh`` folder in the user's profile directory but in ``C:\ProgramData\ssh\administrators_authorized_keys``. It is possible to change the location of the ``authorized_keys`` file for admin users back to the user profile directory by removing, or commenting, the lines in ``C:\ProgramData\ssh\sshd_config`` and restarting the ``sshd`` service. | |||
|
|||
.. code-block:: | |||
.. code-block:: shell |
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 is a SSH config file, not shell commands.
.. code-block:: shell | |
.. code-block:: text |
@@ -167,7 +167,7 @@ This category only applies to things that take direct options, generally modules | |||
|
|||
Outside of task actions, the most recognizable 'direct assignments' are with lookup, filter and test plugins: | |||
|
|||
.. code:: | |||
.. code:: jinja |
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.
jinja
is for Jinja templates. If the following would be wrapped in {{ }}
it would be the right lexer, but for pure Jinja code it is not.
python
would work mostly, except for the |
.
Maybe keep text
here? Or add {{ }}
around every non-empty line?
@@ -185,7 +185,7 @@ Using locally installed collections adjacent to playbooks has some benefits, suc | |||
|
|||
Here is an example of keeping a collection adjacent to the current playbook, under a ``collections/ansible_collections/`` directory structure. | |||
|
|||
.. code-block:: text | |||
.. code-block:: console |
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.
It's not really console
. Console is for snippets copied from terminal output, featuring a prompt followed by its command and then the output.
ignore_substitutions = ( | ||
'br', | ||
# Define the paths to check (passed as CLI arguments or from stdin) | ||
paths = [pathlib.Path(p) for p in (sys.argv[1:] or sys.stdin.read().splitlines())] |
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 expression is unnecessarily complex. Split it.
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": |
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.
I recommend moving any formatting changes to a separate PR.
@@ -121,7 +121,7 @@ requests==2.32.3 | |||
# via sphinx | |||
resolvelib==1.0.1 | |||
# via -r tests/requirements-relaxed.in | |||
rstcheck==5.0.0 | |||
rstcheck>=6.2.4 |
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.
Don't change the generated file by hand. This must be pinned with the integrated tooling.
@@ -1,4 +1,4 @@ | |||
# Known limitations for indirect/transitive dependencies. | |||
|
|||
rstcheck < 6 # rstcheck 6.x has problem with rstcheck.core triggered by include files w/ sphinx directives https://github.com/rstcheck/rstcheck-core/issues/3 | |||
rstcheck>=6.2.4 |
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.
Keep the previously sparse style.
rstcheck>=6.2.4 | |
rstcheck >= 6.2.4 |
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.
Actually, this file is the absolute wrong place for lower bounds. Its semantic purpose is to hold temporary exclusions, which this isn't.
The entry should be deleted instead.
rstcheck>=6.2.4 |
@@ -53,7 +53,7 @@ The following table shows an example of how an initial resource configuration ch | |||
+-----------------------------------------+------------------------------------+-----------------------------------------+ | |||
| Resource starting configuration | task-provided configuration (YAML) | Final resource configuration on device | | |||
+=========================================+====================================+=========================================+ | |||
| .. code-block:: text | .. code-block:: yaml | *merged* | | |||
| .. code-block:: text | .. code-block:: ini | *merged* | |
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.
Avoid trailing whitespaces. Also, it's not ini, just like in many places Felix marked.
| .. code-block:: text | .. code-block:: ini | *merged* | | |
| .. code-block:: text | .. code-block:: yaml | *merged* | |
@@ -157,7 +157,7 @@ The playbook below | |||
|
|||
displays the details | |||
|
|||
.. code-block:: yaml | |||
.. code-block:: shell |
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 is either console
or ansible-output
. It's not a shell script.
.. code-block:: shell | |
.. code-block:: ansible-output |
Thank you @oraNod |
Issue resolved: #1710