Closed sydneypemberton1986 closed 1 year ago
Hello @seddonym ! I wrote you a while back about the project we were planning for our company's modularity linter. The first step is upon is, which is adding support for JSON files. We need that support because the contracts we are looking to add will need to contain more complex structure than is supported by TOML such as nested objects.
It is our sincere hope that this will be accepted into the mainline package so we don't have to maintain a forked version.
Hi Sydney, thanks for the PR!
I have to admit that I'm reticent to add support for JSON files at this point, for these reasons:
Sorry if this is disappointing - I do recommend reaching out before starting the work on a PR to see if I'm broadly bought into the idea, as I hate to waste your time!
Did you have a chance to consider my reply to your original issue?
Final thought: if you absolutely must have JSON support you could probably do it without forking Import Linter, and instead just copying importlinter.cli
and importlinter.configuration
as different files. The configuration file could then pass in your custom UserOptionReader and importlinter.cli
could import that configuration file instead.
Happy to keep discussing, let me know what you think.
Hey David,
Thanks for your response. I am disappointed for sure, but I totally respect your reasons and your protectiveness of the consistency of the user experience, as well as your experience as a maintainer.
Here are some counterpoints, for what it's worth:
I'm not sure I understand your point about copying the files, but happy to look into that.
I did get a chance to read over your response and I very much appreciated it. I apologize for not responding there sooner.
Our situation is complex, and we do need to be able to group things in the way described. It gets us from "pie in the sky" to "implementable".
If we used the ignore mechanism, we would be ignoring thousands of imports. What we are going for is more a "modularity metric".
Thank you so much again for your wonderful project. And I just want to say I've enjoyed reading your code and seeing the hexagonal architecture at work.
Cheers, Sydney
So I'm embarrassed to say to say that I was ignorant of TOML's dotted properties, which will work for us. Closing the PR.
So I'm embarrassed to say to say that I was ignorant of TOML's dotted properties, which will work for us.
Oh, glad to hear!
I'm not sure I understand your point about copying the files, but happy to look into that.
I mean that there is a way you could enable JSON support while still working (mainly) on the released version of Import Linter. It's a bit awkard but you'd only need to fork a couple of files.
What we are going for is more a "modularity metric".
This is interesting. If that's the case, I wonder if Import Linter is the best fit: you could consider using my lower-level library Grimp instead, which is what Import Linter uses. You could then express what you need (in JSON if you want) and it could output the metric.
I'd be happy to have a chat at some point to better understand how you're using the tool, feel free to email me if you would like to arrange.
I also tested that the files are loaded correctly with the following manual test that I didn't think was appropriate to commit.
If there is a better way to test this, I'm happy to add the documentation to the contribution instructions.