This is some environmental storytelling right here. I see a story of an electrician, all out of appropriate lengths of wood, working past five on the night before the drywallers show up.
That can't possibly be an actual electrician's work, can it? That's got to be the work of a homeowner who didn't know the correct way to locate an outlet in the middle of a stud bay.
Nah, it's been awhile, but I've been an electrician. When you get a foreman who has made it to that special level of asshole, your give a fuck starts to run out incredibly fast. Even if you're not the kind of guy who would do this yourself, someone working with you probably is.
With that said, I don't think this would pass code, but I'm honestly curious as to which part it violates specifically. The wire doesn't look like it's secured properly at least, but this might be one of those things where this is where they learn that they need to write some new passages.
I had a semi related, IRL, Bethesda style enviornmental story telling 'event' involving a wall happen once.
Back in college... I wasn't actually in this one fraternity, but was friends with almost all the guys in it, was good friends with the core group that restarted its local chapter that had been dormant for like a decade or two.
So one day, its video games and beer, and ... well, this one room needed to be renovated, so we didn't give a fuck. One guy loses at Smash Bros, fucking fist through the wall.
... After he walks back a bit, we notice... wait wtf there's something... on the frame...?
We tear out more of the wall, and no shit, there is a miniature time capsule in the form of a note saying basically 'Cheers to any future (fraternity name)'s, from the class of 1982!' ... and there is also a fucking can of Rainier ... from 1982.
So the dude who initially Donkey Kong'd the wall gets dibs on the 30+ year old stale beer of course, downs it immediately.
... The funny part is that this was always supposed to have been a dry fraternity, no alcohol allowed.
The stupider part is that it would be easier to stack out from the other direction.
There are 8 pieces of wood @ 1.5" each = 12"
Studs are 16" on center.
So to stack from the right would be 2 pieces to be in the same place.
You can even see the gray box that opens to the wall behind it. That is attached to the stud on the right...its that close. But here I go applying logic to crazy.
I'm sure from a code perspective there's something wrong here, but there must have been an issue with securing it from the right, and someone saw a bunch of scrap lumber pieces and said, got an idea. It's not structural and needing to hold weight, so I'm really curious why, other than aesthetics, this is bad. Once covered by drywall, will this be some problem in the future?
The OP describes the specific problem this causes. It's expected that these types of boxes are attached to studs and have void space next to them on the other side. Deviation from that pattern can cause issues with later installations expecting studs in some places and voids in others.
NEC 314.23(B) An enclosure supported from a structural member ... shall be rigidly supported either directly or by using a ... or wood brace
NEC 314.23(B)(2) ... Wood braces shall have a cross section not less than 1"x2"
This is fine. I'm not an electrician and don't know what that is securing the romex but I assume that's approved.
I mean I guess if the inspector wants they could deny it for not being "neat and workmanlike" but they'd have to really be an asshole. Like it's weird but it's not going anywhere, not like a switch is a heavy piece of equipment. This would probably even be fine for a light.
Since you seem to be comfortable citing the codes, what about the space between those studs? I thought it had to be a little less than the 2 feet we seem to see here.
Use stud finder (beep) move it two inches (still beep) move it further (still beep) move it again (still beep). "Stud finder must be broken" Get another stud finder (still beep but the whole section again) "I need to know what's behind this wall before I just bolt this TV to this fucking thing" (cut away the drywall) "I better make this look like something stupid for fake Internet points..."
It's like when I first looked into the gap in the sheetrock around my breaker panel and discovered that my basement has at least 1 (and likely many more) fully wired outlets that were just sheetrocked over at some point. I definitely would have been happier if I hadn't known that.
I mean all builders/electricians/plumbers are cowboys. If the task could be standardized they'd not be making bank so consistently. The job is always ad-hoc, custom, and temporary-permanent
I don't think so. Modern homes are usually standard drywall. I live in an older home that has wood panneling as was common in the '70s. It's a bitch to hang anything with it.