-
Notifications
You must be signed in to change notification settings - Fork 13
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
Adding two new static file extension folders for Java Specific Workflows #97
Adding two new static file extension folders for Java Specific Workflows #97
Conversation
When using a spring boot application in Java, many of the static files will be placed in META-INF/resources. Right now these are treated like first class concepts, eventually moving the weight of Java application down far enough to not be selected. Signed-off-by: Shawn Hurley <[email protected]>
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.
Changes here looks good to me.
@thepetk I wonder if we should investigate tying project specific static file extension folders with the detection of the project source since there is many specific projects that Alizer could work with, i.e. if it detects it has Java source under the project at least, such as after running languagesFile.GetLanguagesByExtension(extension)
, include this extra collection of static file extension folders. WDYT?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
==========================================
+ Coverage 73.16% 73.40% +0.24%
==========================================
Files 11 11
Lines 1565 1568 +3
==========================================
+ Hits 1145 1151 +6
+ Misses 351 349 -2
+ Partials 69 68 -1 ☔ 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.
In general the addition of those 2 extra static dirs make sense to me.
Before approving I'd suggest adding an extra test case in the language_recognizer_test.go to make sure for every new feature this issue won't show up again.
@michael-valdron re: to your comment. I'm supportive of creating a spike issue to investigate an improved approach for the analyze
command.
My two cents:
- The
analyze
command tries to quickly summarize all data found for the given project. The initial approach was to count all extensions found inside a project. After the merge of #168 the weight is different for static file cases. - In order to get more info for specific modules/components that exist inside the project, one has to run
component
command. In the currentmain
thecomponent
command is able to locate the rootjava
component. - Looking at the response format we do include information for
framework
&tools
. This means we're already analyzing the first dir level of the given project, so we can have different weight calculation for each case, while we don't add a performance overhead to theanalyze
command. - Another good thing to investigate in the spike issue would be to make the
analyze
command configurable. So the user, will be able to configure how much the static file will affect the analysis when using the cli. E.g:
alizer analyze --static-weight 15 ~/my-component
This should add 15 points of weight to all static file extensions found. As a result, in case someone doesn't want to have static files at all, they would be able to exclude them by setting the value to 0.
Adding the test case now! thanks for the feedback! |
d70249d
to
83d212c
Compare
@thepetk Test case for the application that I was using to see the bug was added! |
@shawn-hurley would it be possible to reduce the size of the test resource we're adding? We could keep the same ratio between java/js files and ofc all config files. You could check the rest of the test resources to use as an example. |
I think the problem was the size of the js files, does the app not have to compile or work in anyway? |
No not at all. It won't be compiled. We need only a "structure" of a project that alizer can work on. So for this case we can keep all config files, so alizer can detect the framework etc and a smaller amount of js / java files to analyze the language. |
83d212c
to
edb0349
Compare
is this better? |
@shawn-hurley I think much better, I'd also remove any Dockerfile, Images, License, Documentation and Kubernetes related items so the test project contains only java & js files. This way we keep alizer repo minimal while we're focusing on the specific case we've met on the test resource! |
edb0349
to
09732af
Compare
I think I got them all, sorry for all the extra info and stuff |
Signed-off-by: Shawn Hurley <[email protected]>
09732af
to
badfcbb
Compare
Signed-off-by: thepetk <[email protected]>
@shawn-hurley I've tried to remove more items (Docs, Images, Html, Css, License files). Added a commit in your branch. Feel free to revert if you think is not needed. |
Signed-off-by: thepetk <[email protected]>
No thank you, I didn't think about looking in the components directory itself sorry! |
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.
/lgtm
@shawn-hurley Nice fix!
@michael-valdron I've created devfile/api#1622 for the investigation we were discussing.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shawn-hurley, thepetk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@shawn-hurley I've also cut alizer |
What does this PR do?
When using a spring boot application in Java, many of the static files will be placed in META-INF/resources. Right now these are treated like first class concepts, eventually moving the weight of Java application down far enough to not be selected.
You can see more info about this here: https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot