Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-restructuredtext_lint for openSUSE:Factory checked in at 2022-10-08 01:25:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-restructuredtext_lint (Old) and /work/SRC/openSUSE:Factory/.python-restructuredtext_lint.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-restructuredtext_lint" Sat Oct 8 01:25:59 2022 rev:7 rq:1008859 version:1.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-restructuredtext_lint/python-restructuredtext_lint.changes 2020-05-19 14:57:42.881298283 +0200 +++ /work/SRC/openSUSE:Factory/.python-restructuredtext_lint.new.2275/python-restructuredtext_lint.changes 2022-10-08 01:26:27.378399098 +0200 @@ -1,0 +2,12 @@ +Fri Oct 7 15:00:41 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to version 1.4.0 + - Fixed non-zero exit code for missing files/directories. Fixes #58 + +- Update to version 1.3.2 + - Added "Other tools" section to README. Replacement for #57 + +- Update to version 1.3.1 + - Removed .pyc files from distribution. Fixes #56 + +------------------------------------------------------------------- Old: ---- restructuredtext_lint-1.3.0.tar.gz New: ---- restructuredtext_lint-1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-restructuredtext_lint.spec ++++++ --- /var/tmp/diff_new_pack.Oysr5Q/_old 2022-10-08 01:26:27.786400035 +0200 +++ /var/tmp/diff_new_pack.Oysr5Q/_new 2022-10-08 01:26:27.790400044 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-restructuredtext_lint # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-restructuredtext_lint -Version: 1.3.0 +Version: 1.4.0 Release: 0 Summary: Linter for reStructuredText License: Unlicense @@ -30,7 +30,7 @@ BuildRequires: python-rpm-macros Requires: python-docutils >= 0.11 Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module docutils >= 0.11} ++++++ restructuredtext_lint-1.3.0.tar.gz -> restructuredtext_lint-1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/CHANGELOG.rst new/restructuredtext_lint-1.4.0/CHANGELOG.rst --- old/restructuredtext_lint-1.3.0/CHANGELOG.rst 2019-03-23 23:10:48.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/CHANGELOG.rst 2022-02-24 06:50:55.000000000 +0100 @@ -1,5 +1,11 @@ restructuredtext-lint changelog =============================== +1.4.0 - Fixed non-zero exit code for missing files/directories. Fixes #58 + +1.3.2 - Added "Other tools" section to README. Replacement for #57 + +1.3.1 - Removed `.pyc` files from distribution. Fixes #56 + 1.3.0 - Added Python 3.7 support via @Jenselme in #47 1.2.2 - Dropped PyYAML dev dependency to fix GitHub vulnerability warning diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/PKG-INFO new/restructuredtext_lint-1.4.0/PKG-INFO --- old/restructuredtext_lint-1.3.0/PKG-INFO 2019-03-23 23:11:09.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/PKG-INFO 2022-02-24 06:51:10.116959300 +0100 @@ -1,238 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: restructuredtext_lint -Version: 1.3.0 +Version: 1.4.0 Summary: reStructuredText linter Home-page: https://github.com/twolfson/restructuredtext-lint +Download-URL: https://github.com/twolfson/restructuredtext-lint/archive/master.zip Author: Todd Wolfson Author-email: t...@twolfson.com License: UNLICENSE -Download-URL: https://github.com/twolfson/restructuredtext-lint/archive/master.zip -Description: restructuredtext-lint - ===================== - - .. image:: https://travis-ci.org/twolfson/restructuredtext-lint.png?branch=master - :target: https://travis-ci.org/twolfson/restructuredtext-lint - :alt: Build Status - - `reStructuredText`_ `linter`_ - - This was created out of frustration with `PyPI`_; it sucks finding out your `reST`_ is invalid **after** uploading it. It is being developed in junction with a `Sublime Text`_ linter. - - .. _`reStructuredText`: http://docutils.sourceforge.net/rst.html - .. _`linter`: http://en.wikipedia.org/wiki/Lint_%28software%29 - .. _`reST`: `reStructuredText`_ - .. _`PyPI`: http://pypi.python.org/ - .. _`Sublime Text`: http://sublimetext.com/ - - Getting Started - --------------- - Install the module with: ``pip install restructuredtext_lint`` - - .. code:: python - - import restructuredtext_lint - errors = restructuredtext_lint.lint(""" - Hello World - ======= - """) - - # `errors` will be list of system messages - # [<system_message: <paragraph...><literal_block...>>] - errors[0].message # Title underline too short. - - CLI Utility - ^^^^^^^^^^^ - For your convenience, we present a CLI utility ``rst-lint`` (also available as ``restructuredtext-lint``). - - .. code:: console - - $ rst-lint --help - usage: rst-lint [-h] [--version] [--format {text,json}] [--encoding ENCODING] - [--level {debug,info,warning,error,severe}] - [--rst-prolog RST_PROLOG] - path [path ...] - - Lint reStructuredText files. Returns 0 if all files pass linting, 1 for an - internal error, and 2 if linting failed. - - positional arguments: - path File/folder to lint - - optional arguments: - -h, --help show this help message and exit - --version show program's version number and exit - --format {text,json} Format of the output (default: "text") - --encoding ENCODING Encoding of the input file (e.g. "utf-8") - --level {debug,info,warning,error,severe} - Minimum error level to report (default: "warning") - --rst-prolog RST_PROLOG - reStructuredText content to prepend to all files - (useful for substitutions) - - $ rst-lint README.rst - WARNING README.rst:2 Title underline too short. - - PyPI issues - ^^^^^^^^^^^ - While a document may lint cleanly locally, there can be issues when submitted it to `PyPI`_. Here are some common problems: - - - Usage of non-builtin lexers (e.g. ``bibtex``) will pass locally but not be recognized/parsable on `PyPI`_ - - - This is due to `PyPI`_ not having a non-builtin lexer installed - - Please avoid non-builtin lexers to avoid complications - - For more information, see `#27`_ - - - Relative hyperlinks will not work (e.g. ``./UNLICENSE``) - - - According to Stack Overflow, hyperlinks must use a scheme (e.g. ``http``, ``https``) and that scheme must be whitelisted - - - http://stackoverflow.com/a/16594755 - - - Please use absolute hyperlinks (e.g. ``https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE``) - - .. _`#27`: https://github.com/twolfson/restructuredtext-lint/issues/27 - - Documentation - ------------- - ``restructuredtext-lint`` exposes a ``lint`` and ``lint_file`` function - - ``restructuredtext_lint.lint(content, filepath=None, rst_prolog=None)`` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Lint `reStructuredText`_ and return errors - - - content ``String`` - `reStructuredText`_ to be linted - - filepath ``String`` - Optional path to file, this will be returned as the source - - rst_prolog ``String`` - Optional content to prepend to content, line numbers will be offset to ignore this - - Returns: - - - errors ``List`` - List of errors - - - Each error is a class from `docutils`_ with the following attrs - - - line ``Integer|None`` - Line where the error occurred - - - On rare occasions, this will be ``None`` (e.g. anonymous link mismatch) - - - source ``String`` - ``filepath`` provided in parameters - - level ``Integer`` - Level of the warning - - - Levels represent 'info': 1, 'warning': 2, 'error': 3, 'severe': 4 - - - type ``String`` - Noun describing the error level - - - Levels can be 'INFO', 'WARNING', 'ERROR', or 'SEVERE' - - message ``String`` - Error message - - full_message ``String`` - Error message and source lines where the error occurred - - - It should be noted that ``level``, ``type``, ``message``, and ``full_message`` are custom attrs added onto the original ``system_message`` - - .. _`docutils`: http://docutils.sourceforge.net/ - - ``restructuredtext_lint.lint_file(filepath, encoding=None, *args, **kwargs)`` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Lint a `reStructuredText`_ file and return errors - - - filepath ``String`` - Path to file for linting - - encoding ``String`` - Encoding to read file in as - - - When ``None`` is provided, it will use OS default as provided by `locale.getpreferredencoding`_ - - The list of supported encodings can be found at http://docs.python.org/2/library/codecs.html#standard-encodings - - - ``*args`` - Additional arguments to be passed to ``lint`` - - ``**kwargs`` - Additional keyword arguments to be passed to ``lint`` - - .. _`locale.getpreferredencoding`: http://docs.python.org/2/library/locale.html#locale.getpreferredencoding - - Returns: Same structure as ``restructuredtext_lint.lint`` - - Extension - --------- - Under the hood, we leverage `docutils`_ for parsing reStructuredText documents. `docutils`_ supports adding new directives and roles via ``register_directive`` and ``register_role``. - - Sphinx - ^^^^^^ - Unfortunately due to customizations in `Sphinx's parser`_ we cannot include all of its directives/roles (see `#29`_). However, we can include some of them as one-offs. Here is an example of adding a directive from `Sphinx`_. - - .. _`Sphinx`: http://sphinx-doc.org/ - .. _`Sphinx's parser`: Sphinx_ - .. _`#29`: https://github.com/twolfson/restructuredtext-lint/issues/29#issuecomment-243456787 - - https://github.com/sphinx-doc/sphinx/blob/1.3/sphinx/directives/code.py - - **sphinx.rst** - - .. code:: rst - - Hello - ===== - World - - .. highlight:: python - - Hello World! - - **sphinx.py** - - .. code:: python - - # Load in our dependencies - from docutils.parsers.rst.directives import register_directive - from sphinx.directives.code import Highlight - import restructuredtext_lint - - # Load our new directive - register_directive('highlight', Highlight) - - # Lint our README - errors = restructuredtext_lint.lint_file('docs/sphinx/README.rst') - print errors[0].message # Error in "highlight" directive: no content permitted. - - Examples - -------- - Here is an example of all invalid properties - - .. code:: python - - rst = """ - Some content. - - Hello World - ======= - Some more content! - """ - errors = restructuredtext_lint.lint(rst, 'myfile.py') - errors[0].line # 5 - errors[0].source # myfile.py - errors[0].level # 2 - errors[0].type # WARNING - errors[0].message # Title underline too short. - errors[0].full_message # Title underline too short. - # - # Hello World - # ======= - - Contributing - ------------ - In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test via ``nosetests``. - - Donating - -------- - Support this project and `others by twolfson`_ via `donations`_. - - http://twolfson.com/support-me - - .. _`others by twolfson`: http://twolfson.com/projects - .. _donations: http://twolfson.com/support-me - - Unlicense - --------- - As of Nov 22 2013, Todd Wolfson has released this repository and its contents to the public domain. - - It has been released under the `UNLICENSE`_. - - .. _UNLICENSE: https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE - Keywords: restructuredtext,restructured text,rest,rst,lint Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha @@ -240,3 +14,237 @@ Classifier: License :: Public Domain Classifier: Operating System :: OS Independent Classifier: Topic :: Text Processing :: Markup + +restructuredtext-lint +===================== + +.. image:: https://travis-ci.org/twolfson/restructuredtext-lint.png?branch=master + :target: https://travis-ci.org/twolfson/restructuredtext-lint + :alt: Build Status + +`reStructuredText`_ `linter`_ + +This was created out of frustration with `PyPI`_; it sucks finding out your `reST`_ is invalid **after** uploading it. It is being developed in junction with a `Sublime Text`_ linter. + +.. _`reStructuredText`: http://docutils.sourceforge.net/rst.html +.. _`linter`: http://en.wikipedia.org/wiki/Lint_%28software%29 +.. _`reST`: `reStructuredText`_ +.. _`PyPI`: http://pypi.python.org/ +.. _`Sublime Text`: http://sublimetext.com/ + +Getting Started +--------------- +Install the module with: ``pip install restructuredtext_lint`` + +.. code:: python + + import restructuredtext_lint + errors = restructuredtext_lint.lint(""" + Hello World + ======= + """) + + # `errors` will be list of system messages + # [<system_message: <paragraph...><literal_block...>>] + errors[0].message # Title underline too short. + +CLI Utility +^^^^^^^^^^^ +For your convenience, we present a CLI utility ``rst-lint`` (also available as ``restructuredtext-lint``). + +.. code:: console + + $ rst-lint --help + usage: rst-lint [-h] [--version] [--format {text,json}] [--encoding ENCODING] + [--level {debug,info,warning,error,severe}] + [--rst-prolog RST_PROLOG] + path [path ...] + + Lint reStructuredText files. Returns 0 if all files pass linting, 1 for an + internal error, and 2 if linting failed. + + positional arguments: + path File/folder to lint + + optional arguments: + -h, --help show this help message and exit + --version show program's version number and exit + --format {text,json} Format of the output (default: "text") + --encoding ENCODING Encoding of the input file (e.g. "utf-8") + --level {debug,info,warning,error,severe} + Minimum error level to report (default: "warning") + --rst-prolog RST_PROLOG + reStructuredText content to prepend to all files + (useful for substitutions) + + $ rst-lint README.rst + WARNING README.rst:2 Title underline too short. + +Other tools +^^^^^^^^^^^ +``restructuredtext-lint`` is also integrated in other tools. A list can be found and updated in our wiki + +https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools + +PyPI issues +^^^^^^^^^^^ +While a document may lint cleanly locally, there can be issues when submitted it to `PyPI`_. Here are some common problems: + +- Usage of non-builtin lexers (e.g. ``bibtex``) will pass locally but not be recognized/parsable on `PyPI`_ + + - This is due to `PyPI`_ not having a non-builtin lexer installed + - Please avoid non-builtin lexers to avoid complications + - For more information, see `#27`_ + +- Relative hyperlinks will not work (e.g. ``./UNLICENSE``) + + - According to Stack Overflow, hyperlinks must use a scheme (e.g. ``http``, ``https``) and that scheme must be whitelisted + + - http://stackoverflow.com/a/16594755 + + - Please use absolute hyperlinks (e.g. ``https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE``) + +.. _`#27`: https://github.com/twolfson/restructuredtext-lint/issues/27 + +Documentation +------------- +``restructuredtext-lint`` exposes a ``lint`` and ``lint_file`` function + +``restructuredtext_lint.lint(content, filepath=None, rst_prolog=None)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Lint `reStructuredText`_ and return errors + +- content ``String`` - `reStructuredText`_ to be linted +- filepath ``String`` - Optional path to file, this will be returned as the source +- rst_prolog ``String`` - Optional content to prepend to content, line numbers will be offset to ignore this + +Returns: + +- errors ``List`` - List of errors + + - Each error is a class from `docutils`_ with the following attrs + + - line ``Integer|None`` - Line where the error occurred + + - On rare occasions, this will be ``None`` (e.g. anonymous link mismatch) + + - source ``String`` - ``filepath`` provided in parameters + - level ``Integer`` - Level of the warning + + - Levels represent 'info': 1, 'warning': 2, 'error': 3, 'severe': 4 + + - type ``String`` - Noun describing the error level + + - Levels can be 'INFO', 'WARNING', 'ERROR', or 'SEVERE' + - message ``String`` - Error message + - full_message ``String`` - Error message and source lines where the error occurred + + - It should be noted that ``level``, ``type``, ``message``, and ``full_message`` are custom attrs added onto the original ``system_message`` + +.. _`docutils`: http://docutils.sourceforge.net/ + +``restructuredtext_lint.lint_file(filepath, encoding=None, *args, **kwargs)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Lint a `reStructuredText`_ file and return errors + +- filepath ``String`` - Path to file for linting +- encoding ``String`` - Encoding to read file in as + + - When ``None`` is provided, it will use OS default as provided by `locale.getpreferredencoding`_ + - The list of supported encodings can be found at http://docs.python.org/2/library/codecs.html#standard-encodings + +- ``*args`` - Additional arguments to be passed to ``lint`` +- ``**kwargs`` - Additional keyword arguments to be passed to ``lint`` + +.. _`locale.getpreferredencoding`: http://docs.python.org/2/library/locale.html#locale.getpreferredencoding + +Returns: Same structure as ``restructuredtext_lint.lint`` + +Extension +--------- +Under the hood, we leverage `docutils`_ for parsing reStructuredText documents. `docutils`_ supports adding new directives and roles via ``register_directive`` and ``register_role``. + +Sphinx +^^^^^^ +Unfortunately due to customizations in `Sphinx's parser`_ we cannot include all of its directives/roles (see `#29`_). However, we can include some of them as one-offs. Here is an example of adding a directive from `Sphinx`_. + +.. _`Sphinx`: http://sphinx-doc.org/ +.. _`Sphinx's parser`: Sphinx_ +.. _`#29`: https://github.com/twolfson/restructuredtext-lint/issues/29#issuecomment-243456787 + +https://github.com/sphinx-doc/sphinx/blob/1.3/sphinx/directives/code.py + +**sphinx.rst** + +.. code:: rst + + Hello + ===== + World + + .. highlight:: python + + Hello World! + +**sphinx.py** + +.. code:: python + + # Load in our dependencies + from docutils.parsers.rst.directives import register_directive + from sphinx.directives.code import Highlight + import restructuredtext_lint + + # Load our new directive + register_directive('highlight', Highlight) + + # Lint our README + errors = restructuredtext_lint.lint_file('docs/sphinx/README.rst') + print errors[0].message # Error in "highlight" directive: no content permitted. + +Examples +-------- +Here is an example of all invalid properties + +.. code:: python + + rst = """ + Some content. + + Hello World + ======= + Some more content! + """ + errors = restructuredtext_lint.lint(rst, 'myfile.py') + errors[0].line # 5 + errors[0].source # myfile.py + errors[0].level # 2 + errors[0].type # WARNING + errors[0].message # Title underline too short. + errors[0].full_message # Title underline too short. + # + # Hello World + # ======= + +Contributing +------------ +In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test via ``nosetests``. + +Donating +-------- +Support this project and `others by twolfson`_ via `donations`_. + +http://twolfson.com/support-me + +.. _`others by twolfson`: http://twolfson.com/projects +.. _donations: http://twolfson.com/support-me + +Unlicense +--------- +As of Nov 22 2013, Todd Wolfson has released this repository and its contents to the public domain. + +It has been released under the `UNLICENSE`_. + +.. _UNLICENSE: https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/README.rst new/restructuredtext_lint-1.4.0/README.rst --- old/restructuredtext_lint-1.3.0/README.rst 2018-11-14 07:06:31.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/README.rst 2020-11-24 12:19:20.000000000 +0100 @@ -63,6 +63,12 @@ $ rst-lint README.rst WARNING README.rst:2 Title underline too short. +Other tools +^^^^^^^^^^^ +``restructuredtext-lint`` is also integrated in other tools. A list can be found and updated in our wiki + +https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools + PyPI issues ^^^^^^^^^^^ While a document may lint cleanly locally, there can be issues when submitted it to `PyPI`_. Here are some common problems: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/release.sh new/restructuredtext_lint-1.4.0/release.sh --- old/restructuredtext_lint-1.3.0/release.sh 2018-11-14 06:55:13.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/release.sh 2020-06-03 02:43:34.000000000 +0200 @@ -5,6 +5,11 @@ # Install our dependencies npm install foundry@~4.3.2 foundry-release-git@~2.0.2 foundry-release-pypi@~3.0.0 +# Remove all `.pyc` files +shopt -s globstar +rm **/*.pyc || true +shopt -u globstar + # Run foundry release with an adjusted PATH PATH="$PATH:$PWD/node_modules/.bin/" foundry release $* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/requirements-dev.txt new/restructuredtext_lint-1.4.0/requirements-dev.txt --- old/restructuredtext_lint-1.3.0/requirements-dev.txt 2019-01-06 11:02:08.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/requirements-dev.txt 2022-02-24 06:50:23.000000000 +0100 @@ -1,3 +1,3 @@ -nose==1.3.0 +nose==1.3.7 flake8==2.2.3 flake8-quotes==0.0.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/restructuredtext_lint/VERSION new/restructuredtext_lint-1.4.0/restructuredtext_lint/VERSION --- old/restructuredtext_lint-1.3.0/restructuredtext_lint/VERSION 2019-03-23 23:10:58.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/restructuredtext_lint/VERSION 2022-02-24 06:51:05.000000000 +0100 @@ -1 +1 @@ -1.3.0 +1.4.0 Binary files old/restructuredtext_lint-1.3.0/restructuredtext_lint/__init__.pyc and new/restructuredtext_lint-1.4.0/restructuredtext_lint/__init__.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/restructuredtext_lint/cli.py new/restructuredtext_lint-1.4.0/restructuredtext_lint/cli.py --- old/restructuredtext_lint-1.3.0/restructuredtext_lint/cli.py 2018-11-14 07:06:31.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/restructuredtext_lint/cli.py 2022-02-24 06:50:23.000000000 +0100 @@ -43,12 +43,16 @@ # Check if the given path is a file or a directory if os.path.isfile(path): filepaths.append(path) - else: + elif os.path.isdir(path): # Recurse over subdirectories to search for *.rst files for root, subdir, files in os.walk(path): for file in files: if file.endswith('.rst'): filepaths.append(os.path.join(root, file)) + else: + stream.write('Path "{path}" not found as a file nor directory\n'.format(path=path)) + sys.exit(1) + return for filepath in filepaths: # Read and lint the file Binary files old/restructuredtext_lint-1.3.0/restructuredtext_lint/cli.pyc and new/restructuredtext_lint-1.4.0/restructuredtext_lint/cli.pyc differ Binary files old/restructuredtext_lint-1.3.0/restructuredtext_lint/lint.pyc and new/restructuredtext_lint-1.4.0/restructuredtext_lint/lint.pyc differ Binary files old/restructuredtext_lint-1.3.0/restructuredtext_lint/test/__init__.pyc and new/restructuredtext_lint-1.4.0/restructuredtext_lint/test/__init__.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/restructuredtext_lint/test/test.py new/restructuredtext_lint-1.4.0/restructuredtext_lint/test/test.py --- old/restructuredtext_lint-1.3.0/restructuredtext_lint/test/test.py 2019-03-23 23:10:24.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/restructuredtext_lint/test/test.py 2022-02-24 06:50:23.000000000 +0100 @@ -14,6 +14,7 @@ warning_rst = os.path.join(_dir, 'test_files', 'second_short_heading.rst') dir_rst = os.path.join(_dir, 'test_files', 'dir') invalid_rst = os.path.join(_dir, 'test_files', 'invalid.rst') +missing_rst = os.path.join(_dir, 'test_files', 'missing.rst') rst_lint_path = os.path.join(_dir, os.pardir, 'cli.py') """ @@ -171,6 +172,16 @@ # Verify exactly 1 error is produced self.assertEqual(output.count('WARNING'), 1) + def test_rst_lint_missing_file(self): + """ + The `rst-lint` command should print errors for files inside folders. + Fixes regression https://github.com/twolfson/restructuredtext-lint/issues/58 + """ + with self.assertRaises(subprocess.CalledProcessError) as e: + subprocess.check_output((sys.executable, rst_lint_path, missing_rst), universal_newlines=True) + output = str(e.exception.output) + self.assertIn('not found as a file nor directory', output) + def test_rst_lint_many_files(self): """The `rst-lint` command accepts many rst file paths and prints respective information for each of them.""" with self.assertRaises(subprocess.CalledProcessError) as e: Binary files old/restructuredtext_lint-1.3.0/restructuredtext_lint/test/test.pyc and new/restructuredtext_lint-1.4.0/restructuredtext_lint/test/test.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/restructuredtext_lint.egg-info/PKG-INFO new/restructuredtext_lint-1.4.0/restructuredtext_lint.egg-info/PKG-INFO --- old/restructuredtext_lint-1.3.0/restructuredtext_lint.egg-info/PKG-INFO 2019-03-23 23:11:09.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/restructuredtext_lint.egg-info/PKG-INFO 2022-02-24 06:51:10.000000000 +0100 @@ -1,238 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: restructuredtext-lint -Version: 1.3.0 +Version: 1.4.0 Summary: reStructuredText linter Home-page: https://github.com/twolfson/restructuredtext-lint +Download-URL: https://github.com/twolfson/restructuredtext-lint/archive/master.zip Author: Todd Wolfson Author-email: t...@twolfson.com License: UNLICENSE -Download-URL: https://github.com/twolfson/restructuredtext-lint/archive/master.zip -Description: restructuredtext-lint - ===================== - - .. image:: https://travis-ci.org/twolfson/restructuredtext-lint.png?branch=master - :target: https://travis-ci.org/twolfson/restructuredtext-lint - :alt: Build Status - - `reStructuredText`_ `linter`_ - - This was created out of frustration with `PyPI`_; it sucks finding out your `reST`_ is invalid **after** uploading it. It is being developed in junction with a `Sublime Text`_ linter. - - .. _`reStructuredText`: http://docutils.sourceforge.net/rst.html - .. _`linter`: http://en.wikipedia.org/wiki/Lint_%28software%29 - .. _`reST`: `reStructuredText`_ - .. _`PyPI`: http://pypi.python.org/ - .. _`Sublime Text`: http://sublimetext.com/ - - Getting Started - --------------- - Install the module with: ``pip install restructuredtext_lint`` - - .. code:: python - - import restructuredtext_lint - errors = restructuredtext_lint.lint(""" - Hello World - ======= - """) - - # `errors` will be list of system messages - # [<system_message: <paragraph...><literal_block...>>] - errors[0].message # Title underline too short. - - CLI Utility - ^^^^^^^^^^^ - For your convenience, we present a CLI utility ``rst-lint`` (also available as ``restructuredtext-lint``). - - .. code:: console - - $ rst-lint --help - usage: rst-lint [-h] [--version] [--format {text,json}] [--encoding ENCODING] - [--level {debug,info,warning,error,severe}] - [--rst-prolog RST_PROLOG] - path [path ...] - - Lint reStructuredText files. Returns 0 if all files pass linting, 1 for an - internal error, and 2 if linting failed. - - positional arguments: - path File/folder to lint - - optional arguments: - -h, --help show this help message and exit - --version show program's version number and exit - --format {text,json} Format of the output (default: "text") - --encoding ENCODING Encoding of the input file (e.g. "utf-8") - --level {debug,info,warning,error,severe} - Minimum error level to report (default: "warning") - --rst-prolog RST_PROLOG - reStructuredText content to prepend to all files - (useful for substitutions) - - $ rst-lint README.rst - WARNING README.rst:2 Title underline too short. - - PyPI issues - ^^^^^^^^^^^ - While a document may lint cleanly locally, there can be issues when submitted it to `PyPI`_. Here are some common problems: - - - Usage of non-builtin lexers (e.g. ``bibtex``) will pass locally but not be recognized/parsable on `PyPI`_ - - - This is due to `PyPI`_ not having a non-builtin lexer installed - - Please avoid non-builtin lexers to avoid complications - - For more information, see `#27`_ - - - Relative hyperlinks will not work (e.g. ``./UNLICENSE``) - - - According to Stack Overflow, hyperlinks must use a scheme (e.g. ``http``, ``https``) and that scheme must be whitelisted - - - http://stackoverflow.com/a/16594755 - - - Please use absolute hyperlinks (e.g. ``https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE``) - - .. _`#27`: https://github.com/twolfson/restructuredtext-lint/issues/27 - - Documentation - ------------- - ``restructuredtext-lint`` exposes a ``lint`` and ``lint_file`` function - - ``restructuredtext_lint.lint(content, filepath=None, rst_prolog=None)`` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Lint `reStructuredText`_ and return errors - - - content ``String`` - `reStructuredText`_ to be linted - - filepath ``String`` - Optional path to file, this will be returned as the source - - rst_prolog ``String`` - Optional content to prepend to content, line numbers will be offset to ignore this - - Returns: - - - errors ``List`` - List of errors - - - Each error is a class from `docutils`_ with the following attrs - - - line ``Integer|None`` - Line where the error occurred - - - On rare occasions, this will be ``None`` (e.g. anonymous link mismatch) - - - source ``String`` - ``filepath`` provided in parameters - - level ``Integer`` - Level of the warning - - - Levels represent 'info': 1, 'warning': 2, 'error': 3, 'severe': 4 - - - type ``String`` - Noun describing the error level - - - Levels can be 'INFO', 'WARNING', 'ERROR', or 'SEVERE' - - message ``String`` - Error message - - full_message ``String`` - Error message and source lines where the error occurred - - - It should be noted that ``level``, ``type``, ``message``, and ``full_message`` are custom attrs added onto the original ``system_message`` - - .. _`docutils`: http://docutils.sourceforge.net/ - - ``restructuredtext_lint.lint_file(filepath, encoding=None, *args, **kwargs)`` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Lint a `reStructuredText`_ file and return errors - - - filepath ``String`` - Path to file for linting - - encoding ``String`` - Encoding to read file in as - - - When ``None`` is provided, it will use OS default as provided by `locale.getpreferredencoding`_ - - The list of supported encodings can be found at http://docs.python.org/2/library/codecs.html#standard-encodings - - - ``*args`` - Additional arguments to be passed to ``lint`` - - ``**kwargs`` - Additional keyword arguments to be passed to ``lint`` - - .. _`locale.getpreferredencoding`: http://docs.python.org/2/library/locale.html#locale.getpreferredencoding - - Returns: Same structure as ``restructuredtext_lint.lint`` - - Extension - --------- - Under the hood, we leverage `docutils`_ for parsing reStructuredText documents. `docutils`_ supports adding new directives and roles via ``register_directive`` and ``register_role``. - - Sphinx - ^^^^^^ - Unfortunately due to customizations in `Sphinx's parser`_ we cannot include all of its directives/roles (see `#29`_). However, we can include some of them as one-offs. Here is an example of adding a directive from `Sphinx`_. - - .. _`Sphinx`: http://sphinx-doc.org/ - .. _`Sphinx's parser`: Sphinx_ - .. _`#29`: https://github.com/twolfson/restructuredtext-lint/issues/29#issuecomment-243456787 - - https://github.com/sphinx-doc/sphinx/blob/1.3/sphinx/directives/code.py - - **sphinx.rst** - - .. code:: rst - - Hello - ===== - World - - .. highlight:: python - - Hello World! - - **sphinx.py** - - .. code:: python - - # Load in our dependencies - from docutils.parsers.rst.directives import register_directive - from sphinx.directives.code import Highlight - import restructuredtext_lint - - # Load our new directive - register_directive('highlight', Highlight) - - # Lint our README - errors = restructuredtext_lint.lint_file('docs/sphinx/README.rst') - print errors[0].message # Error in "highlight" directive: no content permitted. - - Examples - -------- - Here is an example of all invalid properties - - .. code:: python - - rst = """ - Some content. - - Hello World - ======= - Some more content! - """ - errors = restructuredtext_lint.lint(rst, 'myfile.py') - errors[0].line # 5 - errors[0].source # myfile.py - errors[0].level # 2 - errors[0].type # WARNING - errors[0].message # Title underline too short. - errors[0].full_message # Title underline too short. - # - # Hello World - # ======= - - Contributing - ------------ - In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test via ``nosetests``. - - Donating - -------- - Support this project and `others by twolfson`_ via `donations`_. - - http://twolfson.com/support-me - - .. _`others by twolfson`: http://twolfson.com/projects - .. _donations: http://twolfson.com/support-me - - Unlicense - --------- - As of Nov 22 2013, Todd Wolfson has released this repository and its contents to the public domain. - - It has been released under the `UNLICENSE`_. - - .. _UNLICENSE: https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE - Keywords: restructuredtext,restructured text,rest,rst,lint Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha @@ -240,3 +14,237 @@ Classifier: License :: Public Domain Classifier: Operating System :: OS Independent Classifier: Topic :: Text Processing :: Markup + +restructuredtext-lint +===================== + +.. image:: https://travis-ci.org/twolfson/restructuredtext-lint.png?branch=master + :target: https://travis-ci.org/twolfson/restructuredtext-lint + :alt: Build Status + +`reStructuredText`_ `linter`_ + +This was created out of frustration with `PyPI`_; it sucks finding out your `reST`_ is invalid **after** uploading it. It is being developed in junction with a `Sublime Text`_ linter. + +.. _`reStructuredText`: http://docutils.sourceforge.net/rst.html +.. _`linter`: http://en.wikipedia.org/wiki/Lint_%28software%29 +.. _`reST`: `reStructuredText`_ +.. _`PyPI`: http://pypi.python.org/ +.. _`Sublime Text`: http://sublimetext.com/ + +Getting Started +--------------- +Install the module with: ``pip install restructuredtext_lint`` + +.. code:: python + + import restructuredtext_lint + errors = restructuredtext_lint.lint(""" + Hello World + ======= + """) + + # `errors` will be list of system messages + # [<system_message: <paragraph...><literal_block...>>] + errors[0].message # Title underline too short. + +CLI Utility +^^^^^^^^^^^ +For your convenience, we present a CLI utility ``rst-lint`` (also available as ``restructuredtext-lint``). + +.. code:: console + + $ rst-lint --help + usage: rst-lint [-h] [--version] [--format {text,json}] [--encoding ENCODING] + [--level {debug,info,warning,error,severe}] + [--rst-prolog RST_PROLOG] + path [path ...] + + Lint reStructuredText files. Returns 0 if all files pass linting, 1 for an + internal error, and 2 if linting failed. + + positional arguments: + path File/folder to lint + + optional arguments: + -h, --help show this help message and exit + --version show program's version number and exit + --format {text,json} Format of the output (default: "text") + --encoding ENCODING Encoding of the input file (e.g. "utf-8") + --level {debug,info,warning,error,severe} + Minimum error level to report (default: "warning") + --rst-prolog RST_PROLOG + reStructuredText content to prepend to all files + (useful for substitutions) + + $ rst-lint README.rst + WARNING README.rst:2 Title underline too short. + +Other tools +^^^^^^^^^^^ +``restructuredtext-lint`` is also integrated in other tools. A list can be found and updated in our wiki + +https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools + +PyPI issues +^^^^^^^^^^^ +While a document may lint cleanly locally, there can be issues when submitted it to `PyPI`_. Here are some common problems: + +- Usage of non-builtin lexers (e.g. ``bibtex``) will pass locally but not be recognized/parsable on `PyPI`_ + + - This is due to `PyPI`_ not having a non-builtin lexer installed + - Please avoid non-builtin lexers to avoid complications + - For more information, see `#27`_ + +- Relative hyperlinks will not work (e.g. ``./UNLICENSE``) + + - According to Stack Overflow, hyperlinks must use a scheme (e.g. ``http``, ``https``) and that scheme must be whitelisted + + - http://stackoverflow.com/a/16594755 + + - Please use absolute hyperlinks (e.g. ``https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE``) + +.. _`#27`: https://github.com/twolfson/restructuredtext-lint/issues/27 + +Documentation +------------- +``restructuredtext-lint`` exposes a ``lint`` and ``lint_file`` function + +``restructuredtext_lint.lint(content, filepath=None, rst_prolog=None)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Lint `reStructuredText`_ and return errors + +- content ``String`` - `reStructuredText`_ to be linted +- filepath ``String`` - Optional path to file, this will be returned as the source +- rst_prolog ``String`` - Optional content to prepend to content, line numbers will be offset to ignore this + +Returns: + +- errors ``List`` - List of errors + + - Each error is a class from `docutils`_ with the following attrs + + - line ``Integer|None`` - Line where the error occurred + + - On rare occasions, this will be ``None`` (e.g. anonymous link mismatch) + + - source ``String`` - ``filepath`` provided in parameters + - level ``Integer`` - Level of the warning + + - Levels represent 'info': 1, 'warning': 2, 'error': 3, 'severe': 4 + + - type ``String`` - Noun describing the error level + + - Levels can be 'INFO', 'WARNING', 'ERROR', or 'SEVERE' + - message ``String`` - Error message + - full_message ``String`` - Error message and source lines where the error occurred + + - It should be noted that ``level``, ``type``, ``message``, and ``full_message`` are custom attrs added onto the original ``system_message`` + +.. _`docutils`: http://docutils.sourceforge.net/ + +``restructuredtext_lint.lint_file(filepath, encoding=None, *args, **kwargs)`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Lint a `reStructuredText`_ file and return errors + +- filepath ``String`` - Path to file for linting +- encoding ``String`` - Encoding to read file in as + + - When ``None`` is provided, it will use OS default as provided by `locale.getpreferredencoding`_ + - The list of supported encodings can be found at http://docs.python.org/2/library/codecs.html#standard-encodings + +- ``*args`` - Additional arguments to be passed to ``lint`` +- ``**kwargs`` - Additional keyword arguments to be passed to ``lint`` + +.. _`locale.getpreferredencoding`: http://docs.python.org/2/library/locale.html#locale.getpreferredencoding + +Returns: Same structure as ``restructuredtext_lint.lint`` + +Extension +--------- +Under the hood, we leverage `docutils`_ for parsing reStructuredText documents. `docutils`_ supports adding new directives and roles via ``register_directive`` and ``register_role``. + +Sphinx +^^^^^^ +Unfortunately due to customizations in `Sphinx's parser`_ we cannot include all of its directives/roles (see `#29`_). However, we can include some of them as one-offs. Here is an example of adding a directive from `Sphinx`_. + +.. _`Sphinx`: http://sphinx-doc.org/ +.. _`Sphinx's parser`: Sphinx_ +.. _`#29`: https://github.com/twolfson/restructuredtext-lint/issues/29#issuecomment-243456787 + +https://github.com/sphinx-doc/sphinx/blob/1.3/sphinx/directives/code.py + +**sphinx.rst** + +.. code:: rst + + Hello + ===== + World + + .. highlight:: python + + Hello World! + +**sphinx.py** + +.. code:: python + + # Load in our dependencies + from docutils.parsers.rst.directives import register_directive + from sphinx.directives.code import Highlight + import restructuredtext_lint + + # Load our new directive + register_directive('highlight', Highlight) + + # Lint our README + errors = restructuredtext_lint.lint_file('docs/sphinx/README.rst') + print errors[0].message # Error in "highlight" directive: no content permitted. + +Examples +-------- +Here is an example of all invalid properties + +.. code:: python + + rst = """ + Some content. + + Hello World + ======= + Some more content! + """ + errors = restructuredtext_lint.lint(rst, 'myfile.py') + errors[0].line # 5 + errors[0].source # myfile.py + errors[0].level # 2 + errors[0].type # WARNING + errors[0].message # Title underline too short. + errors[0].full_message # Title underline too short. + # + # Hello World + # ======= + +Contributing +------------ +In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test via ``nosetests``. + +Donating +-------- +Support this project and `others by twolfson`_ via `donations`_. + +http://twolfson.com/support-me + +.. _`others by twolfson`: http://twolfson.com/projects +.. _donations: http://twolfson.com/support-me + +Unlicense +--------- +As of Nov 22 2013, Todd Wolfson has released this repository and its contents to the public domain. + +It has been released under the `UNLICENSE`_. + +.. _UNLICENSE: https://github.com/twolfson/restructuredtext-lint/blob/master/UNLICENSE + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/restructuredtext_lint-1.3.0/restructuredtext_lint.egg-info/SOURCES.txt new/restructuredtext_lint-1.4.0/restructuredtext_lint.egg-info/SOURCES.txt --- old/restructuredtext_lint-1.3.0/restructuredtext_lint.egg-info/SOURCES.txt 2019-03-23 23:11:09.000000000 +0100 +++ new/restructuredtext_lint-1.4.0/restructuredtext_lint.egg-info/SOURCES.txt 2022-02-24 06:51:10.000000000 +0100 @@ -12,11 +12,8 @@ test.sh restructuredtext_lint/VERSION restructuredtext_lint/__init__.py -restructuredtext_lint/__init__.pyc restructuredtext_lint/cli.py -restructuredtext_lint/cli.pyc restructuredtext_lint/lint.py -restructuredtext_lint/lint.pyc restructuredtext_lint.egg-info/PKG-INFO restructuredtext_lint.egg-info/SOURCES.txt restructuredtext_lint.egg-info/dependency_links.txt @@ -25,9 +22,7 @@ restructuredtext_lint.egg-info/requires.txt restructuredtext_lint.egg-info/top_level.txt restructuredtext_lint/test/__init__.py -restructuredtext_lint/test/__init__.pyc restructuredtext_lint/test/test.py -restructuredtext_lint/test/test.pyc restructuredtext_lint/test/test_files/invalid.rst restructuredtext_lint/test/test_files/invalid_line_mismatch.rst restructuredtext_lint/test/test_files/invalid_link.rst