[HN Gopher] Show HN: Spaghettify - A VSCode Extension to make yo...
       ___________________________________________________________________
        
       Show HN: Spaghettify - A VSCode Extension to make your code worse
       with AI
        
       Recently, I saw Github Next Code Brushes
       (https://githubnext.com/projects/code-brushes) which is a VSCode
       extension that can use AI to do things like make your code more
       readable, add types, etc.  This inspired me: what if there was an
       extension that could use AI to make your code worse as well?  Meet
       Spaghettify. An extension I developed that can do things like:  -
       Obscure your code  - Introduce a bug  - Make the variable names way
       too descriptive  - Use nonsymmetrical whitespace  - Add
       irrelevant/rambling comments  - Document the code with emoji  -
       Document the code in any style (Dirty Limerick, Fast Talkin' 1930s
       Gangster)  I built this extension over the last couple of days and
       released it in collaboration with BCAD.one. It's available on the
       VSCode Marketplace, you will need an OpenAI API Key to use it. You
       can grab it here:
       (https://marketplace.visualstudio.com/items?itemName=BCAD.spa...)
       Code here:  https://github.com/BeforeCutieAfterDoggo/spaghettify
        
       Author : jmilldotdev
       Score  : 281 points
       Date   : 2023-02-10 15:03 UTC (7 hours ago)
        
 (HTM) web link (www.spaghettify.dev)
 (TXT) w3m dump (www.spaghettify.dev)
        
       | klyrs wrote:
       | Excellent! I, for one, recommend using this tool to make parallel
       | versions of important files in every github repo. If the AI can't
       | learn to keep their hands out of the honey jar, they don't
       | deserve to survive.
        
       | fragmede wrote:
       | How creative! Did you consider adding _wrong_ comments? Because
       | those are the worst! like flip the logic from arithmetic to
       | subtraction and then have the bot summarize that.
        
         | jmilldotdev wrote:
         | That's a really good one. Like the 'introduce bug' one, but
         | just the comments are factually incorrect.
        
       | dgan wrote:
       | > Overly Descriptive Names
       | 
       | Looks like regular Lisp function names to me -\\_(tsu)_/-
        
       | dcow wrote:
       | The little animation at the top wraps when it gets to "Well
       | Documented" on mobile. The whole page keeps shifting up and down.
       | It's really hard to read. Maybe it's on purpose but just pointing
       | it out. It detracted from the comedy for me. Otherwise love the
       | gag.
        
         | jmilldotdev wrote:
         | Ah, good catch. Will fix.
        
       | racl101 wrote:
       | I ran it and it made my code better.
        
       | batch12 wrote:
       | Something like this could be good for malware authors as a new
       | obfuscation tool. Would be awesome if it still delivered working
       | code and could recurse so the level of nasty was tunable.
        
       | whatever1 wrote:
       | It is not worse than my code. Better luck next time AI.
        
       | das_keyboard wrote:
       | ...and everyone said my job won't be replaced by AI :/
        
       | ahmednazir wrote:
       | What is the real life uses of this project?
        
         | jmilldotdev wrote:
         | getting to the top of hackernews
        
       | serpix wrote:
       | Add irrelevant comments has real world use for some students who
       | are required to comment all of their code when submitting their
       | work.
        
         | bee_rider wrote:
         | I've been trying to push students in the direction of fewer,
         | better comments but it is a lonely hill to die on.
        
       | ChickenNugger wrote:
       | Two thoughts:
       | 
       | * This is ridiculous. Why would you do this? Which made think of
       | this quote: "Which is ridiculous and unnecessary but when has
       | that ever stopped programmers?" from one of my favorite Tom Scott
       | videos: https://www.youtube.com/watch?v=gocwRvLhDf8
       | 
       | * How to Write Unmaintainable Code:
       | https://github.com/Droogans/unmaintainable-code
        
       | caust1c wrote:
       | Great way to introduce bug-doors! Looks hilarious, love it!
        
       | Mizza wrote:
       | The obfuscation is a little too obvious. The people need
       | something which defends their job security but still passes code
       | review.
        
         | onemoresoop wrote:
         | Involve a few layers of unneeded steps of indirection via a few
         | hyped technologies. Now obfuscation is not easily removed.
         | Beware, it may bite the creators themselves
        
         | foobiekr wrote:
         | That's like 90% of Java that uses spring.
        
       | mystickphoenix wrote:
       | I'd love to see a feature that creates tests that don't actually
       | test anything
        
       | what-no-tests wrote:
       | Oh can you have it add code blocks that are commented out?
       | 
       | And have it do the opposite of "Extract a method" - oh and have a
       | class call a method on another class that calls a method on
       | another class that calls a method on the original class (but for
       | every single thing that needs to happen in the critical path)?
       | 
       | If you can't, I have some developers I'm cleaning up after who
       | can...
        
       | jackcviers3 wrote:
       | Am I the only one that found the more explicitly named definition
       | way easier to read? Sure the definition name was too large, but
       | the inner variables were great.
        
         | thefifthsetpin wrote:
         | Nah. I worked at a company that had a code style guide
         | encouraging very verbose variable naming. It was awesome.
        
         | jmilldotdev wrote:
         | There have been many moments in building this thing where I
         | expected something terrible and got something that actually
         | looked better than what I had.
        
         | yamtaddle wrote:
         | I read that feature on the list and immediately thought "I bet
         | that improves more code than it harms"
        
       | throwawayben wrote:
       | Are there any examples to enjoy for my amusement without
       | installing & setting up the extension?
       | 
       | Edit: nevermind, just found the home page:
       | https://www.spaghettify.dev/
        
         | jmilldotdev wrote:
         | Also, it's open source and all the prompts we use are in this
         | file:
         | 
         | https://github.com/BeforeCutieAfterDoggo/spaghettify/blob/ma...
         | 
         | You can take these and play around with them in the OpenAI
         | playground as well.
        
       | JonathanFly wrote:
       | >A VSCode Extension to make your code worse with AI
       | 
       | >Document the code with emoji
       | 
       | >Document the code in any style (Dirty Limerick, Fast Talkin'
       | 1930s Gangster)
       | 
       | >worse
       | 
       | TIL I've been coding wrong my whole life. But it's the only way I
       | know...
        
         | lelandfe wrote:
         | Wow, fast talkin' 1930s gangster documentation is pretty
         | remarkable.
         | 
         | >> Listen up, ya mugs! I'm gonna give ya the lowdown on dis
         | here function, getSourceImage().
         | 
         | >> Dis baby is the real deal. It's gonna give ya the goods on
         | the source image. Ya got it? The source image! No more guessin'
         | or snoopin' around, dis function'll give ya the straight dope.
        
       | codeulike wrote:
       | Big fan of "document using emoji"
        
       | thatxliner wrote:
       | This is a work of art
        
       | alvis wrote:
       | I used to spend lots of time to prepare some coding tests that
       | mimic real-world situations for candidates, like introducing a
       | small bug to an example code or pretending I've bad coding
       | practice etc.
       | 
       | Now I found the best tool ever! Thank you.
        
       | BMorearty wrote:
       | Nice. A few more ideas: consolidate small functions into one huge
       | function; change await to callback hell in JS; goto!
        
       | progx wrote:
       | Lol!
        
       | cheapliquor wrote:
       | On one hand, funny. On the other, potentially useful for either
       | teaching yourself or learning to read other people's code.
       | Intentionally botching or skewing code and teaching yourself to
       | deal with it/fix it.
       | 
       | Would use if I was even halfway decent at coding
        
       | smoldesu wrote:
       | This is pretty amazing. I'm inspired to go write something
       | similar now, that uses AI to pad out source code to exactly 80
       | characters per-line...
        
         | JeanSebTr wrote:
         | Vertical screen users thank you in advance!
        
       | dmkirwan wrote:
       | What (presumably!) was built as a joke will actually help me a
       | lot. For my side-project (devscreen.io) we have to make lots of
       | realistic coding tests and pull requests with bugs in them for
       | candidates to work on as part of a technical interview. It's
       | actually more time consuming than you'd think to intentionally
       | insert bugs into code in a way that isn't super obvious, so thank
       | you!
        
         | jmilldotdev wrote:
         | Bugs-as-a-Service (BAAS)
        
           | quectophoton wrote:
           | "Because, you see, bugs are a way of connecting people to the
           | real world. Reminding them that, at the end of the day, it is
           | just a game." -- Matt Jablonsky, Head of Bug Creation
           | Department
           | 
           | Quote from an Aprils Fools video for The Witcher 3.
        
         | sublinear wrote:
         | I think use cases like this are the right ones for generated
         | code from language models.
         | 
         | I'm pretty sure the vast majority of training data is more
         | buggy than not and literally writing the code is only half of
         | what it takes. The other half is comprehension of the problem
         | it solves which is usually missing from documentation at the
         | level of mere snippets.
        
           | 908B64B197 wrote:
           | Something I wonder is what the computing landscape (and tech
           | recruiting) will looks like once we reach a critical mass of
           | "GitHub Co-Pilot native" devs. Especially with the bootcamp
           | craze.
           | 
           | Are we going to see hires basically trying code generation
           | until it builds?
        
           | groestl wrote:
           | Take something perfect and internetlify it. It was basically
           | trained on exactly that data.
        
         | yellow_lead wrote:
         | Just ask half the candidates to add a feature to the code, ask
         | the other half to find the bug.
        
       | btrettel wrote:
       | I'm now realizing that AI could be quite useful for introducing
       | bugs for mutation testing. I'm going to have to try that.
        
         | danuker wrote:
         | Indeed, it would make mistakes similar to common mistakes in
         | the web at large.
        
       | jimt1234 wrote:
       | I don't need this extension. My code already looks like this. LOL
        
       | [deleted]
        
       | camel-cdr wrote:
       | Ah, I was waiting for somebody to implement something like this.
       | Now you just need to write a bot that floods github with shitty
       | code, and we've got job security again.
        
       | debuggest wrote:
       | Here comes AI threatening to take my job away again.
        
       | neoneye2 wrote:
       | Awesome.
       | 
       | Evil ideas for improvements.
       | 
       | Random typos in class name, function names, comments, such as:
       | inheritance -> enheritance class -> clas cannot -> cannont
       | 
       | Pick related words: person -> user, account, customer
       | 
       | Random swapping plural/singular users -> user
       | 
       | Append "Class" to classnames. example: User -> UsersClass
       | 
       | Insert rant comments about, politics, religion, profanity.
        
         | Gordonjcp wrote:
         | "privite" and "private" and "privet" but there are #defines to
         | make them work anyway.
         | 
         | I actually saw code that looked like that from a very dyslexic
         | mate of mine who I worked with a long time ago.
        
         | RobotToaster wrote:
         | Emojis as class and variable names
        
         | peterkos wrote:
         | also, common capitalization mixups: "ID vs. Id", "snapshot vs.
         | snapShot", "username vs. userName"
        
         | reaperducer wrote:
         | Don't forget homonyms:                  InActive (not active)
         | inActive (in the Active list)
        
           | kunalgupta wrote:
           | kill it with fire
        
           | kvandy wrote:
           | I'm so triggered
        
       | moremetadata wrote:
       | When you introduce a bug, is it a dumb random bug, or an
       | intelligent AI bug?
       | 
       | In other words, would the bug work for me or the user?
       | 
       | When I say work for me, what I mean is, considering decompiler
       | tools like https://ghidra-sre.org/ can shine light where once
       | there wasn't, would the bug generates lots of unnecessary work
       | for me, or could I use the bug as a stealth form of copy
       | protection, where those with illegal copies get bitten by the bug
       | and eventually forced into purchasing said code?
       | 
       | I've seen that technique used with a software company supplying
       | addons to other programming companies. Cant say its a technique
       | taught at places like University.
        
       | poulpy123 wrote:
       | You should have called it Job Assurance Generator
        
         | jmilldotdev wrote:
         | our best defense against the robots is a good offense
        
       | [deleted]
        
       ___________________________________________________________________
       (page generated 2023-02-10 23:02 UTC)