Commit Graph

13 Commits

Author SHA1 Message Date
suzhengwei 6d77bc827a add pre-commit
This tool provides a extensible way to configure pre-commit hooks
to do something from running linters to spell-checking and it proved
to be useful.

Change-Id: I77cf6c85559989bd051798e601640e0039342924
2023-05-30 19:55:03 +08:00
shilpa.devharakar d7592cbe25 Register and Document policy in code
Adds below things for the implementation of framework for registering and
using default policy rules.
* Policy-in-code
  The framework for registering and using default policy rules.
  Rules should be defined and returned from a module in
  masakari/policies/, and then added to the list in masakari/policies/__init__.py.
  A new context.can() method has been added for policy enforcement of
  registered rules. It has the same parameters as the enforce() method
  currently being used.
* Add policy sample generation
  The entry point and config file necessary for using the
  oslo.policy sample generation script. It also adds a tox target to
  simplify the usage of it.
* Add policy documentation and sample file
  Documentation and sample file for default policy in code feature.
* Hacking check for policy registration
  It ensures that policy registration happens in the centralized
  masakari/policies/ directory.
* Hacking check for _ENFORCER.enforce()
  Hacking check in order to ensure that only registered policies
  are used for authorization checks _ENFORCER.authorize should be used rather
  than _ENFORCER.enforce.
* Add entry_point for oslo policy scripts
  There are two helper scripts in oslo.policy to help deployers understand
  their policy configuration better. With the setup.cfg entry these can be
  called directly from oslo.policy.

Changes done here are with the reference of [1] at NOVA side
which is contributed by Andrew Laski and Claudiu Belu

[1] https://review.openstack.org/#/q/topic:bp/policy-in-code+project:openstack/nova+status:merged

Change-Id: If885a66d92c31be440d27d6780635800a0b12e3e
2018-07-27 12:15:14 +05:30
Takashi NATSUME 2047226e5d Removed unnecessary parantheses in yield statements
The 'yield' statement is not a function.
So it must always be followed by a space when yielding a value.

Change-Id: I518d34da400400b678448805ea19e554f48dac85
2018-07-24 13:07:36 +09:00
poojajadhav 892e9b116c Hacking: do not translate log messages
Community has decided to do not translate log messages anymore.
The motivation behind removing translation jobs for log messages
is that when operators encounters any unfamiliar situations(e.g.
nova error, keystone error etc.), searching on the Internet
based on actual log content would have more results than searching
translated log messages.

In this patch I have added hacking rule to check that logs are
not translated.

Change-Id: I90d53d617aac6839c2f2ab119847cbf24a1300e0
2017-09-25 14:34:25 +05:30
Jenkins cba0222522 Merge "Update the documentation link for doc migration" 2017-08-16 07:05:10 +00:00
Dinesh Bhor 66c607c6e8 Enable global hacking checks and remove local checks
In newer hacking version 0.12.0 [1], we can enable some of the
non-default hacking rules (one by one), which are disabled by
default. The enabled rules are the following:

* [H106] Don’t put vim configuration in source files (off by default).
* [H203] Use assertIs(Not)None to check for None (off by default).
* [H904] Delay string interpolations at logging calls (off by default).

Enabled these hacking rules by adding them in the list of
'enable-extensions' in tox.ini [flake8] section. Removed the local
implementation of those hacking rules from hacking/checks.py.

The test-requirements.txt is already updated to use the newer
hacking version 0.12.0 with this commit:
cc44a33f3d

[1] See "Enabling off-by-default checks" section:
    https://pypi.python.org/pypi/hacking/0.12.0

Change-Id: Ieccd5a84ebd80ba3313016c9caeb036eaa37769b
2017-08-04 04:55:18 +00:00
Hangdong Zhang 5ef40b8a8f Update the documentation link for doc migration
Change-Id: If3ea8caadd5923e6222ce292a8dc0bf2561435b4
2017-07-24 16:34:45 +08:00
Van Hung Pham 7edf071253 Optimize the link address
Update link address to ensure safety and preciseness

Change-Id: Iae7efd7e026dfe0b167154ca38cf9cc1e0b84cc0
2017-06-08 18:37:08 +07:00
lcsong c9f7a3c56d Remove log translations
Log messages are no longer being translated. This removes all use of
the _LC, _LE, _LI and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I4c96f3590d46205c45d12ee4ead8c208e11c52c5
2017-04-05 08:11:09 +00:00
Takashi NATSUME 8e601d1183 Add a hacking rule to enforce use of LOG.warning
LOG.warn is deprecated.
LOG.warning should be used instead of LOG.warn.
So add the following hacking rule.

- [M331] LOG.warn is deprecated. Enforce use of LOG.warning.

Change-Id: I1f99331e2a51f8295eac0734aa653b4ff04ccf65
Closes-Bug: #1508442
2016-08-04 09:45:40 +09:00
Takashi NATSUME cd3be63409 Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled
by the logging code, rather than being done
at the point of the logging call.
So add a hacking rule for it.

See the oslo i18n guideline.

* http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: Ib7d97e6edbb8069c12b22505c0d6653b4a17ec78
Closes-Bug: #1596829
2016-08-02 14:47:59 +09:00
Abhishek Kekane 48051ece73 Add hacking checks
Added required hacking checks to follow OpenStack coding
standards.

Change-Id: I20fe168f364296844a593ec3880e1639637dbf06
2016-07-20 12:47:50 +05:30
sampathP b59503d7aa Initial Cookiecutter Commit.
Change-Id: I42dea4c1d43a041cfd948703355ce7456c8850e1
2016-06-28 13:28:27 +09:00