12 ms·
Shittier: Code formatting tool that makes your code look terrible
- seritools 3y agoNeeds a --check that enforces a minimum number of prettier violations per 100 lines :^)
- epipolar 3y agoCool, now I can copy highly structured and perfectly formatted code from LLMs and make it look I hacked it all on my own last night
- frontalier 3y agowait, you're not running a linter on save?
- Ensorceled 3y agoNo, since it DEFINITELY would look like AI generated it.
- dspillett 3y agoI'm sure this wouldn't make half as much difference to my code as I'd like to think… > Random indentation for a chaotic code structure. One to add if it isn't there already: some blocks indented by tab, some by spaces, some mixed.
- Skeime 3y agoWhy is the source code not formatted using the tool itself?
- tromp 3y agoSo that you can run it on its own source as demonstration of its powers?
- merelysounds 3y agoFeature requests: 1. Convert leading indentation to tabs or spaces at random. 2. Insert trailing spaces. 3. Use varying indentation styles - pick at random from: https://en.wikipedia.org/wiki/Indentation_style#Overview https://en.wikipedia.org/wiki/Indentation_style#Overview
- henriquecm8 3y agoWhenever there is a chain of method calls put all in a single line.
- ljm 3y agoThis is rookie-level shittifying. What it needs to do is insert `with` blocks at random, with various levels of nesting, so you completely lose track of the scope of any object property.
- WorldMaker 3y agoToo "bad" that `with` blocks are forbidden in strict mode and most JS is strict mode by default now. You could somewhat approximate it with lots of unadorned blocks and complex object destructuring. { const { prop1: a, prop2: A, prop3: xTy } = obj // … { const { prop1: A, prop2: xTy, prop3: a } = obj // … } } Something like that.
- specialist 3y agoHeh. And randomly add "-Decorator" suffix to class names. Ages ago, I tried to diplomatically explain to our Senior Architect Grand Poobah (and my team lead) that one set of Decorators are actually Chain of Commands. And that they shouldn't be silently swallowing exceptions. After a few minutes, he says "u/specialist, I'm surprised someone with your experience doesn't understand architecture." Then gets up and walks away.
- finger 3y agoThat’s exactly what my company’s legacy code base looks like.. No one wants to reformat the files because then it will mess up with git history. It was horrendous to look at at first, but I’ve gotten used to it by now and just apply the same random style to whatever snippets I modify. :)
- ajsnigrutin 3y agoIs it possible to get something like this: https://i.redd.it/as700946ez9z.jpg https://i.redd.it/as700946ez9z.jpg , but without the indents? So a flat block of code aligned to the left, and all the brackets in a column on the right? ...just trying to be evil... :)
- mstade 3y agoI cant decide whether I think this is supremely evil or just mad genius. Supremely evil mad genius maybe? :o)
- gchamonlive 3y agoI thought it was absolutely genius but I will never admit it. But seriously, if anyone is to maintain code like this, this will force the lowest possible cyclomatic complexity.
- mstade 3y agoExactly, and to me that's the genius part. I feel almost dirty for kinda liking it.
- gchamonlive 3y agoYou can't just force a python programmer to start coding in java without mental health support.
- deleted 3y ago[deleted]
- undebuggable 3y agoThat's simply CoffeeScript, if you set an awkward screen resolution to overflow the screen on the right.
- ambigious7777 3y agoI found this while browsing the web a few days ago, exactly what you wanted :O https://dimden.dev/beautifier/ https://dimden.dev/beautifier/
- sverhagen 3y ago>Shittier is a purely satirical project And yet, I'm sure some folks will find serious applications, like in cases of malicious compliance when having to share your code against your will.
- frontalier 3y agowouldn't that be easily solved by prettier?
- _aaed 3y agofine i'll minify it then
- K0balt 3y agoI wonder if there are anti patterns you could use that would confound the parser in prettier?
- spacebanana7 3y agoWe could create lots of config driven abstractions to confuse anyone without insider knowledge of a company. Like allowing an application to use several different caching / database setups depending on values in property files. Java / Spring has so much potential.
- rnts08 3y agoNot sure if it has been posted yet, but yes: https://github.com/Droogans/unmaintainable-code https://github.com/Droogans/unmaintainable-code
- mixermachine 3y agoMinify + Shittier seems like a fun idea to make analysing the code even more painful :D
- eternityforest 3y agoI was thinking maybe it could be used for debugging, in the same way some have suggested a mode that reassigns names randomly so you can't rely on pattern matching as much
- dusted 3y agoThis looks very much like the typescript formatter we use...
- callamdelaney 3y agoCan you make it so it takes my beautifully arranged imports and mushes them together using brackets and commas? Oh wait..
- mstade 3y agoI used to work with a fella that wrote code similar to this. To him, code seemed to be a scratchpad, a place to jot down ideas and try them out. Once an idea worked out, he shipped it. Done. Impossible to maintain, but damn if he couldn't churn out some quality works. Bug laden, sure, but the core ideas were great – at times even brilliant. There was a certain beauty to the chaos. Prettier wasn't around then, and code for matters weren't much of a thing at all really. Can't help but think if that would've helped or stymied his process. Certainly would've helped the rest of us though!
- masklinn 3y ago> Impossible to maintain, but damn if he couldn't churn out some quality works. Bug laden, sure That doesn’t sound like quality work. I’ve had colleagues like that, they’re a pain in the ass because they look productive at the cost of everyone else holding the bag, and while they’re useful for exploratory or prototypal work it can be difficult to make the stakeholder understand that no the bug-ridden mess with an injection per SQL query is not going into production ever. I’ve wondered if forcing them to use a very restrictive langage could help channel the mess somewhat.
- throwawaysleep 3y ago> difficult to make the stakeholder understand that no the bug-ridden mess with an injection per SQL query is not going into production ever. Why do you bother saving the stakeholder from themselves?
- Ensorceled 3y agoBecause the stakeholders often don't have the wherewithal to understand the difference so we shouldn't let the charlatans and terminally flawed take advantage of them.
- rubyfan 3y agoThere is an interesting difference in philosophy in this and the parent. One is the mindset that engineering is a profession and the other something of a market will sort itself out approach. Unfortunately we’re living in a world where the doors are coming off airplanes mid flight.
- wiradikusuma 3y agoA.K.A job security.
- avgcorrection 3y agoWith some smudge/clean filter or wathcamacallit you can make your job easy at the same time.
- KronisLV 3y agoThis reminds me of seeing others' code in the first year of university. There was a pretty basic intro to some language constructs, but for some reason the first exams were done on paper. People wrote everything without indentation, or with inconsistent spacing. Somehow this also carried over to the code that they'd write in the computer, so it was pretty much unreadable, since you couldn't glance at a block of nested loops and realize what goes where.
- lagrange77 3y agoI felt so stupid when I had to write code on paper at uni.
- logtempo 3y agofor when a company want the opensource label but is too selfish to share.
- schutt 3y agoPlease make sure to ship this as a prebuilt .exe file.
- stabbles 3y agoIn Python it should turn a list of strings ["foobar", "baz"] into [ "foo" "bar", "baz" ] to infuriate people further. Also possible in C and C++: char * strings[] = { "foo" "bar", "baz" };
- sylware 3y agoHaving a code generator for each and everything mandating accutely expensive dependencies (massive and complex scripting language/templating SDK) is brilliant too...
- luke-stanley 3y agoPerhaps this could make useful synthetic data for improving large language models improving code, because you could have two pairs of code, better code, and the terrible code. This is probably already done internally at the top AI labs.
- detinho 3y agoBut to do that "shittier" would have to get a good implementation and turn on a bad implementation. Formatting might not be enough. Howerver the main idea is very interesting.
- luke-stanley 3y agoI would presume the code before was better than the code after, so that's how you could get two sets. It might not be much of a boost, it could depend, and I'm sure there are other data augmentation techniques. Good model improvement is usually an iterative loop, trying things out to optimise an objective.
- truculent 3y agoIt would be useful in conjunction with other data, but wouldn’t the model just learn the logic of the obfuscation code (unless perhaps you heavily regularised it?)
- luke-stanley 3y agoYes in conjunction. For causal models like GPT, this sort of approach might help augment data, making it go further when training, or fine-tuning and the model could be trained on "improving" the bad code, actually the existing code. So the before and after would be reversed. For encoder-decoder models they can can be trained, or fine-tuned on a more explicit translation task. So just a kind of https://en.wikipedia.org/wiki/Data_augmentation https://en.wikipedia.org/wiki/Data_augmentation
- self_awareness 3y agoNot nearly as shitty as the code I have to work with
- agilob 3y agoA reminder that spaghettify exists too https://www.spaghettify.dev/ https://www.spaghettify.dev/
- d--b 3y agoEmoji comments, that's something I'm taking home, thanks
- madeofpalk 3y agoIf it was deterministic - everyone on your team uses it to produce the same formatting, no matter show shitty it is - it would still meet the same goals as Prettier.
- michaelmior 3y agoI would strongly disagree. People have different preferences on what makes code readable. But I would prefer anyone else's definition of readable to something that aims to objectively make code unreadable.
- kuchenbecker 3y agoConsistently unreadable would train you to pick out syntax cues to read the code if actually forced to fix these issues.
- Someone 3y agoThe problem with this tool is that it’s too easy to revert most of its work (everything except for the case changes in identifiers, AFAICT) using a prettifier. To make it robust against such adversary attacks it should incorporate the teachings of “How To Write Unmaintainable Code” (https://github.com/Droogans/unmaintainable-code https://github.com/Droogans/unmaintainable-code)
- russfink 3y agoI could see someone triggering a proper obfuscator (not this) as a time bomb, rendering the code in a permanent frozen feature state - usable but unmaintainable by future employees. (The contract says only to “write code to do this feature…”.) Do contracts provide legal barriers to this?
- n6h6 3y agoThat would be a good way to destroy the reputation of your company lmao. Leaving nothing but horrors in your wake. Kind of funny, though, even if it's cruel to everyone who comes after you.
- logtempo 3y agoIn general it does. doing bad work is better, because you deliver poor quality. but if you deliver something and then break it on purpose, it's like breaking something that belong to the company(not you). Remember that everything you do in a company don't belong to you.
- deleted 3y ago[deleted]
- singleshot_ 3y agoAs a party to a contract, if you act in a way that denies to the other party the benefit to which they are entitled, you could be said to have breached the implicit obligation of good faith and fair dealing that is more or less implied in every contract.
- Jemm 3y agoWorked with a company that outsourced their code. Contract stated that source code must be provided so in an effort to be pricks, the outsourced company provided their code on fanfold dot matrix printouts using a line printer from the 80s. It arrived in three very heavy boxes not even folded neatly. This reminded me of that for some reason.
- rayrey 3y agoMalicious Compliance is the term
- deleted 3y ago[deleted]
- bjclark13 3y agoI know this is satirical, but I would actually use this with my web development students as an exercise if it introduced more subtle shittiness that they would have to fix.
- netbioserror 3y agoSometimes the nightmare is some mix of organized and chaotic. I had the responsibility of rewriting from scratch a C codebase that was deliberately obfuscated. The spacing and bracketing and general code style was almost perfect. But every name was obfuscated into nonsensical single letters and contractions, and every ostensibly simple math operation was separated into a multiline series of single stateful operations on a variable. Plus, global variables. Surprised I managed to do it at all, but it was circumstantial evidence for what each operation did that helped immensely, plus a few logical and mathematical lightbulb moments. Rewriting it in Nim has also helped me make it well-organized and self-documenting. I have a document full of pseudocode but it looks basically exactly the same as the Nim code!