From 1277e6d00b4d8800c4bfb6bf9134774c5374e9b5 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 4 Nov 2021 01:07:42 +0100 Subject: [PATCH] Fix pylint --- .pylintrc | 3 ++- src/bot.py | 6 +++--- src/log.py | 2 +- test/conftest.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6df1145..78b6d2c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -12,7 +12,8 @@ disable= wrong-import-position, redefined-outer-name, invalid-name, - no-self-use + no-self-use, + too-many-instance-attributes [FORMAT] indent-string=' ' diff --git a/src/bot.py b/src/bot.py index 0692a1c..16e1320 100644 --- a/src/bot.py +++ b/src/bot.py @@ -91,7 +91,7 @@ class Music(commands.Cog): def after(err): if err: - self.logger.error(f"Player error: {err}") + self.logger.error("Player error: %s", err) self._next() ctx.voice_client.play(audio, after=after) embed = NowPlayingMessage(title=song.title, url=song.webpage_url) @@ -99,7 +99,7 @@ class Music(commands.Cog): await self._add_skip_button(msg) # pylint: disable=broad-except except Exception as err: - self.logger.error(f"Error during playback: {err}") + self.logger.error("Error during playback: %s", err) if ctx: embed = ErrorMessage(str(err)) await ctx.send(embed=embed) @@ -172,7 +172,7 @@ if __name__ == "__main__": @bot.event async def on_ready(): - logger.info(f"Logged in as {bot.user} ({bot.user.id})") + logger.info("Logged in as %s (%s)", bot.user, bot.user.id) logger.info('------') bot.add_cog(Music(bot, logger=logger)) diff --git a/src/log.py b/src/log.py index f64ab58..21cb5f3 100644 --- a/src/log.py +++ b/src/log.py @@ -22,7 +22,7 @@ def create_logger(name: str) -> logging.Logger: COMMIT = os.getenv('GIT_COMMIT') or 'no-commit' timestamp = datetime.now().strftime("%Y-%m-%dT%H:%M:%S") - log_path = "%s_%s.log" % (COMMIT, timestamp) + log_path = f"{COMMIT}_{timestamp}.log" file_handler = logging.FileHandler(log_path) diff --git a/test/conftest.py b/test/conftest.py index 6da72fa..5413a8f 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -16,7 +16,7 @@ from bot import Music @pytest.fixture(scope="session", autouse=True) -def start_xvfb_server(request): +def global_teardown(): yield logs = glob.glob('*.log') for log in logs: