Commit Graph

19 Commits

Author SHA1 Message Date
Nguyen Van Trung
97dbfb02d7 Add doc8 to pep8 check for glance project
This patch adds a doc8 check of .rst files to the current pep8 check.
It includes fixes to the .rst files that didn't pass the check.

Co-authored-By: Hoang Trung Hieu <hieuht@vn.fujitsu.com>
Change-Id: I5a9299200202576d97760ebf07bceb930888f2d7
2018-01-19 08:20:56 +00:00
Erno Kuvaja
87a56ce5c7 Stop enforcing translations on logs
Translations team has stopped translating the logs. We need to
stop enforcing the usage of translation functions on logging.

Change-Id: I56900846ce8ea92eaa3873f64b383a36a4974908
2017-05-31 11:35:53 +01:00
Sachin Patil
50b0252a25 Corrected section underline
Section underline must be at least as long as the title text

Change-Id: I13f5398bb564c91af6c721c699a5552f2a07e561
2016-04-15 11:40:59 +05:30
abhishekkekane
e1b5d6d0b9 Hacking checks for not using dict iteration calls
Add hacking checks to check dict.iteritems, dict.itervalues
and dict.iterkeys should not be used in the future and
raise error while running pep8 using tox.

Trivial Fix

Change-Id: Id7f0c8b963cfd5739ed3e2ecec2c0feebc290af4
2016-01-25 21:54:08 -08:00
Bo Wang
005526111d Add hacking check to ensure not use xrange()
xrange() does not exist in python3.
Add hacking check rule so that codes with xragne() never pass test.

Change-Id: I40f6d9aab3ef334da46bd460eb6a4ed3948e951e
2016-01-22 19:40:20 +08:00
ChangBo Guo(gcb)
9d4225289b Leverage dict comprehension in PEP-0274
PEP-0274 introduced dict comprehensions to replace dict constructor
with a sequence of key-pairs[1], these are two benefits:
- First, it makes the code look neater.
- Second, it gains a micro-optimization.

Glance dropped python 2.6 support in Kilo, we can leverage this now.
Note: This commit doesn't handle dict constructor with kwargs.
This commit also adds a hacking rule.

[1]http://legacy.python.org/dev/peps/pep-0274/

Co-Authored-By: ChangBo Guo(gcb) <eric.guo@easystack.cn>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
Change-Id: I0ba408f9c616dcdb09618f6256db76b9facc0c1d
2015-05-28 01:46:02 +00:00
ChangBo Guo(gcb)
27539859ec Remove use of contextlib.nested
The contextlib.nested call has been deprecated
in Python 2.7. This causes DeprecationWarning
messages in the unit tests.

There are also known issues with contextlib.nested
that were addressed by the native support for
multiple "with" variables. For instance, if the
first object is created but the second one throws
an exception, the first object's __exit__ is never
called. For more information see
https://docs.python.org/2/library/contextlib.html#contextlib.nested
contextlib.nested is also not compatible in Python 3.

Since Glance no longer supports 2.6 we can remove
the use of these contextlib.nested calls.

Added hacking check to catch if any new instances
are added to the codebase.

Closes-Bug: #1428424
Change-Id: Ic8edfa41d6c468cf6db8d11d3533e4f8cf2053c2
2015-03-18 20:20:33 +08:00
Pranali Deore
6eebebc80b Replace '_' with '_LI', '_LE', '_LW', '_LC'
oslo.i18n uses different marker functions to separate the
translatable messages into different catalogs, which the translation
teams can prioritize translating. For details, please refer to:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html#guidelines-for-use-in-openstack

Added hacking rules for warning, info, critical, error and exception
about checking translation for log messages and fixed for below cases only,
1. LOG.error(_(""))
2. LOG.info(_(""))
3. LOG.exception(_(""))
4. LOG.critical(_(""))
5. LOG.warning(_(""))

