pcdshub / pre-commit-hooks

Pre-commit hooks for PCDS projects (https://pre-commit.com/)
Other
10 stars 7 forks source link

Idea: hook to check for mixed and/or pinned TwinCAT versions #28

Closed rruiter87 closed 4 months ago

rruiter87 commented 4 months ago

We had a discussion here https://github.com/TcOpenGroup/TcOpen/issues/731 about the mixed TwinCAT versions and pinned ones in the tsproj files. Would it be an idea to add another pre-commit to check for this? I can add it.

Something like check-twincat-versions --target-version 4024.22 --pinned

Different cases:

  1. In case of a single project, you can select if it should be pinned and add an optional target version.
  2. For two or more, it can check if all target versions match the targeted one and if they are pinned. If no target version is given, it checks whether more than one version is used.

Optionally, I can also add an --fix option, that would fix --pinned and if a --target-version is given.

ZLLentz commented 4 months ago

This would get some use from me for sure, it's broadly helpful.

Some scattered thoughts about this:

Unrelated thoughts:

rruiter87 commented 4 months ago

In some projects this could add friction- you'd have to change the TwinCAT version in two places when you want to update it. But in such cases you simply wouldn't use it.

True, but that's not something that happens regularly. Also as you mentioned, you don't have to use it.

Not to increase scope, but a future extension to this (or separate pre-commit action) could also check for the Project -> Properties -> Advanced -> Write project version in files. I might look into this later if I have time (though I'm not currently working on TwinCAT things)

Yeah, I thought about that as well :D. I think that is one that Jakob mentions in his video. Maybe I'll find some time to do this.

Thank you for linking TcOpen to me- I'm not sure how I've managed not to see it before. I've forwarded the docs pages to my team for visibility because it seems like the kind of thing we should be using/contributing to.

The TwinCAT community and projects are growing faster than someone can keep up :). I've started to use it a bit and have mixed feelings. On the one hand it is great that a lot of standard cases are already taken care of. On the other hand, the project is in the alpha phase, there's scarse documentation and it is quite complex, but the people of MTS are very helpfull and put a lot of time and effort into it.

Is it possible that TcOpenGroup is a more suitable github home for many of these pre-commit hooks? I'm not suggesting an immediate migration, but it's food for thought to make these more community-visible.

Maybe, but I think it is find for now. I've been spamming this pre-commit every chance I get ^^.

ZLLentz commented 4 months ago

closed by #29