Fix zuul checks

Fix docs and docs-linkcheck tox targets:
It looks like recently sphinx began to check if footnotes are
referenced. If not, it issues a warning which is treated as error.

Fix Python 3.10 and 3.11:
It looks like opendev switched to Noble Ubuntu release.
Pin these versions to previous one.

Shift flake8 version.
New version ignores syntax whithin strings.

Fix formatting errors reported by flake8.

Change-Id: I9b23cccf0dc83fb56083b5fe8c9c026f5dff7e9a
This commit is contained in:
Vsevolod Fedorov 2024-10-29 13:55:06 +03:00
parent b500b95c56
commit 643a58e255
9 changed files with 17 additions and 13 deletions

View File

@ -13,13 +13,13 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.7.8 rev: 6.1.0
hooks: hooks:
- id: flake8 - id: flake8
args: ['--config=setup.cfg'] args: ['--config=setup.cfg']
types: [python] types: [python]
additional_dependencies: additional_dependencies:
- flake8>=3.7.8 - flake8>=6.1.0
- flake8-black - flake8-black
- black==21.12b0 # the last version that supports Python 2 - black==21.12b0 # the last version that supports Python 2
language_version: python3 language_version: python3

View File

@ -32,8 +32,10 @@
nodeset: ubuntu-focal nodeset: ubuntu-focal
- tox-py39: - tox-py39:
nodeset: ubuntu-focal nodeset: ubuntu-focal
- tox-py310 - tox-py310:
- tox-py311 nodeset: ubuntu-jammy
- tox-py311:
nodeset: ubuntu-jammy
- jjb-tox-linters - jjb-tox-linters
- jjb-tox-cross-python-jenkins - jjb-tox-cross-python-jenkins
- jjb-tox-docs-linkcheck - jjb-tox-docs-linkcheck
@ -44,5 +46,7 @@
nodeset: ubuntu-focal nodeset: ubuntu-focal
- tox-py39: - tox-py39:
nodeset: ubuntu-focal nodeset: ubuntu-focal
- tox-py310 - tox-py310:
- tox-py311 nodeset: ubuntu-jammy
- tox-py311:
nodeset: ubuntu-jammy

View File

@ -350,7 +350,7 @@ To delete jobs/views that only have 'foo' in their name::
Providing Plugins Info Providing Plugins Info
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
With Jenkins LTS 1.651.1+ retrieving plugins info became a secure feature and With Jenkins LTS 1.651.1+ retrieving plugins info became a secure feature and
now requires Administrator rights to use [#f2]. This causes JJB to no longer be now requires Administrator rights to use [#f2]_. This causes JJB to no longer be
able to work in situations where a user wants to publish jobs to Jenkins but is able to work in situations where a user wants to publish jobs to Jenkins but is
not able to receive the Administrator permissions. In this case we can provide not able to receive the Administrator permissions. In this case we can provide
a plugins_info.yaml file containing the plugin versions data needed by JJB to a plugins_info.yaml file containing the plugin versions data needed by JJB to

View File

@ -114,7 +114,7 @@ def is_point_included(exclude_list, params, key_pos=None):
return False return False
except JenkinsJobsException as x: except JenkinsJobsException as x:
raise x.with_context( raise x.with_context(
f"In template exclude list", "In template exclude list",
pos=key_pos, pos=key_pos,
) )
return True return True

View File

@ -17,7 +17,7 @@ def context_lines(message, pos):
return [message] return [message]
snippet_lines = [line.rstrip() for line in pos.snippet.splitlines()] snippet_lines = [line.rstrip() for line in pos.snippet.splitlines()]
return [ return [
f"{pos.path}:{pos.line+1}:{pos.column+1}: {message}", f"{pos.path}:{pos.line + 1}:{pos.column + 1}: {message}",
*snippet_lines, *snippet_lines,
] ]

View File

@ -692,7 +692,7 @@ def convert_mapping_to_xml(parent, data, mapping, fail_required=True):
if val not in valid_options: if val not in valid_options:
raise InvalidAttributeError(optname, val, valid_options) raise InvalidAttributeError(optname, val, valid_options)
if type(val) == bool: if type(val) is bool:
val = str(val).lower() val = str(val).lower()
if val in valid_dict: if val in valid_dict:

View File

@ -2053,7 +2053,7 @@ def add_notification_context_trait(traits, data):
nc_suffix = nc.get("suffix", None) nc_suffix = nc.get("suffix", None)
if nc_suffix is None: if nc_suffix is None:
nc_trait_suffix.text = "true" nc_trait_suffix.text = "true"
elif type(nc_suffix) == bool: elif type(nc_suffix) is bool:
nc_trait_suffix.text = str(nc_suffix).lower() nc_trait_suffix.text = str(nc_suffix).lower()
else: else:
nc_trait_suffix.text = nc_suffix nc_trait_suffix.text = nc_suffix

View File

@ -916,7 +916,7 @@ def cloverphp(registry, xml_parent, data):
for t_type in ["method", "statement"]: for t_type in ["method", "statement"]:
val = metrics.get(target, {}).get(t_type) val = metrics.get(target, {}).get(t_type)
if val is None or type(val) != int: if val is None or type(val) is not int:
continue continue
if val < 0 or val > 100: if val < 0 or val > 100:
raise JenkinsJobsException( raise JenkinsJobsException(

View File

@ -420,7 +420,7 @@ def git(registry, xml_parent, data):
xe = XML.SubElement(scm, xmlname, attrs) xe = XML.SubElement(scm, xmlname, attrs)
if optname and optname in data: if optname and optname in data:
val = data[optname] val = data[optname]
if type(val) == bool: if type(val) is bool:
xe.text = str(val).lower() xe.text = str(val).lower()
else: else:
xe.text = val xe.text = val