-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Feature/exclude directory for insights #293
Feature/exclude directory for insights #293
Conversation
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.
I have commented on some small improvements for readability and performance :)
We should maybe consider changing our preset after this gets merged. I think we could help the Laravel developers at least with some changes here. |
079a48e
to
5b39da7
Compare
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.
Alright, I think this is almost ready now.
There is a duplication on a method which I think we should handle, either with a trait, a helper class or just a adding the method to our insight class.
src/Domain/Insights/Insight.php
Outdated
$exclude = $config['exclude'] ?? []; | ||
if (count($exclude) > 0) { | ||
$this->excludedFiles = Files::find( | ||
(string) getcwd(), |
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.
How does this act in case where getcwd
returns false?
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.
I tried and it throw a DirectoryNotFoundException.
I can add a check on $basedir in Files::find and return an empty array if it's not exist to avoid throw an exception ? WDYT
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.
Hmm whatever you prefer here tbh. I don't really have an opinion
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.
Alright, when you have figured out which way you want to handle that weird edgecase with cwd
, then you can go ahead 👍
The code is really nice, great work! 😃
d948c30
to
f595789
Compare
@olivernybroe I add a fallback when |
This PR add possibility to configure exclude part with a directory in addition of filepath:
In the example above, all classes in
src/Models
will be excluded for the ForbiddenSetterSniffThis PR also port the exclude feature to our own Insights (ForbiddenDefineGlobalConstants, ForbiddenGlobals ...). I added the exclude check for each Insights that implement
HasDetail
interface.