Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: I093ca79022578b99bdb3ef78e887eef9bc3310ad
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Switch to openstackdocstheme 2.2.1 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering problems
Update Sphinx version as well.
openstackdocstheme renames some variables, so follow the renames. A
couple of variables are also not needed anymore, remove them.
Set openstackdocs_auto_name to use project as name.
Change pygments_style to 'native' since old theme version always used
'native' and the theme now respects the setting and using 'sphinx' can
lead to some strange rendering.
See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014971.html
Change-Id: I129fcb2f17f7938b72fa788afa99004cc0be1d84
This was missed in change Ice407c712b5438b06c4f439c73946640a0c5a86d.
While we're here, we clean up some other bits of mess that were left
behind by that.
Change-Id: Id061758834eaf266766ab7344c4547fce4261e89
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.
[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045
Change-Id: If8c19a7d5d2a6ca089efb6c19d81a277aba7f06d
Translation of log messages was ceased starting with Pike, but these
guidelines were only partially updated (by Ia34ad79ca9), with a small
warning block buried in the middle of a long page of unchanged
guidelines which it somewhat contradicted.
So update the rest of the page to align with current best practices in
order to avoid confusion.
Also summarise the primary reasons for the change in policy, so that
curious readers don't have to trawl through long email threads to find
out.
Change-Id: Ib86013ff5e7bd07ddc696da2e4c56ce9d07f0cb6
No new implementers of this library should be using the log-oriented
marker functions, so we shouldn't be providing examples of them.
This change removes them from the sample integration module and
updates the usage examples to reflect the current best practices.
Change-Id: I0ae89cb3500821465438ee1f5572ab5e3573044c
Now that we have decided to skip log translations, let's stop telling
people to set them up. This change adds a note saying the work is not
needed, but leaves the instructions so that someone trying to understand
existing code can review them. The actual translation functions will be
marked for deprecation in the future, when enough projects have dropped
using them to warrant that change.
Change-Id: Ia34ad79ca9c6d1ea862b6954669c992a898a03ff
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit documents tips on how to display translated strings.
It covers envvar usage on locale directory and preferred languages.
Change-Id: Icf5618954500e56e3de087d4f369dbd72c54c564
We introduced contextual/plural translation in version 2.1.0,
so declare this in documentation to avoid AttributeError.
Change-Id: Iadc24d19e2a2b799a5009a806ee7c64867b1d554
Related-Bug: #1525992
It would be nice if the _i18n.py example can be copy-and-paste
to myapp/_i18n.py without pep8 errors.
Change-Id: I9ff4174ba1cac56c8b20ba572757fb54baa1e9bb
. Updated example to define DOMAIN and get_available_languages()
as seen in several projects.
. Ensured myapp is consistent in various examples.
. Emphasized note on private naming implementation.
. Updated example to show get_available_languages().
Change-Id: I2f925a7631677aa0534de668a617458febf0bb08
This seems to better match what the other oslo
libraries are calling this section, so we might as
well call it that to.
Change-Id: Ib8b0fb687815d98c2257105ffb7da0cf9d3d21fb
Update the policy about which changes should be translated based on the
cross-project meeting from 2015-06-30.
Change-Id: Id32e3aa0f117920c28afdeb04e5bd553af4e0629
The current example in the guidelines for using translation markers
has the closing parenthesis including the string as well as the
formatting argument. This has caused some confusion in reviews where
someone incorrectly follows this pattern and ends up with pep8 errors.
This patch corrects the closing parenthesis placement for both examples
in the "Avoid Forcing the Tranlation of Translatable Variable" section.
Change-Id: I5cd80c3ebec57a7e3686cac946427f7b6e6f3d6d
There was confusion in a cinder review with respect
to the case where a message is used both in a log
and in an exception:
https://review.openstack.org/#/c/155894/2
This update is to clarify the guidelines to help
prevent similar confusion in the future.
Change-Id: Ia26b4d3efafb8ad13c45e982a1be7aea176417e1
Move the public API out of oslo.i18n to oslo_i18n. Retain the ability to
import from the old namespace package for backwards compatibility for
this release cycle.
bp/drop-namespace-packages
Change-Id: I800f121c271d8e69f6e776c4aef509bbb8008170
Added note to guidelines.rst about this case and added an example
in usage.rst.
Closes-Bug: #1378053
Change-Id: Ie29441e0f354aab2b04d731dc5d597390b89783d
The first code example for "Creating an Integration Module"
(http://docs.openstack.org/developer/oslo.i18n/usage.html) is not
rendered correctly, it is because the wrong indentation.
This patch corrects this mistake, and uses a same indentation in cross
of the whole file.
Change-Id: I74189de25d3611ed6a57cf35fee6682b81056071
Closes-Bug: #1374477
Add documentation for how to add import exceptions so hacking does not
complain about the way the library is used.
Change-Id: Ic33307215abbc38d3d3d2435588f79dc115510fd
Include the ChangeLog generated by pbr in the documentation
Closes-Bug: 1336974
Change-Id: I2f2cb935dc52d5d0e9ddc4439a0022f739776f45
Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
Rather than forcing everyone to say "from oslo.i18n import gettextutils"
allow "from oslo import i18n".
Change-Id: If87182beb8c7fa6a12f7a1524fdda4910b4e19d5
Start building up a list of links to the history of the policy
discussions about internationalization and translation. This list is not
yet complete, and other links can be added in later changesets.
Change-Id: I5a5dc636a6612dc13c0fdea765fc89083f282cfc
Provide more detailed guidelines based on the info we have in the
wiki at https://wiki.openstack.org/wiki/LoggingStandards#Guidelines
Provide API documentation for the gettextutils module.
Fix up some formatting issues with the contributing page that kept it
from being included in the table of contents.
Add a description to the README.
Other minor section and document title fixes, and remove unused pages.
Change-Id: I1e0a2be2918fe8f5d4194fc5a82b19edb225c1d0
Update lazy flag handling to check it at runtime when each message is
translated, instead of once at startup when the translation function is
created. This allows a library to support lazy translation, without
requiring an application that uses the library to support it.
Change-Id: Iae22668119c8d0f5fb9c486436bfc35cdb88ac58
Clean up the documentation a little bit and write slightly
more verbose (and correct) instructions for using the library.
bp graduate-oslo-i18n
Change-Id: Ice626b6eae3c02be84cf79a1ad57817ec8736d8a