Below scenario is not handled in this patch,
If message is passed to LOG call using separate variable,
ex.
    msg = (_("")
    LOG.error(msg)

Change-Id: Idbf8779cdfc41ca1424bebcd101096bec482872f
2014-12-19 02:34:55 -08:00
Louis Taylor
70beb11924 Enforce using six.text_type() over unicode()
For python 3 compatibility, this adds a hacking check to prevent the
usage of unicode().

Change-Id: I791bbf251ac0f9615a9bedc2dd295a7982d72e0a
Closes-bug: #1282893
2014-09-18 09:51:04 +00:00
Chris Buccella
3994eeb862 Add hacking checks
There have been a handful of changes recently to fix stylistic bugs
in the unit tests (example: If41a7). The changes themselves were fine,
but there are two problems:

1) The stylistic changes they made were not listed in HACKING.rst
2) They were one-time changes; the rules that were violated will
   continue to be violated.

This change updates HACKING.rst to include a few of the stylistic
rules that have been fixed recently, and adds checks to ensure that
they will be enforced going forward. This is based on nova's hacking
checks.

Change-Id: Ic115342605c472f3a5d255aa570ecb60175ca087
2014-06-10 02:06:56 +00:00
Christian Berendt
86dd9ff66c debug level logs should not be translated
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.

This patch adds a new hacking check - N319 - that ensures all
debug log messages don't have translations.

Change-Id: I9dd958b904671a7eb95883026e14684469dc52d5
Closes-Bug: #1317847
2014-05-23 15:57:06 +02:00
Keshava Bharadwaj
6ea690b5c9 Cleanup and make HACKING.rst DRYer
Reference the OpenStack hacking guide in HACKING.rst and remove
duplicate entries. Adds placeholder section for glance specific
rules.

Change-Id: I1bfff8c69c9370e2d648197b7e71e229695ef627
2013-10-16 22:41:15 +05:30
Thomas Bechtold
04409386e7 Replace openstack-common with oslo in HACKING.rst
Change-Id: I211d128dce385a173cac5fec9df413b813bc4626
2013-06-10 13:48:17 +02:00
Alex Meade
acc2900429 Expand HACKING with commit message guidelines
Add a 'Commit Messages' section to HACKING describing how a commit
message should be formed.

Change-Id: I49f7c3febf65db246a84b0314597615f8d0ba247
2013-04-26 15:27:09 -04:00
Zhongyue Luo
5674da98b1 Update HACKING.rst per recent changes
Added "is not" usage with examples
Fixed "not in" usage description
* https://review.openstack.org/#/c/20877/

Change-Id: I89fbc62a8b31bc7ef750cc1e80f73b9c1e366fd3
2013-02-04 10:23:11 +08:00
Zhongyue Luo
d7be5c1982 Fixes 'not in' operator usage
Fixes bug #1111254

Change-Id: I297829049213732217332a969aa107525ac13600
2013-01-31 23:02:09 +08:00
Brian Waldon
4363af6cc8 Standardize logger instantiation
Use LOG for variable name and __name__ for logger name. Also
document this fact in HACKING.rst

Fixes bug 1015685

Change-Id: I0d9d80bef66197a28ed3d650f17859202048d776
2012-06-25 08:27:08 -07:00
Brian Waldon
8b23d4faaf Integrate openstack-common using update.py
* Update all cfg and setup imports to point to new location
* Fixes bug 987968

Change-Id: If2fbf126e0b241e80ee59fa4e43bb5af6eb879a8
2012-04-30 14:01:13 -07:00
Jay Pipes
c713c22a25 Few small cleanups to align with Nova
* Adds HACKING.rst -- with some modifications that do not apply
  to Glance
* Renames README to README.rst
* Remove old cruft with rfc.sh and BZR stuff

Change-Id: I1ff640fcee71e4d9bafa28ddd83c779ac4d702d2
2012-01-25 11:14:51 -05:00