Skip to content

Merge from master #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 194 commits into from
Feb 10, 2025
Merged

Merge from master #627

merged 194 commits into from
Feb 10, 2025

Conversation

ikostan
Copy link
Member

@ikostan ikostan commented Feb 10, 2025

Summary by Sourcery

Update CI pipelines and dependencies, including switching from Code Climate to QLTY.SH for coverage reports.

Build:

  • Upgrade pip, setuptools, and wheel.

CI:

  • Update CI workflows to use workflow calls.
  • Switch from Code Climate to QLTY.SH for coverage reports.
  • Add a timeout to prevent jobs from running indefinitely.
  • Update pytest to generate XML coverage reports.
  • Update various CI scripts to use python -m when calling modules.

Tests:

  • Update pytest configuration to generate JUnit XML reports and improve coverage reporting.

ikostan and others added 30 commits January 30, 2025 22:12
Merge pull request #607 from iKostanOrg/master
[20/112] check kyu_7.powers_of_3.largest_power
FAILED: /home/runner/work/codewars/codewars/.pytype/pyi/kyu_7/powers_of_3/largest_power.pyi
/opt/hostedtoolcache/Python/3.11.11/x64/bin/python -m pytype.main --imports_info /home/runner/work/codewars/codewars/.pytype/imports/kyu_7.powers_of_3.largest_power.imports --module-name kyu_7.powers_of_3.largest_power --platform linux -V 3.11 -o /home/runner/work/codewars/codewars/.pytype/pyi/kyu_7/powers_of_3/largest_power.pyi --analyze-annotated --nofail --quick /home/runner/work/codewars/codewars/kyu_7/powers_of_3/largest_power.py
/home/runner/work/codewars/codewars/kyu_7/powers_of_3/largest_power.py:22:9: error: in largest_power: Type annotation for result does not match type of assignment [annotation-type-mismatch]
  Annotation: int
  Assignment: float
  In assignment of type: Union[float, int]

        result = 3 ** n
        ~~~~~~

For more details, see https://google.github.io/pytype/errors.html#annotation-type-mismatch
ninja: build stopped: subcommand failed.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Merge pull request #611 from iKostanOrg/master
Merge pull request #614 from iKostanOrg/master
    # Adding 'timeout-minutes: 10' would prevent jobs from running
    # indefinitely if something goes wrong
    timeout-minutes: 10
Consider consolidating these similar workflow files into a single workflow with multiple jobs to reduce duplication and improve maintainability. This could be done as a separate PR.
Copy link
Contributor

sourcery-ai bot commented Feb 10, 2025

Reviewer's Guide by Sourcery

This pull request consolidates numerous improvements across GitHub Actions workflows, code refactoring, test updates, and documentation. Key changes include updating branch filters and timeouts in YAML workflows, enhancing installation commands to use 'python -m pip', refactoring code to use safer evaluation with the asteval module, standardizing multi-line string formatting in tests, and updating dependency tables in the README.

Updated Class Diagram for calculate.py using asteval

classDiagram
    class Interpreter {
      +eval(expression: str) : any
    }
    class Calculator {
      +calculate(s: str) : str
      +string_to_math(s: str) : str
    }
    Calculator ..> Interpreter : uses
    note for Calculator "Replaces Python built-in eval with asteval Interpreter\nfor safer expression evaluation"
Loading

File-Level Changes

Change Details Files
GitHub Actions workflow improvements and standardizations
  • Updated branch filtering logic by switching from specifying branches to using branches-ignore in workflows
  • Added 'timeout-minutes: 10' configurations to multiple workflows to prevent indefinite job execution
  • Converted pip installation commands to use 'python -m pip install' along with '--no-cache-dir' and upgrade flags
  • Updated secrets handling and dependencies in Codacy, Codecov, Code Climate, and Snyk workflows
  • Commented out the PYTYPE workflow in lint_test_build_pipeline and added new workflows for specific kyu levels (pytest_kyu2, pytype_kyu8, pytype_kyu2, pytype_kyu7)
  • Introduced new workflow file for QLTY.SH Coverage Report
