Ask HN: Do you pull and run code as part of code review?
89 points| gary_chambers | 4 years ago
I'm interested to hear what other people think. Do you run code as part of code review?
89 points| gary_chambers | 4 years ago
I'm interested to hear what other people think. Do you run code as part of code review?
[+] [-] paradite|4 years ago|reply
- Require the author to attach screenshots of the feature in a markdown table format showing the before and after comparison. This is enforced using a MR template.
- Require the author to attach screen recording for complex user interactions.
Overall effect is that it saves everyone's time.
- The author has to verify that the feature works anyway, so taking screenshots / recordings doesn't take much addtional efforts.
- The reviewer can focus on code itself instead of checking whether the code works.
- Easy for both parties to spot design and UX issues/regressions visually.
[+] [-] BossingAround|4 years ago|reply
I'd think that for frontend, you'd have CI/CD pipeline that deploys the code into a staging server, where I can test it myself.
[+] [-] mnutt|4 years ago|reply
[+] [-] dinkleberg|4 years ago|reply
[+] [-] slaymaker1907|4 years ago|reply
For recordings, if you use Windows you can bring up the game bar with Win+G. It has a very easy to use screen capture tool meant for gaming, but perfectly fit for small software demos. It even captures sound which is sometimes useful.
[+] [-] bobobob420|4 years ago|reply
[+] [-] Folcon|4 years ago|reply
[+] [-] lazypenguin|4 years ago|reply
[+] [-] tharne|4 years ago|reply
I didn't used to, but that was a very big mistake.
Just wait until something you signed off on doesn't run and folks ask, "But didn't you review this code and say that everything 'looked good'? It doesn't even run!"
It's embarrassing to say the least.
If you're doing a code review, run the darn code. What would you think of a mechanic who didn't make sure the car was able to turn on after claiming it was fixed?
[+] [-] city41|4 years ago|reply
If someone pushes a change without anyone reviewing it, I sometimes find their fear of making a mistake causes them to scrutinize the change more than if it had been reviewed. Not always of course, depends on the context and people involved.
[+] [-] azornathogron|4 years ago|reply
As a reviewer (in the places I've worked so far) for me it depends what type of change it is. E.g., for a frontend change I might need to run it to be able to actually try it out and check what it looks like, whereas for a backend change I might rely more on reviewing the tests and if the tests look good then I probably wouldn't bother running locally to poke at the thing myself. Of course there are also just general issues of how big and how complicated the change is.
Anyway, wherever possible mechanical stuff like "does it build and run" should be covered by a CI system or other automation, not by spending reviewer time on it.
[+] [-] maximus-decimus|4 years ago|reply
If you can't trust the person who created the PR to have tried to compile the code... What are they even doing.
[+] [-] bobobob420|4 years ago|reply
[+] [-] bluGill|4 years ago|reply
Which is to say 'it doesn't work' is nitpicking that reviewers shouldn't be wasting their time checking.
[+] [-] verdverm|4 years ago|reply
[+] [-] Pooge|4 years ago|reply
[+] [-] berkes|4 years ago|reply
Additional benefit is that this shows to devs and management what a time saver TDD and testing in general is. It shows immediately that lacking tests cost valuable, senior, time, rather than save time by not writing tests.
It also is simply needed: when there are no tests, we'll need to manually verify and check for regressions.
[+] [-] bobobob420|4 years ago|reply
[+] [-] ricardolopes|4 years ago|reply
In my previous team, the reviewer was the main responsible for the code they were approving. They were expected to test locally and should actively hunt for potential issues, such as checking in the logs that the ORM was building correct SQL.
In my current team, the developer is the main responsible for the code they're pushing, and is expected to do all the tests needed. Reviews are more about ensuring code standards, finding possible oversights, requirements mismatches, and so on.
No one strategy is right or wrong, as long as expectations are set and everyone knows their responsibilities and expectations.
[+] [-] tester756|4 years ago|reply
Why? it feels like individual preference
>such as checking in the logs that the ORM was building correct SQL.
Couldnt the person who creates PR copy/paste sample generated SQLs into PR?
[+] [-] xen0|4 years ago|reply
Sometimes, if it adds a new feature or something 'interesting', I've checked it out locally to see what the user-facing behaviour is, but this is very rare.
[+] [-] bri3d|4 years ago|reply
For straightforward regressions and minor tweaks I am usually satisfied to see a video and test automation, but for any kind of new functionality I strongly advocate pulling the code and actually playing with it.
Depending on your company structure, product managers can help with this functional review as well, although this requires working tooling and org structure in a way that doesn't exist at some companies.
[+] [-] imetatroll|4 years ago|reply
- the author to test and have a succinct PR description that includes before and after screenshots/video as appropriate
- the reviewer to test the code locally
The reviewer test is particularly important for front-end code which is where automated tests are more likely to be poorly written or absent.
It goes without saying that there should be targeted automated tests, but I find that in practice the front-end is where this tends to fall short.
[+] [-] alexdowad|4 years ago|reply
I should probably learn from him.
[+] [-] eyelidlessness|4 years ago|reply
- what’s in the change; if I’m reasonably sure I understand it, and that it won’t have side effects, and that it’s the right thing to do, I may skip running it
- how familiar I am with the area of the codebase; even if the above is satisfied, I’ll pull it and explore around the change to look for potential side effects I’ve missed, or other approaches that might be better for maintenance… and generally to improve my familiarity
- how confident I am in the other contributor’s (and reviewers’) thoroughness; I generally scrutinize even trivial changes if I don’t think others have, because surprising things sometimes reveal themselves
[+] [-] hatchnyc|4 years ago|reply
I am always amazed at how many repetitive tasks folks want to load up developers with. I think there’s a tendency among developers-turned-managers to see their job as crafting the perfect “program” of processes for their developers to follow, instead just automating these tasks. Like they say, the cobbler’s children have no shoes.
[+] [-] auslegung|4 years ago|reply
[+] [-] simplyinfinity|4 years ago|reply
Code compilation (and checks) & tests must be requirement as part of each PR
[+] [-] rvieira|4 years ago|reply
If it's something simple I can grok by reading the code and tests I usually don't.
If it's a complex piece of code, I find it valuable to run it locally, to setup some breakpoints, debug it and step it to understand it better.
[+] [-] dec0dedab0de|4 years ago|reply
Though sometimes I'll check out their branch, open up a repl and run a few functions or something on my own.
[+] [-] tootie|4 years ago|reply
[+] [-] nine_k|4 years ago|reply
Only if something really draws my attention do I pull and run a particular PR (CR, CL, whatever yo call it). Once I did that to illustrate that the change introduces a security issue, so I had to write an exploit against it, and demonstrate how it works. (It helped.)
[+] [-] wodenokoto|4 years ago|reply
[+] [-] manibatra|4 years ago|reply
- We are finding deficiencies in our testing/development methods. The more people have to test/run code the more we are able to find bottlenecks and eliminate them.
- Knowledge sharing. We found that team members had knowledge/tricks in their heads which are being shared more.
- The overall reliability of our systems(measured via SLOs) has greatly increased.
[+] [-] koyote|4 years ago|reply
Other than that, no. I am reviewing the coding standard, architecture, and algorithms used. It's up to the dev to ensure that the code works and runs. The CI builds as well as the QA testers will test the actual functionality works as expected (obviously if I can't find the code that is supposed to fix/implement the PR item, I will question it).
[+] [-] nameisname|4 years ago|reply
[+] [-] bradlys|4 years ago|reply
In most of my companies - no. The reason? Not practical for time constraints.
To be honest - this is mostly how you find out if a company values quality or speed. Most I’ve been at valued speed more than anything.
[+] [-] alkonaut|4 years ago|reply
[+] [-] ChrisLTD|4 years ago|reply
[+] [-] bombcar|4 years ago|reply
Bugs introduced will be caught and fixed in general testing usually.