Skip to content

Fix make lint-readme (RST link errors)#525

Merged
jmchilton merged 8 commits intogalaxyproject:masterfrom
peterjc:history_links
Aug 2, 2016
Merged

Fix make lint-readme (RST link errors)#525
jmchilton merged 8 commits intogalaxyproject:masterfrom
peterjc:history_links

Conversation

@peterjc
Copy link
Contributor

@peterjc peterjc commented Jul 26, 2016

Partly (update - fully) addresses #524, remaining issues:

$ make lint-readme
if [ -f .venv/bin/activate ]; then . .venv/bin/activate; fi; python setup.py check -r -s
running check
warning: check: Duplicate implicit target name: "conda".

warning: check: Duplicate implicit target name: "docker".

warning: check: Duplicate explicit target name: "cwl".

error: Please correct your package.
make: *** [lint-readme] Error 1

I think the cwl problem is that the link exists in both README.rst and HISTORY.rst and the two files get combined within setup.py which create the duplicate:

long_description=readme + '\n\n' + history,

peterjc added 8 commits July 26, 2016 12:00
Used this quick Python script with manual whitespace
cleanup.

import sys
def link_de_dup(filename):
    links = []
    text = []
    for line in open(filename):
        if line.startswith(".. _"):
            links.append(line)
        else:
            text.append(line)
    with open(filename, "w") as handle:
        for line in text:
            handle.write(line)
        for line in sorted(set(links)):
            handle.write(line)
for filename in sys.argv[1:]:
    print("Processing %s" % filename)
    link_de_dup(filename)

Could be more clever about sorting the issue and pull request
links numerically rather than alphabetically...
Fixes unused hyperlink target warning via rst-lint tool
from https://pypi.python.org/pypi/restructuredtext_lint
Fixes unused hyperlink target warning via rst-lint tool
from https://pypi.python.org/pypi/restructuredtext_lint
about ``Common Workfow Language`` by using this rather
than ``CWL``.

This allows us to remove the ``CWL`` link target, and thus
avoid that being a duplicate link in setup.py when the
``README.rst`` and ``HISTORY.rst`` files are combined. That
solves one of the complaints from ``make lint-readme``.

Fixes unused hyperlink target warning via rst-lint tool
from https://pypi.python.org/pypi/restructuredtext_lint
about  by using this rather than
.

This allows us to remove the  link target, and thus
avoid that being a duplicate link in setup.py when the
 and  files are combined. That
solves one of the complains from if [ -f .venv/bin/activate ]; then . .venv/bin/activate; fi; python setup.py check -r -s
running check.
Spotted via https://pypi.python.org/pypi/restructuredtext_lint
since rst-lint README.rst gives much more helpful messages than
make lint-readme
@peterjc peterjc changed the title Fix some of the RST duplicate link errors from linting Fix make lint-readme (RST link errors) Jul 26, 2016
@peterjc
Copy link
Contributor Author

peterjc commented Jul 26, 2016

This now passes make lint-readme - the separate command line tool from https://pypi.python.org/pypi/restructuredtext_lint was very useful here - note it flags some more issues:

$ rst-lint *.rst
INFO File CODE_OF_CONDUCT.rst is clean.
INFO CONTRIBUTING.rst:186 Duplicate implicit target name: "tox".
INFO HISTORY.rst:773 Hyperlink target "2052db0" is not referenced.
INFO HISTORY.rst:783 Hyperlink target "30a9c3f" is not referenced.
INFO HISTORY.rst:784 Hyperlink target "32c6e7f" is not referenced.
INFO HISTORY.rst:788 Hyperlink target "3499ca0" is not referenced.
INFO HISTORY.rst:810 Hyperlink target "552059f" is not referenced.
INFO HISTORY.rst:829 Hyperlink target "776773c" is not referenced.
INFO HISTORY.rst:883 Hyperlink target "issue 186" is not referenced.
INFO HISTORY.rst:888 Hyperlink target "issue 206" is not referenced.
INFO HISTORY.rst:903 Hyperlink target "issue 333" is not referenced.
INFO File README.rst is clean.

The unused link targets in HISTORY.rst suggest potentially missing entries in the change log?

Regarding the tox target name in CONTRIBUTING.rst, I don't quite understand the RST rules for section names as implicit target names.

@jmchilton
Copy link
Member

Completely missed this PR - sorry. Thanks for the fix!

@jmchilton jmchilton merged commit 22f40a4 into galaxyproject:master Aug 2, 2016
@peterjc peterjc deleted the history_links branch August 2, 2016 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants