1
\$\begingroup\$

Context

I am positively surprised by the amount of code quality verifications that can be performed automatically. Accordingly, I thought it may be valuable for other people that are not familiar with pre-commit or that do not have the know-how on how to set up such a configuration on their own device, to get pre-commit feedback on the code that they are asking questions about.

Assumptions

Additionally, I make the following assumptions:

  1. This forum aims to appreciate questions that require significant expertise to answer. (To keep attracting experienced users/keep experienced users interested). (So off-loading "trivial" feedback into pre-commit may allow users to focus on more difficult questions).
  2. I assume some code review questions can be answered using automatic code quality verification alone. And/or that the question poster could learn more things to improve about their code through automated code quality verification (than only that which is replied to).
  3. Given that pre-commit for Python repositories alone already supports over 14 hooks, and approximately 23 built in checks, I assume quite a bit of submitted code fragments could benefit from such an automated check.

Question

Hence, I was wondering whether people on this site would be interested in integrating such an automated, opinionated checker in the question upload section.

Note

  1. This is not to suggest that pre-commits could answer/resolve arbitrary questions, merely that it may be a support tool to provide (new) coders with more feedback on the quality of their code.
  2. I am aware opinions differ, so I think it is important people should be both able to ignore the pre-commit and configure the pre-commit configuration, yet having some default configuration may actually be valuable for a lot of people that are relatively new to coding.
  3. Hosting such service on the site, may attract unwanted attention, if default spam detection is not able to deter such unwanted attention, it may be possible to allow new/unverified/untrusted users to cover their own computation costs using micropayments using their metamask/litecoin/monero or whatever.
  4. This question is not related to how that should be implemented. This question is about whether people would think it would add (sufficient) value.
  5. I am not affiliated with pre-commit or anything, the software just helps and teaches me a lot about my own work.

Straw-person arguments

Based on the votes in this related post from 7 years ago, the consensus seemed to be (oversimplified):

  1. "linters are bad" - As explained in the comments, I think this argument is slightly elitist. Additionally, this argument can be mitigated by making the pre-commit feedback optional. I expect many (less-advanced) users, such as myself, could find great value based on such automated feedback. I feel like the documentation and feedback of pre-commit/linters has been increased significantly since 7 years ago. However, perhaps I have grown faster in my understanding than these linters have grown in feedback quality. I think the safest way to determine the added value of such a linter, would be to build the option in the code-review site as optional, and perform surveys on whether users understood the feedback, and whether they considered it valuable.
  2. "people can figure install their own linting tools". I think the people that would benefit the most from such pre-commit feedback have no idea that they can actually install extensions that perform automated code quality checks for them. On top of that, in my experience, it is often still a bit challenging to get such extensions to work properly. So I think the hurdle to learn from automated feedback would be smallest if the feedback is provided optionally and directly in the "post-question" section.

So I would like to make a plea to re-consider, build the option, perform a survey and conclude based on the survey data interpretation.

Note, I am aware that there exist limited resources, so a reason to not do this, would be that working on other topics is considered more valuable. This is solely an argument between: "no automated code quality feedback option" and "having the option to receive automated code quality feedback when posting a question".

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Related: Codereview building blocks and Is there a place for automated code reviews \$\endgroup\$
    – Peilonrayz Mod
    Jul 8, 2022 at 15:02
  • 1
    \$\begingroup\$ I've used a number of linters in Python and most of the output is normally not great. Many users would not deem the output to be an insightful observation and so may not be deemed a good answer. Additionally many linters, are very opinionated saying only one style of programming is allowed. I normally have to ignore any opinionated linters because many of the points raised are terrible advice for the question at hand. \$\endgroup\$
    – Peilonrayz Mod
    Jul 8, 2022 at 15:07
  • \$\begingroup\$ I can imagine the output of the linters is difficult to understand, yet feel like it has quite good documentation to learn why some change is described. It seems clear that at your experience level (and perspective) linters are an annoyance rather than helpful. Yet to prevent denying new coders the opportunity of automated feedback, based on an Ivory Tower perspective (from me, you and others that reply in this meta section), it may be valuable to implement it, and to do a survey to test if new users find the functionality useful or not. I am aware this costs quite a bit of resources to setup. \$\endgroup\$
    – a.t.
    Jul 8, 2022 at 15:18
  • 1
    \$\begingroup\$ To be a bit more contrarian, I think the "they give bad advice" and "I dislike linters because they are bad" is (respectfully) an elitist argument that does not apply to (the majority of) the people that ask questions here. If you disagree with that, I think the argument could still be mitigated by making the pre-commit check "optional" (and disabled by default). I do sympathise with: "the output is too difficult for new users", though I think that up to a significant extent could be resolved over time with effort. Alternatively, users could ask questions about this confusion to learn more. \$\endgroup\$
    – a.t.
    Jul 8, 2022 at 15:25
  • 3
    \$\begingroup\$ I use linters every day as they are helpful; "It seems clear that at your experience level (and perspective) linters are an annoyance rather than helpful." "I am aware this costs quite a bit of resources to setup." I don't think you appreciate how many resources this would take in a way fit for CR (with our IO requirement and the many styles we get). Otherwise someone would have done this by now. \$\endgroup\$
    – Peilonrayz Mod
    Jul 8, 2022 at 15:50
  • \$\begingroup\$ "I don't think you appreciate how many resources this would take, otherwise someone would have done this by now" That implies such a tool would be a valuable option (according to the person(s) who built it), which is actually what the question is about. From the related posts, the consensus seemed to be that such an option is not desirable. I think "yes that would be valuable, but working on other topics is considered more valuable" is a perfectly fine answer. Yet, then at least people could know that codereview.stackexchange.com would be happy (to experiment) with such an option. \$\endgroup\$
    – a.t.
    Jul 8, 2022 at 15:55
  • 1
    \$\begingroup\$ Automated linting can be part of an answer, but is not an answer by itself. It is only valuable if it is explained why it is better and automated tools are notoriously bad at explaining things. How are you going to combine this automation with providing insights? Too many people have fallen into the "you should strictly adhere to PEP 8" trap and experts have shown exactly why adhering to a strict standard can be detrimental. \$\endgroup\$
    – Mast Mod
    Jul 8, 2022 at 18:34
  • 2
    \$\begingroup\$ If people want to use such tools as part of their answer, that is up to them. But there will be no integration into the site. Even if we wanted to, we'd need support from Stack Exchange employees (the moderators you see here are volunteers, not staff) and they have a massive backlog of things which are more interesting to the network as a whole. \$\endgroup\$
    – Mast Mod
    Jul 8, 2022 at 18:36
  • 2
    \$\begingroup\$ If you want to help people setting up a linter, that's a different question. I'm sure you can write a canonical question & answer about that on Stack Overflow that can be used as a resource in other answers. \$\endgroup\$
    – Mast Mod
    Jul 8, 2022 at 18:37

1 Answer 1

1
\$\begingroup\$

I am suspicious about fully automated bot answering questions.

Especially as linters often give pointless or harmful suggestions and blind obedience is not a good idea.

But it is entirely OK for user to limit their answer to what linter would caught AND mention that AND ask user to post a new question with code that has such issues fixed.

See for example https://codereview.stackexchange.com/a/207483/108929

Though that applies only in cases where linter complaints would be about real issues.

If someone wants they can try to automate answer generation using linter and post such answers in cases where they provide useful feedback.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .