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 group: test
image: pipelinecomponents/pylint image: pipelinecomponents/pylint
commands: commands:
- pip install GitPython --quiet
- pylint gitdch - pylint gitdch
test-flake8: test-flake8:

16
gitdch
View file

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