Open gpickin opened 4 years ago
Hi @gpickin, I am not sure I follow, could you give me an example of the issue?
We ran into this today. Using cfformat run
, it will use the .cfformat.json` file in the root of our app.
Using cfformat watch ./
, it used what I presume are default settings.
The behavior wasn't consistent - might be that if we ran cfformat run
first and then cfformat watch
it would use the correct rules. cfformat settings
showed us the right settings every time.
Platform: Linux (WSL2)
@MordantWastrel Thanks, that is helpful. Reading your comment, I realized that watch
is technically using globs, and I bet the settings resolution isn't function correctly on those. The solution is probably going to be resolving the settings a file at a time.
So my memory of how the settings resolution is performed was faulty, it is in fact already resolved per file. So I am not sure where this issue is coming from. I have published v0.15.6
which will provide more feedback when watching files as to where the settings it is using are coming from. Hopefully that will help narrow this down.
Using v0.15.13. Not seeing the source of the settings when running a watch.
If I explicitly define the settingsPath
the full path to my .cfformat.json is displayed as expected.
CommandBox:traverseapisdk> cfformat watch ./
Watching Files...
Formatting helpers\utility.cfc
Setting sources:
Formatting took 94ms
@CreativeNotice I can't reproduce this locally, which is frustrating. When CFFormat is searching for config files it starts in the directory of the file to be formatted and then climbs up the directory tree to the drive root looking for .cfformat.json
files. It stops when it either encounters a .cfformat.json
file, or sees a .git/
directory in the current directory it is checking. So, for example, taking your output above, if your helpers/
directory has a .git/
folder in it, it wouldn't search above that directory. Absent that, I am not sure why it wouldn't find your .cfformat.json
file in the parent directory.
Because the user settings are based on the location of the file being formatted, it doesn't resolve and find the .cfformat.json file correctly, therefore the files are formatted incorrectly.