Use pre-commit to run pep8 checks

Change-Id: Ib3f381f5a7f41218852d0e3d6448e72b47f1b538
This commit is contained in:
Takashi Kajinami 2025-04-14 13:17:18 +09:00
parent 464503d592
commit f2fd234020
9 changed files with 102 additions and 63 deletions

29
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,29 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
# Replaces or checks mixed line ending
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
# Forbid files which have a UTF-8 byte-order marker
- id: check-byte-order-marker
# Checks that non-binary executables have a proper shebang
- id: check-executables-have-shebangs
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ breakpoint()
# calls in python source
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://opendev.org/openstack/hacking
rev: 7.0.0
hooks:
- id: hacking
additional_dependencies: []
- repo: https://github.com/PyCQA/doc8
rev: v1.1.2
hooks:
- id: doc8

View File

@ -20,6 +20,6 @@ class LocalNodeDiscovery(plugin_base.DiscoveryBase):
"""Return local node as resource."""
return [self.conf.host]
@ property
@property
def group_id(self):
return "LocalNode-%s" % self.conf.host

View File

@ -1,3 +1,16 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Ceilometer documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 27 11:38:59 2011.
@ -11,8 +24,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
@ -23,12 +36,12 @@ sys.path.insert(0, BASE_DIR)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings.
# They can be extensions coming with Sphinx (named 'sphinx.ext.*')
@ -41,8 +54,8 @@ extensions = [
'oslo_config.sphinxconfiggen',
]
config_generator_config_file = os.path.join(ROOT,
'etc/ceilometer/ceilometer-config-generator.conf')
config_generator_config_file = os.path.join(
ROOT, 'etc/ceilometer/ceilometer-config-generator.conf')
sample_config_basename = '_static/ceilometer'
todo_include_todos = True
@ -51,7 +64,7 @@ todo_include_todos = True
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
@ -62,13 +75,13 @@ copyright = '2012-2015, OpenStack Foundation'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -76,14 +89,14 @@ exclude_patterns = ['**/#*', '**~', '**/#*#']
# The reST default role (used for this markup: `text`)
# to use for all documents.
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
@ -93,7 +106,7 @@ show_authors = False
pygments_style = 'native'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
primary_domain = 'py'
nitpicky = False
@ -115,65 +128,65 @@ openstackdocs_bug_project = 'ceilometer'
openstackdocs_bug_tag = ''
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# html_static_path = ['_static']
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Ceilometerdoc'
@ -206,23 +219,23 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output -------------------------------------------
@ -235,7 +248,7 @@ man_pages = [
]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for Texinfo output -----------------------------------------------
@ -249,13 +262,13 @@ texinfo_documents = [
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# -- Options for Epub output --------------------------------------------------
@ -268,37 +281,37 @@ epub_copyright = '2012-2015, OpenStack'
# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''
# epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# epub_scheme = ''
# The unique identifier of the text. This can be an ISBN number
# or the project homepage.
#epub_identifier = ''
# epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# epub_cover = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# epub_post_files = []
# A list of files that should not be packed into the epub file.
#epub_exclude_files = []
# epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# epub_tocdup = True
# NOTE(dhellmann): pbr used to set this option but now that we are
# using Sphinx>=1.6.2 it does not so we have to set it ourselves.

View File

@ -1,6 +1,6 @@
---
features:
- |
Identify user and projects names with the help of their UUIDs
in the polled samples. If they are identified, set "project_name"
Identify user and projects names with the help of their UUIDs
in the polled samples. If they are identified, set "project_name"
and "user_name" fields in the sample to the corresponding values.

View File

@ -1,6 +1,6 @@
---
upgrade:
- Configuration values can passed in via the querystring of publisher in
- Configuration values can passed in via the querystring of publisher in
pipeline. For example, rather than setting target, timeout, verify_ssl,
and batch_mode under [dispatcher_http] section of conf, you can specify
http://<target>/?verify_ssl=True&batch=True&timeout=10. Use `raw_only=1`

View File

@ -2,4 +2,4 @@
features:
- >
Ceilometer alarms code is now fully removed from code base.
Equivalent functionality is handled by Aodh.
Equivalent functionality is handled by Aodh.

View File

@ -2,5 +2,5 @@
critical:
- >
[`bug 1519767 <https://bugs.launchpad.net/ceilometer/+bug/1519767>`_]
fnmatch functionality in python <= 2.7.9 is not threadsafe. this issue and
fnmatch functionality in python <= 2.7.9 is not threadsafe. this issue and
its potential race conditions are now patched.

View File

@ -42,7 +42,7 @@ New Features
.. releasenotes/notes/remove-alarms-4df3cdb4f1fb5faa.yaml @ f24ea44401b8945c9cb8a34b2aedebba3c040691
- Ceilometer alarms code is now fully removed from code base. Equivalent functionality is handled by Aodh.
- Ceilometer alarms code is now fully removed from code base. Equivalent functionality is handled by Aodh.
.. releasenotes/notes/remove-cadf-http-f8449ced3d2a29d4.yaml @ 1689e7053f4e7587a2b836035cdfa4fda56667fc

View File

@ -33,14 +33,11 @@ commands =
coverage xml -o cover/coverage.xml
[testenv:pep8]
skip_install = true
deps =
hacking>=6.1.0,<6.2.0
doc8
pre-commit
commands =
flake8
doc8 {posargs}
# Check that .po and .pot files are valid:
bash -c "find ceilometer -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"
pre-commit run -a
[testenv:releasenotes]
deps =