Fix some pylint warning (and CI step dependency)
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Benjamin Renard 2022-05-01 01:52:46 +02:00
parent e6dfa50e0e
commit e61d82e025
2 changed files with 9 additions and 8 deletions

View file

@ -8,6 +8,7 @@ pipeline:
group: test
image: pipelinecomponents/pylint
commands:
- pip install GitPython --quiet
- pylint gitdch
test-flake8:

16
gitdch
View file

@ -55,7 +55,7 @@ parser.add_argument(
'--path',
type=str,
dest='git_path',
help='Git repository path (default: %s)' % DEFAULT_GIT_PATCH,
help=f'Git repository path (default: {DEFAULT_GIT_PATCH}',
default=DEFAULT_GIT_PATCH
)
@ -97,7 +97,7 @@ parser.add_argument(
'--code-name',
type=str,
dest='code_name',
help='Debian code name (default: %s)' % DEFAULT_CODE_NAME,
help=f'Debian code name (default: {DEFAULT_CODE_NAME})',
default=DEFAULT_CODE_NAME
)
@ -106,7 +106,7 @@ parser.add_argument(
'--urgency',
type=str,
dest='urgency',
help='Package urgency (default: %s)' % DEFAULT_URGENCY,
help=f'Package urgency (default: {DEFAULT_URGENCY})',
default=DEFAULT_URGENCY
)
@ -135,9 +135,7 @@ if not options.package_name:
# Initialize log
log = logging.getLogger()
logformat = logging.Formatter(
"%(asctime)s - {0} - %(levelname)s : %(message)s".format(
os.path.basename(sys.argv[0])
)
f'%(asctime)s - {os.path.basename(sys.argv[0])} - %(levelname)s : %(message)s'
)
# Set root logger to DEBUG (filtering done by handlers)
log.setLevel(logging.DEBUG)
@ -223,8 +221,9 @@ log.info('%d versions found', len(versions))
changelog_lines = []
for version in versions:
# pylint: disable=consider-using-f-string
changelog_lines.append(
'{package} ({version}-1) {code_name}; urgency={urgency}\n\n'.format(
'{package} ({version}-1) {code_name}; urgency={urgency}'.format(
package=options.package_name,
version=version['name'],
code_name=options.code_name,
@ -234,6 +233,7 @@ for version in versions:
for message in version['messages']:
changelog_lines.append(' * {0}\n'.format(message))
# pylint: disable=consider-using-f-string
changelog_lines.append(
"\n -- {name} <{email}> {date}\n\n".format(
name=(
@ -249,7 +249,7 @@ for version in versions:
if options.output:
log.info('Write generated Debian changelog in file %s', options.output)
with open(options.output, 'w') as fd:
with open(options.output, 'w', encoding='utf8') as fd:
fd.writelines(changelog_lines)
else:
print(''.join(changelog_lines))