News for hackers. Stuff that matters.
Re:The creeping scourge of tooling config files in project r... by Legogris on Wednesday August 05, 2020 @10:14PM (#24067560)
Yeah, I take a cluttered root dir over having to hunt down files I may not know exist in various places in order to fully understand a project I’m not the maintainer of.

Gets me every time when a maintainer puts Dockerfile in some random subdirectory.

If the root dir is full of dozens of files from all the tooling needed to build your software, maybe you have another problem than directory structure...

Re:The creeping scourge of tooling config files in project r... by smohare on Wednesday August 05, 2020 @11:16PM (#24067824)
The same argument is made for not adhering to the XDG spec for user configuration files. The result is you have no real sense of specific locations for config files, shared static data, and app-generated data. If an app follows the spec you know exactly where to look. Otherwise it’s anyone’s guess.

I’ll admit this is less of a problem in project dirs, since tooling usually confines itself to a single file. But tooling outputs often similarly pollute. For example, I wish Python dumped its artifacts in a single directory I could delete, instead of in every source subdir.

Re:The creeping scourge of tooling config files in project r... by Legogris on Wednesday August 05, 2020 @11:37PM (#24067915)
> The same argument is made for not adhering to the XDG spec for user configuration files

I think it's a fundamental difference in that the project repo should be self-contained and "owned", whereas arbitrary software I run really shouldn't be putting files in my home directory.

In a software repo, anything inside it belongs to the project.

Re:The creeping scourge of tooling config files in project r... by pm215 on Thursday August 06, 2020 @03:11AM (#24068781)
I think there are similarities -- the project's root is the project's, so why does eg the Travis CI system get to insist on having a config file sat in the project root?
Re:The creeping scourge of tooling config files in project r... by pas on Thursday August 06, 2020 @04:16AM (#24069056)
Where should it go?

Just like the gitlab-ci.yml, it handles things related to the whole repo, it basically runs a script in the root of the repo anyway.

Sure, supporting other paths is useful (eg. in case of a monorepo), but this default seems sane. Though I'm interested in where others move it, and why.

Re:The creeping scourge of tooling config files in project r... by dijit on Thursday August 06, 2020 @04:48AM (#24069206)
it's pretty common to have a .ci folder for your build scripts.

But nothing is fundamentally wrong either with XDG-esque directory structures.

.config/travis/

.ci/travis/

all the same to me, as long as it's consistent.

Re:The creeping scourge of tooling config files in project r... by rumanator on Friday August 07, 2020 @08:08AM (#24080993)
> the project's root is the project's, so why does eg the Travis CI system get to insist on having a config file sat in the project root?

Because it defines the project's CICI pipeline? Aka how the project is built, tested, delivered, and deployed?

I mean, that's a more fundament part of the project than which files should be automatically ignored when committing stuff to git (i.e., .gitignore)

Re:The creeping scourge of tooling config files in project r... by wombatpm on Wednesday August 05, 2020 @11:22PM (#24067856)
With 3.8 python has PYthoncacheprefix where you can specify where the pyc files end up. Makes life so much better with docker
Re:The creeping scourge of tooling config files in project r... by BerislavLopac on Thursday August 06, 2020 @03:35AM (#24068869)
Do you know about the pyclean tool?
Re:The creeping scourge of tooling config files in project r... by mauvehaus on Thursday August 06, 2020 @06:34AM (#24069701)
Since switching to git, I'm increasingly of the mind that clean) belongs to the source control (`git clean') rather than the build. After all, the source control knows what files belong to a bare checkout of the project and which have shown up since you got your grubby little paws on the code!

git clean has options to only clean ignored files, which generally does what you want. I could see there being weird situations where a file is .PRECIOUS (in make's terms) or where you have a file that's ignored but not a product of the build (a developer-specific config file?) where this doesn't work, but I haven't run into that yet, and it's freeing to not have to maintain a free target by hand.

Re:The creeping scourge of tooling config files in project r... by tomc1985 on Wednesday August 05, 2020 @10:53PM (#24067722)
Exactly... the problem isn't the proliferation of config files, it's the use of so many tools that require those config files
Re:The creeping scourge of tooling config files in project r... by rapnie on Thursday August 06, 2020 @12:14AM (#24068069)
So are you advising developers to use less tools, or maybe all-in-one toolsets? Presumably tools are used to support tasks that were otherwise more onerous and time-consuming and maybe neglected because of that.
Re:The creeping scourge of tooling config files in project r... by rumanator on Thursday August 06, 2020 @02:00AM (#24068477)
>So are you advising developers to use less tools, or maybe all-in-one toolsets?

No, you're the only one arriving at that conclusion.

The whole point is that if you're going to adopt tooling then you'll need to configure them all, and that's fine with config files in the project root tree.

Re:The creeping scourge of tooling config files in project r... by addicted on Thursday August 06, 2020 @01:53AM (#24068445)
How about an all in one config file?

You have a standard JSON config file “.config.json” that resides in the root folder with a global object, with each key containing the config for each tool.

Collisions might be a concern, but you could use the tool’s url as the key so it’s unique. You are already seeing runtimes like Deno and Go do that for importing source code. Couldn’t the same thing apply for this config file as well?

Re:The creeping scourge of tooling config files in project r... by bryanrasmussen on Thursday August 06, 2020 @03:36AM (#24068872)
I'm pretty sure that I've read an aphorism along the lines that every configuration over time develops into an ad hoc programming language (similar to Greenspun's 10th rule so maybe I am just misremembering https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule)

At any rate the closest I could find to this saying was this HN post https://news.ycombinator.com/item?id=8092967 "Configuration files suck. Just use a programming language"

>but you could use the tool’s url as the key so it’s unique.

reminds me of XML namespaces.

on edit: formatting

Re:The creeping scourge of tooling config files in project r... by alephu5 on Thursday August 06, 2020 @02:38AM (#24068640)
That's how I configure my projects using dhall.

I'm working on a web application at the moment with a REST API, database, rabbitMQ, a few python workers, nginx, 2 react projects and a Gatsby project plus some docker composes for testing.

Everything is configured in the root file and then this is imported into smaller dhall files in the subprojects. In the build scripts I generate all the yaml and JSON from these, even the docker-composes and it's very ergonomic.

Re:The creeping scourge of tooling config files in project r... by GenKali on Thursday August 06, 2020 @03:00AM (#24068740)
First I'm hearing of this tool and it seems really nice. Do you perhaps have an open repo that shows how you are using the dhall files? If I can reduce my config files to dhall + justfile I'd be quite happy.
Re:The creeping scourge of tooling config files in project r... by rumanator on Friday August 07, 2020 @08:17AM (#24081042)
> How about an all in one config file?

What an awful idea. I don't even know where to start enumerating the problems that this approach creates, and what for? I mean, just think about it. Have you ever had to comb through a config file to add support for something but while you were not sure what option dictated which and what impact this or that option had because documentation is ineffective or awful or even non-existent?

Now multiply that complexity by all the options added by all the tools expected to use a file, compounded by the fact that God knows how many tools also write to that file and may or may not stay in their lane when doing so.

Who in the hell wants to deal with that mess?

And what for? Just because someone wants to adopt a tool but has a problem with having to configure its own config file?

Re:The creeping scourge of tooling config files in project r... by hakre on Thursday August 06, 2020 @06:57AM (#24069816)
Not so sure if it "must" be _one_ config file.

I also don't think that the format matters more than it's use.

Reminds me of some good advice in The Pragmatic Programmer, should be (simple) text-files for editing and (regardless if one or multiple files), a single source of truth (e.g. if multiple files, not the same time the same data to edit in). This is roughly as I remember it and I found it always useful to apply.

If I see duplication, it's about fighting the rot and remove it.

If configuration files are generated, they don't belong under version control (there are some exclusions to this rule, e.g. pinning dependency versions for example when shared with the repository).

Re:The creeping scourge of tooling config files in project r... by tomc1985 on Thursday August 06, 2020 @10:57AM (#24071471)
Yes, less tools. Perhaps by making better use of existing tools
Re:The creeping scourge of tooling config files in project r... by dkdk8283 on Thursday August 06, 2020 @05:29AM (#24069403)
I’ve never had a problem using find and grep -R