squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
18.65k stars 3.35k forks source link

Add warning for dotfiles in info plugin #7142

Closed kamilkrzyskow closed 4 weeks ago

kamilkrzyskow commented 1 month ago

Attempt at handling #7125

I admit the PR is a bit "noisy", for such a small feature, but I think this is the best I can do, given that there are 2 separate for loops for directory/files paths. There are 2 warnings, during the processing phase and later in the summary. I want to make sure people see it. Perhaps the display of the list at the end is unnecessary and not so convenient, as I think it is?

Please name your bug report (2-4 words): gmc
WARNING -  The following .dotpath will be included: C:\MyFiles\Gothic Modding\git\gmc\.git
WARNING -  The following .dotpath will be included: C:\MyFiles\Gothic Modding\git\gmc\.github
WARNING -  The following .dotpath will be included: C:\MyFiles\Gothic Modding\git\gmc\.gitignore
Processing: C:\MyFiles\Gothic Modding\git\gmc\.git\objects\pack
List of potentially sensitive files:
  - C:\MyFiles\Gothic Modding\git\gmc\.git
  - C:\MyFiles\Gothic Modding\git\gmc\.github
  - C:\MyFiles\Gothic Modding\git\gmc\.gitignore
WARNING -  Archive contains potentially sensitive dotfiles.
           Please review and share only necessary data to reproduce the issue.

EDIT: I will try to modify the actual summary file list and change color of the dotfiles. This should remove the need for another list.

squidfunk commented 1 month ago

PR looks good so far, thanks! This also means that a .meta.yml will trigger a warning, right? I guess this is okay, let's see how users will react to it.

kamilkrzyskow commented 1 month ago

I removed the second list, and instead changed the color of the dotpaths. This has lead to creating a second list anyway, because the file names are sorted, and the yellow color has a higher ANSI value, therefore all dotpaths are ordered last. I also removed some conditionals, when clearing the indicator, because it turned out to be unnecessary.

I wanted to print a count of the dotpaths, but the results highlight also the contents of dotdirectories, so the count wouldn't match from what was initially detected, to keep it simple I don't count anything now.

I think it's cleaner than the initial PR, but let me know what you think :v:

This also means that a .meta.yml will trigger a warning, right?

Yes, I didn't really plan to handle such cases, because we'd have to read config setting from other plugins. Even though it's only meta and blog now šŸ¤” But as you pointed out it might detect false positives, so I changed the wording a bit.

squidfunk commented 1 month ago

@kamilkrzyskow you can merge it if it's ready to go šŸš€

kamilkrzyskow commented 4 weeks ago

Okey dokey šŸ‘Œ