8000 README overhaul by ThomasLandauer · Pull Request #6 · alisqi/TwigQI · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

README overhaul #6

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ThomasLandauer
Copy link

What I did:

  • Move curlylint and djLint to the bottom - they're not that important.
  • Clearly recommend the class TwigQIExtension approach (over services.yaml), cause I'm suspecting that for the nearer future, there will be a come and go of inspections, so taking all is not a good idea (yet).
  • Created (i.e. started) a copy-pastable class TwigQIExtension.

What you should do:

  • What people need is a full list of the inspections they can activate in that class TwigQIExtension. Suggestion: Merge the explanations in the list of inspections into that copy-template like so:
     new InvalidConstant(), // {{ constant('BAD') }}
  • Finish the class TwigQIExtension: Add how to pass the logger to the functions.

@ThomasLandauer
Copy link
Author

I accidentally also deleted:

The two intended use cases are:
Add the extension to the Twig\Environment during development
Invoke a CLI command in CI and/or pre-commit hook which compiles all templates with the extension enabled.

Questions:

  • Which CLI command?
  • How/where can the Web Debug Toolbar's logs be viewed?

@drjayvee
Copy link
Member
drjayvee commented Apr 2, 2025

Which CLI command?

A command which users can build themselves. 😉
Joking aside, that's a fair point. #7 is about shipping one ready to go. I'll share the script we use in our project tomorrow.

How/where can the Web Debug Toolbar's logs be viewed?

By opening the WDT. Users familiar with Symfony should recognize the UI straight away, don't you think?

@ThomasLandauer
Copy link
Author

Users familiar with Symfony should recognize the UI straight away, don't you think?

Indeed :-)
What I don't get (yet) is the advantage of "hiding" the error somewhere in WDT, compared to showing Symfony's red error page. What's your reasoning there?
When I heard "logging", I was thinking about running some CLI command, then getting a text file with the found errors...

8000

@drjayvee
Copy link
Member
drjayvee commented Apr 7, 2025

Hallo Thomas,

Thanks for your changes. Aside from some details I've noted in the review, I'm happy to merge this.

@drjayvee
Copy link
Member

Users familiar with Symfony should recognize the UI straight away, don't you think?

Indeed :-) What I don't get (yet) is the advantage of "hiding" the error somewhere in WDT, compared to showing Symfony's red error page. What's your reasoning there? When I heard "logging", I was thinking about running some CLI command, then getting a text file with the found errors...

Just to be clear: I've never actually worked on a Symfony project, so I don't know how best to integrate TwigQI.

Symfony automatically injects / auto-wires a Psr\Log\LoggerInterface which logs to the WDT, so my thinking was that this is the best default.

I agree though that the errors are not really prominently displayed this way.

This approach does have one advantage (although I could be wrong about that), which is that the error page can only display a single error, while the WDT can display many.

@axel37, do you have an opinion here?

@axel37
Copy link
axel37 commented Apr 16, 2025

the error page can only display a single error, while the WDT can display many.

While I agree that TwigQI inspections showing up in the debug toolbar is useful, I don't think that this fits the primary use case of most users. Displaying the results in the toolbar or throwing an error (= the application must be running) doesn't seem like the best interface for such a tool.

Indeed, if you look at similar projects like phpstan or PHP-CS-Fixer (which are both tools that report issues in your code), they're both invoked with a console command.

Having a command is very convenient since it can be used anywhere, like in a build/test pipeline or locally while developing. Some tools can even format their outputs so it can be fed to gitlab* reports (though that's not as important).

I'm taking gitlab as an example because that's what I'm most familar with.

To recap, it would be great to be able to run TwigQI independently of the application (something like php bin/vendor/twigqi).

@drjayvee
Copy link
Member
drjayvee commented Apr 18, 2025

Displaying the results in the toolbar or throwing an error (= the application must be running) doesn't seem like the best interface for such a tool.

I'd argue that it is while you're developing the template, including the {% types %}.

To recap, it would be great to be able to run TwigQI independently of the application (something like php bin/vendor/twigqi).

I totally agree, and it is now, but no batteries are included yet. Let's continue that conversation in #7.

Do you have any opinion or preference with regards to logging in run-time, web dev mode?

@axel37
Copy link
axel37 commented Apr 18, 2025

Do you have any opinion or preference with regards to logging in run-time, web dev mode ?

I agree that displaying inspection errors in the symfony toolbar is useful (I'm not sure about throwing an error, but it could be a matter of configuration).

I can even imagine having a a custom toolbar section to make inspection results immediately evident (instead of keeping them tucked away in the logs page), but that's extra work ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0