Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Conversation

@ikostan
Copy link
Member

@ikostan ikostan commented Feb 24, 2025

Summary by Sourcery

Refactor and enhance test suites for several katas, improving readability, maintainability, and test coverage by using parameterized tests and adding more test cases. Also, improve test logging and reporting with allure steps for better traceability.

Enhancements:

  • Improve test logging and reporting with allure steps for better traceability.

Tests:

  • Refactor test cases to use parameterized tests for improved readability and maintainability.
  • Add more test cases to cover edge cases and improve test coverage.
ikostan and others added 30 commits February 17, 2025 19:19
Merge pull request #656 from iKostanOrg/master
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
Merge pull request #660 from iKostanOrg/master
Merge pull request #662 from iKostanOrg/master
@ikostan ikostan added the kyu_2 label Feb 24, 2025
@ikostan ikostan self-assigned this Feb 24, 2025
@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for b01910f1
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b01910f) Report Missing Report Missing Report Missing
Head commit (6bcc771) 2644 2462 93.12%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#665) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 24, 2025

Reviewer's Guide by Sourcery

This pull request includes several key updates: test refactoring to use parameterized tests for improved readability and coverage, standardization of GitHub Actions workflows, and updates to the README file to accurately reflect solution availability.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Refactored test cases to use parameterized tests, improving readability and maintainability.
  • Replaced individual test methods with parameterized tests.
  • Added descriptive messages to each test case.
  • Improved test coverage with additional test cases.
kyu_3/battleship_field_validator/test_battleship_validator.py
kyu_3/line_safari_is_that_a_line/test_walker.py
kyu_3/line_safari_is_that_a_line/test_line_positive.py
kyu_3/make_spiral/test_spiralize.py
kyu_3/line_safari_is_that_a_line/test_line_negative.py
kyu_4/human_readable_duration_format/test_format_duration.py
kyu_3/calculator/test_calculator.py
kyu_3/rail_fence_cipher_encoding_and_decoding/test_encoding.py
kyu_3/rail_fence_cipher_encoding_and_decoding/test_decoding.py
kyu_5/diophantine_equation/test_solution.py
kyu_5/extract_the_domain_name_from_url/test_domain_name.py
kyu_5/tic_tac_toe_checker/test_checker.py
kyu_5/josephus_survivor/test_josephus_survivor.py
kyu_4/validate_sudoku_with_size/test_sudoku.py
kyu_5/where_my_anagrams_at/test_anagrams.py
kyu_5/directions_reduction/test_directions_reduction.py
kyu_5/first_non_repeating_character/test_first_non_repeating_letter.py
kyu_5/human_readable_time/test_make_readable.py
kyu_5/integers_recreation_one/test_list_squared.py
kyu_5/master_your_primes_sieve_with_memoization/test_primes.py
kyu_5/moving_zeros_to_the_end/test_move_zeros.py
kyu_5/number_of_trailing_zeros_of_n/test_zeros.py
kyu_5/simple_pig_latin/test_pig_it.py
kyu_5/string_incrementer/test_increment_string.py
kyu_5/valid_parentheses/test_valid_parentheses.py
kyu_5/find_the_safest_places_in_town/test_advice.py
kyu_5/alphabet_wars_nuclear_strike/test_alphabet_war.py
kyu_5/not_very_secure/test_alphanumeric.py
kyu_5/count_ip_addresses/test_ips_between.py
kyu_5/the_hashtag_generator/test_generate_hashtag.py
kyu_5/sports_league_table_ranking/test_compute_ranks.py
kyu_5/find_the_smallest/test_smallest.py
kyu_5/sum_of_pairs/test_sum_pairs.py
Updated GitHub Actions workflows to use a consistent branch naming convention and added permissions.
  • Standardized branch names in GitHub Actions workflows.
  • Added explicit permissions for contents and pull requests in workflows.
.github/workflows/mypy_kyu3.yml
.github/workflows/pylint_kyu3.yml
.github/workflows/flake8_kyu4.yml
.github/workflows/flake8_kyu5.yml
.github/workflows/mypy_kyu4.yml
.github/workflows/pydocstyle_kyu3.yml
.github/workflows/pydocstyle_kyu4.yml
.github/workflows/pylint_kyu4.yml
Updated the README file to reflect the current status of solutions.
  • Updated the README file to indicate that a solution is not available for a specific problem.
kyu_6/README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ikostan ikostan merged commit ef32bef into kyu2 Feb 24, 2025
30 of 33 checks passed
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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 function signatures for better readability and maintainability.
  • It looks like you've added a lot of tests using parameterized, which is great, but consider refactoring common setup code into setUp methods to avoid repetition.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟡 Security: 1 issue found
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines 4 to +7
on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu3'
- kyu3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Explicit permissions reduce token scope.

Adding an explicit permissions block with 'contents: read' and 'pull-requests: read' helps enforce the principle of least privilege.

Suggested change
on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu3'
- kyu3
on: # yamllint disable-line rule:truthy
push:
branches:
- kyu3
permissions:
contents: read
pull-requests: read
Comment on lines +57 to +66
([[1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
[1, 0, 1, 0, 0, 0, 0, 0, 1, 0],
[1, 0, 1, 0, 1, 1, 1, 0, 1, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Suggest adding more test cases for edge cases and invalid inputs.

Consider adding tests for scenarios like all zeros, all ones, invalid ship sizes, ships placed outside the grid, overlapping ships, and other non-standard inputs to ensure comprehensive coverage.

" \\| \\|",
"X-----+------+",
" \\| ",
" X "]]])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Add tests for invalid grid formats.

The tests currently focus on valid paths. Consider adding tests with invalid characters, non-rectangular grids, or grids with multiple start/end points to ensure the Walker class handles these scenarios gracefully.

ikostan added a commit that referenced this pull request Feb 24, 2025
Merge pull request #665 from iKostanOrg/master
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

2 participants