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

Creating the results.codetf.json file in my CWD is unexpected #8

Open
nahsra opened this issue Dec 20, 2023 · 3 comments
Open

Creating the results.codetf.json file in my CWD is unexpected #8

nahsra opened this issue Dec 20, 2023 · 3 comments

Comments

@nahsra
Copy link
Contributor

nahsra commented Dec 20, 2023

I think you use this to create the explain feature. If explain is built into the fix subcommand as described in #7 , maybe there's no need for this file to be outside $TMP. But, it went against my expectation that this file went into my current directory, which was my source tree. I feel like I'm going to accidentally commit this file into a repo at some point.

Maybe the file (if we actually need it), can go into $HOME/.pixee or $TMP?

@nahsra
Copy link
Contributor Author

nahsra commented Dec 21, 2023

I'm assuming you only run pixee explain from the directory where results.codetf.json is? Just to brainstorm here -- maybe we could write to $HOME/.pixee/all_results.json -- which has some kind of triplet:

  • the directory
  • the hash of the directory contents
  • the path to the results file for that directory

E.g.:

[
 {
    "dir" : "/code/project1",
    "hash" : "<some sha256>",
    "results" : "/tmp/codetf-<uuid>-.json"
 },
 {
    "dir" : "/code/project2",
    "hash" : "<another sha256>",
    "results" : "/tmp/codetf-<another uuid>-.json"
 },
]

That way, if you wanted to keep the existing pixee explain mechanics, you could could isolate them to directories so there's no confusion if you run it on multiple directories.

@drdavella
Copy link
Member

This is an interesting idea although it also introduces a decent amount of complexity (e.g. how do I clean up the results metadata and CodeTF files?).

What if pixee fix writes to a .pixee/ directory within the given directory path? And by default pixee explain will look for that directory within the working directory, but alternately it can accept a directory path or CodeTF file?

@AmanPython
Copy link
Contributor

AmanPython commented Jan 9, 2024

Hi @drdavella, I support your proposed solutions.

Approach - 1

Store all changes in the .pixee/. We can either provide a .pixee/.gitignore file with * (similar to npm) to ensure Git ignores the current directory automatically, or we can recommend users to include .pixee/ in their .gitignore manually. This is the simplest solution.

Approach - 2

Save all changes at either $HOME/.pixee or $TMP, as suggested by @nahsra. This involves creating separate folders for each project (more efficient) or consolidating all changes in one location. Though slightly more complex, this approach allows centralizing changes, making it easier to track all suggested modifications for a user in the future.

I am willing to work on any of these approaches. Please advise on how to proceed.

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

No branches or pull requests

3 participants