-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add support for infection and psalm #386
Conversation
WalkthroughThe recent changes introduce enhancements and optimizations across various components of the project. Key updates include the addition of new linting and mutation testing targets in the Makefile, expanded development dependencies in Changes
Sequence Diagram(s) (Beta)No sequence diagrams are necessary as the changes are varied and do not introduce new features or significant modifications to control flow. Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
app/composer.lock
is excluded by!**/*.lock
Files selected for processing (6)
- .pre-commit-config.yaml (1 hunks)
- Makefile (4 hunks)
- app/composer.json (3 hunks)
- app/infection.json.dist (1 hunks)
- app/psalm-baseline.xml (1 hunks)
- app/psalm.xml (1 hunks)
Files skipped from review due to trivial changes (3)
- .pre-commit-config.yaml
- app/infection.json.dist
- app/psalm.xml
Additional comments not posted (7)
app/composer.json (3)
25-42
: Added new development dependencies for testing and static analysis.Ensure that these new dependencies are compatible with the existing project setup and do not introduce version conflicts.
64-64
: Enabled theinfection/extension-installer
plugin.This change will facilitate the installation of extensions required by Infection, enhancing the mutation testing setup.
101-124
: Added new scripts for mutation testing, static analysis, and testing coverage.Verify that these scripts are integrated correctly in the CI/CD pipelines and that they function as expected in both local and CI environments.
Makefile (3)
251-253
: Added new Makefile targets for static analysis and mutation testing.Ensure that these targets are documented properly and that team members are aware of how to use them effectively.
Also applies to: 259-261, 263-265, 267-269, 277-279, 281-283, 285-287, 300-302, 304-306, 316-318, 320-322
316-322
: Introduced new targets for generating API documentation.This change will help in maintaining separate documentation for public and admin APIs, which can improve API governance and clarity for different user roles.
335-337
: Added a new target for running database migrations.Ensure that this target is tested thoroughly to prevent any disruptions in the production environment.
app/psalm-baseline.xml (1)
1-392
: Configured Psalm baseline settings.This configuration helps in managing the existing code issues while gradually improving the codebase. Ensure that the baseline is updated regularly as code issues are resolved.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #386 +/- ##
==========================================
Coverage 48.36% 48.36%
+ Complexity 49 48 -1
==========================================
Files 23 23
Lines 122 122
==========================================
Hits 59 59
Misses 63 63 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
app/composer.lock
is excluded by!**/*.lock
Files selected for processing (6)
- app/composer.json (4 hunks)
- app/src/Bridge/Laravel/Application.php (1 hunks)
- app/src/Bridge/Laravel/Http/Middleware/RedirectIfAuthenticated.php (1 hunks)
- app/src/Bridge/Laravel/Providers/EventServiceProvider.php (1 hunks)
- app/src/Bridge/Laravel/Providers/RouteServiceProvider.php (1 hunks)
- app/src/Support/Filters/FuzzyFilter.php (1 hunks)
Files skipped from review due to trivial changes (1)
- app/src/Bridge/Laravel/Http/Middleware/RedirectIfAuthenticated.php
Additional Context Used
GitHub Check Runs (1)
codecov/patch failure (3)
app/src/Bridge/Laravel/Providers/RouteServiceProvider.php: [warning] 30-30: app/src/Bridge/Laravel/Providers/RouteServiceProvider.php#L30
Added line #L30 was not covered by tests
app/src/Support/Filters/FuzzyFilter.php: [warning] 22-22: app/src/Support/Filters/FuzzyFilter.php#L22
Added line #L22 was not covered by tests
app/src/Support/Filters/FuzzyFilter.php: [warning] 28-29: app/src/Support/Filters/FuzzyFilter.php#L28-L29
Added lines #L28 - L29 were not covered by tests
Additional comments not posted (6)
app/src/Bridge/Laravel/Application.php (1)
15-15
: The updated path construction logic inpath
method is clear and prevents unnecessary directory separators when$path
is empty.app/src/Support/Filters/FuzzyFilter.php (2)
22-22
: The addition ofmixed
type hint for$value
in__invoke
method enhances flexibility in handling different types of filter values.
28-29
: Renaming$value
to$item
inside the loop improves clarity and avoids confusion with the outer scope variable.app/src/Bridge/Laravel/Providers/EventServiceProvider.php (1)
16-16
: The change in type hint for$listen
property fromclass-string
tostring
increases flexibility but may reduce type safety.app/src/Bridge/Laravel/Providers/RouteServiceProvider.php (1)
30-30
: The use of the null coalescing assignment operator??
in the rate limiter logic simplifies and clarifies the intention.app/composer.json (1)
7-20
: The updates to dependencies and scripts incomposer.json
are well-aligned with the PR's objectives to enhance testing and static analysis capabilities.Also applies to: 32-54, 76-76, 113-136
public function __invoke(Builder $query, mixed $value, string $property): Builder | ||
{ | ||
$query->where(function (Builder $query) use ($value): void { | ||
foreach ($this->fields as $field) { | ||
$values = (array) $value; | ||
|
||
foreach ($values as $value) { | ||
$query->orWhere($field, 'LIKE', "%{$value}%"); | ||
foreach ($values as $item) { | ||
$query->orWhere($field, 'LIKE', "%{$item}%"); |
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.
Tip
Codebase Verification
The search results indicate that there are no direct tests for the index
method in CategoryControllerTest.php
, which suggests that the changes in the __invoke
method of FuzzyFilter
are not covered by tests.
- No direct tests for the
__invoke
method inFuzzyFilter
. - No direct tests for the
index
method inCategoryControllerTest.php
.
Analysis chain
The changes in __invoke
method are not covered by tests.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if new changes in FuzzyFilter are covered by tests.
# Test: Search for test cases covering the `__invoke` method.
rg --type php "test.*FuzzyFilter.*__invoke"
Length of output: 45
Script:
#!/bin/bash
# Description: Verify if the FuzzyFilter class and its methods are covered by tests.
# Test: Search for any test cases related to the FuzzyFilter class.
rg --type php "FuzzyFilter"
# Test: Search for any usage of the __invoke method in the codebase.
rg --type php "->__invoke"
Length of output: 755
Script:
#!/bin/bash
# Description: Verify if the FuzzyFilter class and its methods are covered by tests.
# Test: Search for any usage of the __invoke method in the codebase.
rg --type php "__invoke"
# Test: Search for any test cases related to the IndexQuery class.
rg --type php "IndexQuery"
Length of output: 640
Script:
#!/bin/bash
# Description: Verify if the FuzzyFilter class and its methods are covered by tests.
# Test: Search for any test cases related to the CategoryController class.
rg --type php "CategoryController"
Length of output: 412
Script:
#!/bin/bash
# Description: Verify if the FuzzyFilter class and its methods are covered by tests.
# Test: Check the contents of CategoryControllerTest for tests related to the index method.
rg --type php "index" app/tests/Bridge/Laravel/Admin/Category/Controllers/CategoryControllerTest.php
Length of output: 100
@@ -27,7 +27,7 @@ | |||
public function boot(): void | |||
{ | |||
RateLimiter::for('api', function (Request $request) { | |||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); | |||
return Limit::perMinute(60)->by($request->user()?->id ?? $request->ip()); |
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.
Tip
Codebase Verification
The searches did not yield any results, indicating that there are no direct or indirect test cases covering the rate limiter logic in RouteServiceProvider
.
- The rate limiter logic changes are not covered by tests.
Analysis chain
The changes in the rate limiter logic are not covered by tests.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify if new changes in RouteServiceProvider are covered by tests.
# Test: Search for test cases covering the rate limiter logic.
rg --type php "test.*RouteServiceProvider.*RateLimiter"
Length of output: 57
Script:
#!/bin/bash
# Description: Broaden the search for test cases covering the rate limiter logic in RouteServiceProvider.
# Search for any references to the rate limiter logic in the test files.
rg --type php "RateLimiter" tests/
# Search for any references to RouteServiceProvider in the test files.
rg --type php "RouteServiceProvider" tests/
Length of output: 172
Script:
#!/bin/bash
# Description: Locate the test directory and search for test cases covering the rate limiter logic in RouteServiceProvider.
# Locate the test directory.
test_dir=$(fd --type d --name tests)
# If the test directory is found, search for references to the rate limiter logic and RouteServiceProvider.
if [ -n "$test_dir" ]; then
rg --type php "RateLimiter" "$test_dir"
rg --type php "RouteServiceProvider" "$test_dir"
else
echo "Test directory not found."
fi
Length of output: 367
Script:
#!/bin/bash
# Description: Locate the test directory and search for test cases covering the rate limiter logic in RouteServiceProvider.
# Locate the test directory.
test_dir=$(fd --type d tests)
# If the test directory is found, search for references to the rate limiter logic and RouteServiceProvider.
if [ -n "$test_dir" ]; then
rg --type php "RateLimiter" "$test_dir"
rg --type php "RouteServiceProvider" "$test_dir"
else
echo "Test directory not found."
fi
Length of output: 153
Script:
#!/bin/bash
# Description: Search for any indirect references or related test cases covering the rate limiter logic in RouteServiceProvider.
# Search for any references to rate limiting in the test directory.
rg --type php "rate limit" app/tests/
# Search for any references to user ID or IP address in the test directory, as these are used in the rate limiter logic.
rg --type php "user()->id" app/tests/
rg --type php "request->ip" app/tests/
Length of output: 120
Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
Documentation
composer.json
.Chores
composer.json
.