Skip to content
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

Add Option to Print Full File Paths #2491

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rtablada
Copy link

This is a possible solution to #2488.

The new added --print-full-path option will set the pretty printer (I was unsure if this should also impact serif and JSON printers) to print the full directory path.

A more complicated option would be to have some way of defining a git root which would give a cleaner output though still allowing nested annotations to be discoverable. Since GH and most annotation/lint readers have support for full path, I went with the option to print full path. Doing a relative path or print git root would add more complexity to the CLI and would require a bit more to clean up output and things.

If requested, I can add the full path to also change the JSON and serif formatters along with associated tests.

test: add tests for full path
@rtablada
Copy link
Author

rtablada commented May 2, 2022

@bmish any thoughts on this?

There are some older versions which are used by LTS versions of Ember and I'm not quite sure if those could get patch releases as well or not?

@rwjblue rwjblue requested a review from scalvert May 2, 2022 17:52
@rwjblue
Copy link
Member

rwjblue commented May 2, 2022

I think adding an option for this is probably fine, but I wonder if there is something that we can do to make the default experience a bit better. Specifically, I'd like to use full path whenever the repo root is something different from the working directory (which is the process.cwd() when ember-template-lint is invoked).

Additionally, I was chatting with @scalvert about a very related issue just the other day. I think we ultimately need the internal results to always include full path (though doing this will require some changes to the todo utils IIRC; @scalvert c/d?), and then the pretty reporter can decide if it should print the full path or relative path.

@scalvert
Copy link
Member

scalvert commented May 2, 2022

Yep I also think this is a reasonable short term solution, though it's somewhat annoying to have to explicitly use the option to output the paths. Overall I think we need to fix this internally, as @rwjblue mentioned. I personally think we should mirror what eslint does in terms of what it prints out, which is the absolute path.

@bmish
Copy link
Member

bmish commented May 2, 2022

I agree with improving our default behavior to match ESLint's behavior (which is a direction we are trying to move in) which sounds like it would solve this issue more elegantly. We could change this as a breaking change in the upcoming v5 release (#2319) and avoid having to add a short-lived option?

@bmish bmish mentioned this pull request May 2, 2022
@bmish
Copy link
Member

bmish commented May 3, 2022

@rtablada would you be interested to open a separate PR changing the default behavior? That way we can have that change lined up and ready-to-go for the next major release.

@rtablada
Copy link
Author

rtablada commented May 3, 2022

@bmish so the desired behavior for v5 would be to always print full paths for all 3 writers (basically the behavior of this PR without the CLI flag)?

@bmish
Copy link
Member

bmish commented May 3, 2022

Yes, always using full paths seems safest, simplest, and preferred given it matches ESLint's behavior. @rwjblue is that okay with you or do you still prefer the more sophisticated behavior you suggested earlier?

In terms of getting the full path, @rwjblue suggested earlier that internal refactoring to always handle the full path should be part of this (instead of just resolving at the end as shown in the current PR).

@scalvert
Copy link
Member

scalvert commented May 5, 2022

It should also be noted, as Rob did earlier, that this will require changes to the todo system to adjust the paths stored (we think). It's worth testing it out for sure. Either way, we're looking to make some changes to the todo system to accommodate monorepos, and having a single .lint-todo storage file (right now the behavior is that wherever the workingDirectory is during invocation, it'll create a .lint-todo storage file there. For monorepos this often means there are n storage files).

@rtablada
Copy link
Author

rtablada commented Jun 1, 2022

Sorry got pulled off to other 🔥s and health/personal stuff. I'm back in support/upgrade land for the next 2 weeks so have cycles for OSS again.

I'll make a spike to always print full path and see what that does to the todo system.

@bmish bmish added this to the 5.0.0 milestone Jun 15, 2022
@bmish
Copy link
Member

bmish commented Nov 3, 2022

Just a heads up that we're going to release the v5 version in the next week or two (#2319). It would be a good time to switch to use full paths by default if anyone can implement this.

@bmish bmish mentioned this pull request Nov 19, 2022
@bmish bmish removed this from the 5.0.0 milestone Nov 19, 2022
@rtablada rtablada marked this pull request as draft January 20, 2023 18:43
@rtablada
Copy link
Author

Converting this to draft. I am on some other projects/priorities so don't have time to bring this over the finish line sadly.

Would really appreciate if someone in Ember OSS could update or implement full path outputs for inline lint on GH Actions and warnings for monorepos.

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.

None yet

4 participants