.github/workflows/lint_test_build_pipeline.yml
.github/workflows/codecov.yml
.github/workflows/codacy-coverage-reporter.yaml
.github/workflows/pytest.yml
.github/workflows/mypy.yml
.github/workflows/codeclimate_coverage.yml
.github/workflows/pydocstyle.yml
.github/workflows/pytype.yml
.github/workflows/flake8.yml
.github/workflows/yamllint.yml
.github/workflows/markdown_lint.yml
.github/workflows/pylint.yml
.github/workflows/pydocstyle_kyu2.yml
.github/workflows/flake8_kyu2.yml
.github/workflows/mypy_kyu2.yml
.github/workflows/snyk.yml
.github/workflows/codeclimate_qlty_coverage.yml
.github/workflows/pytest_kyu2.yml
.github/workflows/pytype_kyu8.yml
.github/workflows/pytype_kyu2.yml
.github/workflows/pytype_kyu7.yml
Code refactoring with safe evaluation and type annotations
  • Modified 'calculate' function in basic_math_add_or_subtract to use the asteval Interpreter instead of eval with restricted builtins
  • Updated 'string_to_math' function to remove spaces from input for better conversion reliability
  • Added type annotations to functions such as 'easy_line' and 'buy_or_sell' for improved code clarity and safety
  • Replaced eval usage with asteval.eval for safer expression evaluation
kyu_7/basic_math_add_or_subtract/calculate.py
kyu_7/easy_line/easyline.py
kyu_7/pointless_farmer/solution.py
Test adjustments and string formatting improvements
  • Reformatted multi-line string literals in several test files using backslashes to improve readability and consistency
  • Updated assertion patterns in tests (for example, using f-string formatting for error messages in easy_line tests)
  • Minor fixes in test file formatting to align with lint and style guidelines
kyu_6/string_transformer/test_string_transformer.py
kyu_6/string_subpattern_recognition_2/test_has_subpattern.py
kyu_5/the_hashtag_generator/test_generate_hashtag.py
kyu_6/unique_in_order/test_unique_in_order.py
kyu_6/vasya_clerk/test_tickets.py
kyu_7/easy_line/test_easyline.py
kyu_7/pointless_farmer/test_buy_or_sell.py
Documentation and dependency table updates
  • Replaced outdated Code Climate badges with new QLTY.SH badges in README.md
  • Removed the old dependency list and added an updated table of Python packages/dependencies in the README
  • Improved formatting and added a new section for the ASTEVAL module documentation
README.md
kyu_8/dalmatians_101_squash_bugs/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

Copy link

codacy-production bot commented Feb 10, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 21d08f21 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (21d08f2) Report Missing Report Missing Report Missing
Head commit (8ce6ec9) 2630 2384 90.65%

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 (#627) 9 9 100.00%

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.

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 timeout-minutes to all workflow jobs to prevent indefinite runs.
  • It looks like you've commented out the pytype job in the main workflow; consider removing it entirely if it's no longer needed.
  • Be careful about ignoring branches in your workflow triggers, as this can lead to unexpected behavior.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 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.

Copy link

qltysh bot commented Feb 10, 2025

❌ 36 blocking issues (37 total)

Tool Category Rule Count
checkov Vulnerability Ensure top-level permissions are not set to write-all 4
prettier Style Incorrect formatting, autoformat by running `qlty fmt`. 32
qlty Structure Function with high complexity (count = 5): buy_or_sell 1

@qltysh one-click actions:

  • Auto-fix formatting (qlty fmt && git push)
    qlty successfully analyzed this pull request in 3m.

ikostan and others added 2 commits February 9, 2025 20:59
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@ikostan ikostan merged commit 26bdd71 into kyu6 Feb 10, 2025
35 checks passed
ikostan added a commit that referenced this pull request Feb 11, 2025
Merge pull request #627 from iKostanOrg/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant