From b28ed3385cf00638be08aa15e28f2161e1df3f51 Mon Sep 17 00:00:00 2001 From: devfle <52854338+devfle@users.noreply.github.com> Date: Thu, 1 Jun 2023 22:34:51 +0000 Subject: [PATCH] refactor: resolve linter error --- .github/workflows/pylint.yml | 2 +- main.py | 11 ++++++----- tests/test_main.py | 9 +++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index e44f0a7..63bb8cc 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/main.py b/main.py index 4ed6cb3..42ebe7b 100644 --- a/main.py +++ b/main.py @@ -36,16 +36,17 @@ def generate_content(readme_instance: ReadmeLevel, start_section: str, end_secti user_level, to_next_lvl = itemgetter("current_level", "percentage_level")(readme_instance.get_current_level) - CONTRIBUTION_EP = readme_instance.get_contribution_ep - FOLLOWER_EP = readme_instance.get_follower_ep + contribution_ep = readme_instance.get_contribution_ep + follower_ep = readme_instance.get_follower_ep # should be generated in later versions - ep_information = (f"
💪 1x contribute → { CONTRIBUTION_EP } experience points\n"
-                      f"🌟 1x follower → { FOLLOWER_EP } experience points
\n") + ep_information = (f"
💪 1x contribute → { contribution_ep } experience points\n"
+                      f"🌟 1x follower → { follower_ep } experience points
\n") return (f"{start_section}\n" f"{ getenv('INPUT_CARD_TITLE') if getenv('INPUT_CARD_TITLE') else '' } \n" - f"
level: { user_level }  { draw_progress_bar(to_next_lvl) } {round(to_next_lvl, 2)}%
\n" + f"
level: { user_level }  \
+            { draw_progress_bar(to_next_lvl) } {round(to_next_lvl, 2)}%
\n" f"{ ep_information if getenv('INPUT_SHOW_EP_INFO') else '' }" f"{end_section}") diff --git a/tests/test_main.py b/tests/test_main.py index 1b70686..ae8bf0b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -50,16 +50,17 @@ def test_generate_content(self) -> None: mock_readme_instance.get_current_level.return_value = { "current_level": "10", "percentage_level": 20} - START_SECTION: str = "" - END_SECTION: str = "" + start_section: str = "" + end_section: str = "" with patch('main.draw_progress_bar') as mock_draw_progress_bar: mock_draw_progress_bar.return_value = "██████░░░░░░░░░░░░░░░░░░░░░░░░" replace_str: str = generate_content( - mock_readme_instance, START_SECTION, END_SECTION) + mock_readme_instance, start_section, end_section) - # we check only if return value is from type str because the spaces makes it realy difficult to check for isEqual + # we check only if return value is from type str because the spaces makes + # it realy difficult to check for isEqual self.assertIsInstance(replace_str, str)