- Notifications
You must be signed in to change notification settings - Fork 5
Merge from master #658
Conversation
Merge from master
Run flake8 --count --select=E9,F63,F7,F82 --doctests --show-source --statistics ./kyu_4 0 ./kyu_4/the_greatest_warrior/warrior.py:89:17: W503 line break before binary operator or self.experience + experience > MAX_EXPERIENCE): ^ ./kyu_4/validate_sudoku_with_size/sudoku.py:61:35: W504 line break after binary operator if (len(self.__data) == 1 and ^ 1 W503 line break before binary operator 1 W504 line break after binary operator 0.15 seconds elapsed
pydocstyle fixes
Merge from master
suggestion: Consider handling evaluation errors from asteval. Directly returning the result from asteval.eval(s) may propagate exceptions for invalid expressions. It might be worthwhile to catch errors and return an appropriate message or handle the exception in a controlled manner.
suggestion (testing): Test case for empty string is missing. Add a test case with an empty string ("") to verify the function handles it correctly and returns an empty string. A backtick is missing before "eval()". It should be "eval()". Suggested implementation: from within a python program, without using `eval()` If there are similar occurrences of eval() in the file that aren't properly wrapped in backticks, consider updating them following the same pattern.
suggestion (code-quality): We've found these issues: Move setting of default value for variable into else branch (introduce-default-else) Replace if statement with if expression (assign-if-exp) Suggested change start = n // 2 if n % 2 != 0: start = n // 2 + 1 start = n // 2 + 1 if n % 2 != 0 else n // 2
Merge from master
Run flake8 --count --select=E9,F63,F7,F82 --doctests --show-source --statistics ./kyu_5 0 ./kyu_5/did_i_finish_my_sudoku/is_sudoku_done.py:27:13: W503 line break before binary operator and assert_sudoku_by_row(board) ^ ./kyu_5/did_i_finish_my_sudoku/is_sudoku_done.py:28:13: W503 line break before binary operator and assert_sudoku_by_region(board)): ^ 2 W503 line break before binary operator 0.395 seconds elapsed
pipeline refactoring
Merge from master
./kyu_6/disease_spread/epidemic.py:48:33: W504 line break after binary operator susceptible[k] - dt * ^ ./kyu_6/disease_spread/epidemic.py:49:25: W504 line break after binary operator kwargs['b'] * ^ ./kyu_6/disease_spread/epidemic.py:50:28: W504 line break after binary operator susceptible[k] * ^ ./kyu_6/disease_spread/epidemic.py:54:31: W504 line break after binary operator infecteds[k] + dt * ^ ./kyu_6/disease_spread/epidemic.py:55:26: W504 line break after binary operator (kwargs['b'] * ^ ./kyu_6/disease_spread/epidemic.py:56:29: W504 line break after binary operator susceptible[k] * ^ ./kyu_6/disease_spread/epidemic.py:57:41: W504 line break after binary operator infecteds[k] - kwargs['a'] *
Run python -m flake8 ./kyu_6 --count --benchmark --show-source --statistics ./kyu_6/disease_spread/epidemic.py:48:17: E126 continuation line over-indented for hanging indent susceptible[k] - dt * kwargs['b'] * susceptible[k] * infecteds[k] ^ ./kyu_6/disease_spread/epidemic.py:53:17: E126 continuation line over-indented for hanging indent infecteds[k] + dt * ^ ./kyu_6/disease_spread/epidemic.py:53:35: W504 line break after binary operator infecteds[k] + dt * ^
Run python -m flake8 ./kyu_6 --count --benchmark --show-source --statistics ./kyu_6/disease_spread/epidemic.py:53:31: W504 line break after binary operator infecteds[k] + dt * ^
Run python -m flake8 ./kyu_6 --count --benchmark --show-source --statistics ./kyu_6/potion_class_101/potion.py:52:24: W503 line break before binary operator * self.volume) / (other.volume + self.volume)) ^ ./kyu_6/potion_class_101/potion.py:54:24: W503 line break before binary operator * self.volume) / (other.volume + self.volume)) ^ ./kyu_6/potion_class_101/potion.py:56:24: W503 line break before binary operator * self.volume) / (other.volume + self.volume)) ^ 3 W503 line break before binary operator 0.313 seconds elapsed
Run python -m flake8 ./kyu_6 --count --benchmark --show-source --statistics ./kyu_6/potion_class_101/potion.py:52:75: W504 line break after binary operator (other.color[0] * other.volume + self.color[0] * self.volume) / ^ ./kyu_6/potion_class_101/potion.py:56:75: W504 line break after binary operator (other.color[1] * other.volume + self.color[1] * self.volume) / ^ ./kyu_6/potion_class_101/potion.py:60:75: W504 line break after binary operator (other.color[2] * other.volume + self.color[2] * self.volume) / ^ 3 W504 line break after binary operator 0.319 seconds elapsed
Run python -m flake8 ./kyu_6 --count --benchmark --show-source --statistics ./kyu_6/potion_class_101/potion.py:10:1: F401 'typing.ClassVar' imported but unused from typing import Tuple, ClassVar ^ 1 F401 'typing.ClassVar' imported but unused 0.32 seconds elapsed
./kyu_6/potion_class_101/potion.py:63 in private method `__calc_rgb`: D205: 1 blank line required between summary line and description (found 0) Multi-line docstrings consist of a summary line just like a one-line docstring, followed by a blank line, followed by a more elaborate description. The summary line may be used by automatic indexing tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line.
Merge pull request #651 from iKostanOrg/utils
Merge pull request #653 from iKostanOrg/utils
kyu_4/validate_sudoku_with_size/test_sudoku.py @@ -30,7 +31,85 @@ class SudokuTestCase(unittest.TestCase): """Testing Sudoku class.""" def test_sudoku_class(self): @parameterized.expand([ ([[1]], True, 'Testing valid 1x1'), Contributor @sourcery-ai sourcery-ai bot 3 minutes ago issue (testing): Duplicated test case The test case ([[1]], True, 'Testing valid 1x1') appears to be duplicated. Please remove one instance.
kyu_4/validate_sudoku_with_size/test_sudoku.py Comment on lines +39 to +48 ([[7, 8, 4, 1, 5, 9, 3, 2, 6], [5, 3, 9, 6, 7, 2, 8, 4, 1], [6, 1, 2, 4, 3, 8, 7, 5, 9], [9, 2, 8, 7, 1, 5, 4, 6, 3], [3, 5, 7, 8, 4, 6, 1, 9, 2], [4, 6, 1, 9, 2, 3, 5, 8, 7], [8, 7, 6, 3, 9, 4, 2, 1, 5], [2, 4, 3, 5, 6, 1, 9, 7, 8], [1, 9, 5, 2, 8, 7, 6, 3, 4]], True, 'Testing valid 9x9'), ([[1, 4, 2, 3], Contributor @sourcery-ai sourcery-ai bot 5 minutes ago issue (testing): Duplicated test cases Several test cases for valid 9x9 and 4x4 Sudokus, as well as some invalid cases, seem to be duplicated. This redundancy doesn't add value and can increase maintenance effort. Please remove the duplicates.
suggestion (testing): Add test cases with different capitalization and special characters Include test cases with a mix of uppercase and lowercase letters, as well as special characters within and around letters, to ensure correct handling of various input formats. Suggested implementation: @parameterized.expand([ ("", ""), ("123", ""), ("!@#$%^&*()", ""), ("a1!b", "1 2"), ("AbZ!", "1 2 26"), ("Hello World!", "8 5 12 12 15 23 15 18 12 4"), ("TeStInG 123", "20 5 19 20 9 14 7") ]) These changes ensure that test cases now include scenarios with mixed capitalization and special characters, as requested in the comment. kyu_8/dalmatians_101_squash_bugs/README.md The asteval module allows you to evaluate a large subset of the Python language from within a python program, without using `eval()`. It is, in effect, a restricted version of Python’s built-in `eval()`, forbidding several actions, and using from within a python program, without using ` eval() `. It is, in effect, a restricted Contributor @sourcery-ai sourcery-ai bot 10 minutes ago nitpick (typo): Extra space around eval() There's an extra space before and after the backticks around 'eval()'. It should be eval(). Suggested implementation: without using `eval()` Python’s built-in `eval()`
Merge from master
Merge pull request #656 from iKostanOrg/master
Reviewer's Guide by SourceryThis pull request includes several enhancements and refactorings across multiple files. It focuses on improving test coverage by implementing parameterized tests, enhancing code readability through simplification of expressions and line continuations, and updating GitHub Actions workflows for better CI/CD practices. Additionally, it addresses performance concerns by adding a check for existing prime numbers in the Sequence diagram for Potion mixingsequenceDiagram participant Potion1 participant Potion2 Potion1->>Potion1: new_volume = self.volume + other.volume Potion1->>Potion1: __calc_rgb(other, new_volume) Potion1->>Potion1: r = math.ceil((other.color[0] * other.volume + self.color[0] * self.volume) / new_volume) Potion1->>Potion1: g = math.ceil((other.color[1] * other.volume + self.color[1] * self.volume) / new_volume) Potion1->>Potion1: b = math.ceil((other.color[2] * other.volume + self.color[2] * self.volume) / new_volume) Potion1->>Potion1: return r, g, b Potion1->>Potion1: return Potion((r, g, b), new_volume) Sequence diagram for Disease Spread calculationsequenceDiagram participant Epidemic Epidemic->>Epidemic: for k in range(kwargs['n']) Epidemic->>Epidemic: calc_susceptible = susceptible[k] - dt * kwargs['b'] * susceptible[k] * infecteds[k] Epidemic->>Epidemic: susceptible.append(calc_susceptible) Epidemic->>Epidemic: calc_infecteds = infecteds[k] + dt * (kwargs['b'] * susceptible[k] * infecteds[k] - kwargs['a'] * infecteds[k]) Epidemic->>Epidemic: infecteds.append(calc_infecteds) Epidemic->>Epidemic: return int(max(infecteds)) File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ikostan - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding type hints to the
__calc_rgbmethod inkyu_6/potion_class_101/potion.pyfor better readability. - The parameterized tests are a great addition, but consider adding a test case with a larger Sudoku grid to
kyu_4/validate_sudoku_with_size/test_sudoku.py.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
❌ 45 blocking issues (48 total)
@qltysh one-click actions: |
suggestion (testing): Test cases for invalid sizes are missing. It would be beneficial to add tests for invalid sizes like rectangular or non-square matrices, such as 2x3 or 3x4. This would ensure more comprehensive test coverage. Depending on where you insert these changes in your parameterized test list (e.g., near the top or in the middle), ensure that the commas and brackets match the existing code structure.
Merge pull request #658 from iKostanOrg/master
Summary by Sourcery
Refactor test cases to use parameterized tests, optimize functions for performance, and enhance CI workflows with timeouts and consistent tool usage. Add new test cases for edge cases and utility functions, and clean up the codebase by removing unused code and adding necessary package files.
Enhancements:
mixmethod inpotion.pyto separate RGB calculation into a new method for clarity.done_or_notfunction inis_sudoku_done.pyby using line continuation for conditions.sol_equafunction insolution.pyby simplifying the calculation of the start variable.is_primefunction inprimes.pyby adding a check for already known primes to enhance performance.CI:
python -mfor running tools like flake8, mypy, and pydocstyle for consistency.Tests:
test_replace_with_alphabet_position.pyto ensure robustness.test_log_func.pyto test theprint_logutility function.Chores:
__init__.pyfiles toutilsandprimesdirectories to make them Python packages.