-
Notifications
You must be signed in to change notification settings - Fork 65
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
Removes less code that uses frontend definitions in an adminhtml file… #777
Removes less code that uses frontend definitions in an adminhtml file… #777
Conversation
@sidolov: any chance the priority can get increased here? It's not only a simple cleanup like you think it would. If you use a module to change the less compiler to the official one, these mistakes in the less code cause the backend to look broken. |
@hostep I got your point, thanks! |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@hostep - can you merge develop into your fork branch and push so we can go ahead with processing this PR? Thanks! |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Most failures in the static tests are probably going to be fixed by upgrading the coding-standard library to version 25 (ref magento/magento-coding-standard#405 & magento/magento-coding-standard#395), and the failures that will remain (about |
@hostep can you add ignore directives so the static tests don't fail for the points you mentioned. |
@paras89: I don't really think this is the right move here, shouldn't the coding standards be changed so it allows underscores? It's not like this will ever go away in the next few years in the Magento codebase. Also, why is "php code sniffer" even checking coding standards of css/less files, isn't that thing only supposed to check php code? Also, can't we just ignore the static test failures in this PR? They really aren't important here in my opinion. If nothing of my remarks make sense to you, and you really really really want me to add ignore directives, can you let me know how I can do that? Is it with /cc @sivaschenko |
@paras89, @sivaschenko: any input on my remarks? Especially around:
Also: less code is not the same as php code, so coding standards for writing less code should be very different than the ones for php code. Less code is being compiled sure, but the class names that are being used are outputted directly to the browser as is. PHP code on the other hand is being interpreted and the output that it gives is something that the coding standard is not checking (obviously), so the way you write php code isn't affecting the output, so checking for strict coding standards on php code can make sense. But you should treat less code and php code very differently if it comes to coding standards, especially regarding the way of writing class names, id's, actual css properties, ... because those get send to the browser as is. |
@paras89, @sivaschenko: any update from you regarding my question(s) would be appreciated. Thanks! 🙂 |
@hostep - codingStandardsIgnoreStart is the right way to ignore. As for css class name, the thinking is that best practice is to not have an underscore in them, the sniff is trying to prevent this problem in new code. Since the sniff was introduced at a later stage, the approach is to prevent new code from following bad practice, refactoring old code where possible and ignore where it is big scope to change. Page Builder project is also not the appropriate project to discuss Magento wide coding standards. Feel free to open an issue in the coding standards repo if you'd like to take this discussion further. |
a24ad75
to
f3cbeda
Compare
Just to move this PR forwards, I've added some coding standard ignore directives. I really don't like it because:
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
It looks like an issue for this has already been created in the coding-standards repo: magento/magento-coding-standard#409, in typical Adobe fashion, it has been ignored for 2 months already |
f3cbeda
to
cde646a
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
cde646a
to
85b0100
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
The two static test failures that remain (see below) will be fixed when coding-standard v25 will be used in the automation here like explained earlier, no idea why version 25 is not being used yet at the moment...
All other test failures, don't seem to have anything to do with the changes here proposed at first sight (but correct me when I'm wrong) |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@paras89: are you still around? Any chance you (or one of your colleagues) could pick this up soon-ish so we can get this included in Magento 2.4.7? Thanks! |
@engcom-Hotel: what needs to happen to move this PR further? It has been open for 2 years and fixes an obvious problem. |
Hey @ihor-sviziev, while we're dealing with less code fixes and cleanup, could you somehow try to move this one forward, it's been stuck for way too long. Thanks! |
@engcom-Hotel @sinhaparul can you please move it forward? |
Any news here? Would be great if this could be included in Magento 2.4.7 ... |
@magento run Unit Tests |
@magento run all tests |
✔️ QA Passed Preconditions: This removes references to less classes in an adminhtml less file that are only defined in the frontend of Magento's Blank and/or Luma themes. Manual testing scenario:
Actual Result: ✔️ For Failed tests Thanks |
@magento run all tests |
e6c3f28
into
magento:develop
Almost 3 years, but finally, thank you guys! :) |
…. Fixes #775
Description (*)
This removes references to less classes in an adminhtml less file that are only defined in the frontend of Magento's Blank and/or Luma themes.
So you aren't able to use these references in an adminhtml file and really shouldn't as it won't work.
See #775 (comment) for an example (I did investigate all the other problems by now and they are all the same problem).
When comparing the resulting css file before and after this change, zero changes were found, so the PR shouldn't cause any issues.
Story
?
Bug
?
Task
?
Fixed Issues (if relevant)
Builds
?
Related Pull Requests
?
Manual testing scenarios (*)
npm install [email protected]
rm -R var/view_preprocessed/* pub/static/*; bin/magento setup:static-content:deploy -f --theme=Magento/backend en_US
styles.less
file is important in scope of this PR:node_modules/.bin/lessc -l var/view_preprocessed/pub/static/adminhtml/Magento/backend/en_US/css/styles.less
, notice that you get a bunch of warnings.pub/static/adminhtml
directorypub/static/adminhtml
directory with the backup you created in step 5. There will be no differences.End result: cleaner code, no warnings anymore, reduced code to maintain, reduced confusion when people try to understand what your code is doing.
Questions or comments
It would be nice if all Magento less code in all kinds of various repo's could get tested and validated by the official less.js compiler in some kind of static test so problematic code like this doesn't get added to the codebase.
(Very much unrelated, but your template for contributions isn't really friendly to the open source community since it asks for a lot of references to your private Jira board, which we can't provide ...)
Checklist