wide-midnight-78598
03/27/2022, 2:47 PMConfigFilesRequest the canonical mechanism to grab a config file from a source root? Like a .clang-format or .eslint.rc or similar? If so, is there any formal documentation around it outside of source code?wide-midnight-78598
03/27/2022, 3:02 PMisort and black as inspiration, so I thought I understood how it works, but I'm less certain.
When I use the specified field and point directly at my .clang-format file, it works great, no problems.
When I use the check_existence (which gets passed into PathGlobs- I'm a bit less sure.
In my case, .clang-format, a few variations, and nothing specified are all valid cases. If I use specified - not placing any formatter files in the firectory causes the glob to fail, even though no config file is a valid workflow.
If I place all valid config file permutations into check-existence, the fmt runs, but it doesn't pull and use in my .clang-format file.
I feel like I'm missing something trivial herewide-midnight-78598
03/27/2022, 3:04 PMbitter-ability-32190
03/27/2022, 3:47 PMhappy-kitchen-89482
03/27/2022, 4:33 PMwide-midnight-78598
03/27/2022, 4:38 PMspecified empty is perfectly valid, and then only using check_existence - at which point, we should be good. But it almost looks like check_existence wasn't putting anything into my Digest which is π€―
I'll be digging into it again in just a few minutes, so hopefully I was just doing something flagrantly wrong last night and it'll "just work β’οΈ "happy-kitchen-89482
03/27/2022, 4:38 PMspecified means "this file must exist" and check_existence is for a set of files that may or may not exist, but if they do, pull them inhappy-kitchen-89482
03/27/2022, 4:38 PMhappy-kitchen-89482
03/27/2022, 4:39 PMcheck_existence is what you wanthappy-kitchen-89482
03/27/2022, 4:39 PMwide-midnight-78598
03/27/2022, 4:40 PMcheck_content was great, it opens up a few possibilities for Prettier (specifically, how I use prettier by keeping config in the package.json )
I'll report back shortly if I can get this working. Judging by the other code, and these responses, I'm not missing anything - so hopefully it's just a typo or something πhappy-kitchen-89482
03/27/2022, 4:43 PMwide-midnight-78598
03/27/2022, 4:45 PMwide-midnight-78598
03/27/2022, 4:57 PMhappy-kitchen-89482
03/27/2022, 5:05 PMhappy-kitchen-89482
03/27/2022, 5:05 PMwide-midnight-78598
03/27/2022, 5:06 PMwide-midnight-78598
03/27/2022, 5:32 PMfast-nail-55400
03/27/2022, 5:43 PMScalafmtConfigFiles is an example that doesn't use ConfigFilesRequesthappy-kitchen-89482
03/27/2022, 5:56 PMhappy-kitchen-89482
03/27/2022, 5:56 PMfast-nail-55400
03/27/2022, 6:33 PM.scalafmt.conf in subdirectories to take effect for Scala files in that subtree.fast-nail-55400
03/27/2022, 6:34 PMhappy-kitchen-89482
03/27/2022, 11:06 PMConfigFilesRequest can't handle that via a glob?fast-nail-55400
03/27/2022, 11:27 PMspecified with ConfigFilesRequest, then you must know the paths in advance and it is an error if they donβt exist (and wants the glob to come from an option name i.e. request.specified_option_name ). If done via request.discovery, then you have to specify check_content which also does not work with .scalafmt.conf , since no specific snippet to check for. So ultimately easier for implementing the algorithm to just construct the globs it needs based on Scala source directories and just call PathGlobs. Most of the magic is in matching source directories to the nearest ancestor directory with a .scalafmt.confhundreds-father-404
03/28/2022, 2:49 PMthen you have to specify check_contentYou can set it to empty, you only have to use one of
check_content or check_exist
I think using ConfigFiles would work, I honestly only didn't think of that in code reviewhundreds-father-404
03/28/2022, 2:50 PMConfigFiles. I wrote it when we added config file discovery in Pants 2.4(?) to DRY
(There was a dark age where you had to explicitly specify every config file)wide-midnight-78598
03/28/2022, 3:13 PMfiles ,resources , other source files, and then configuration. I think this seems like the most reasonable mechanism, or configuration would also need to be in the source files glob - which I'm not sure I likehundreds-father-404
03/28/2022, 6:01 PMfile or resource targetwide-midnight-78598
03/28/2022, 6:21 PM