Transcript
00:00:00This is Fallo, a code-based intelligence tool for TypeScript and JavaScript that analyzes your entire codebase for dead code, duplication, unnecessary complexity and much more.
00:00:10Meaning there's no need to use a combination of NIP, JSC, PD and ESLint just to stop your agents from shipping bad code.
00:00:17It's built in Rust and supports over 90 plugins, meaning it will work out of the box with most frameworks and popular packages.
00:00:23But the fact that it only supports JavaScript and TypeScript make it less appealing for AI-assisted coders.
00:00:29Hit subscribe and let's find out.
00:00:30So here is a project that I'm working on that adds a cinematic film look to videos and images.
00:00:39It's mostly been built with clawed code, so it will have some level of AI slot.
00:00:43There's also a PR here for a new feature in that project, which I'll talk about later, as long as GitHub doesn't make it disappear by accident.
00:00:51So to get started, I'm going to run Fallo with the summary flag using BunX, which means I don't have to install it.
00:00:56And this gives a snapshot of my project, showing the dead code summary, duplication and a complexity health summary.
00:01:02And if we check the git status, it adds a new .fallo directory that contains the cache.
00:01:07So that means subsequent runs of this command will be faster and contains snapshot and any plugin information.
00:01:12Now, you may have noticed here that the health is 41 above the threshold.
00:01:16Now, what does that mean?
00:01:17Well, the Fallo health score is calculated by working out the cyclomatic complexity and the cognitive complexity.
00:01:24And it uses some formulas to calculate the complexity density.
00:01:27And down here, all this is used to figure out the maintainability index, which is the score that we see over here.
00:01:33So based on this score, it's detected that 41 of my files need to be refactored.
00:01:38From here, we can run any of these commands to get a more detailed report about a specific area.
00:01:43So if I wanted to focus on health, we could run this command.
00:01:46And after a while, it lists all the files that have different health issues.
00:01:49Note, if you want to know what CRAP stands for, this is an abbreviation for change risk anti-patterns,
00:01:55which you can learn all about in the documentation.
00:01:57But this level of detail is very easy for an agent to follow and know what to fix.
00:02:00In fact, I would say the duplication is a lot easier to follow since it gives the exact file and the specific line numbers.
00:02:06So we'll stick with that for now.
00:02:07And if we wanted to, we could add a fallo configuration file to give fallo information about certain patterns or dependencies you want to ignore,
00:02:14as well as setting some custom duplication settings, health setting and adding boundaries,
00:02:18which is a very cool way of declaring which directories can import from which other ones.
00:02:23But all of this is too complex for my needs, so for now we'll stick with the defaults.
00:02:27Now from here, we could run the fallo fix command or we could add the dry run flag to see exactly what it's going to do,
00:02:32which is try to address all the fixable issue types.
00:02:35And you can see here that it's going to remove a bunch of exports.
00:02:38But I actually don't trust fallo to run an automatic fix because it doesn't have much context of my code,
00:02:43what each function does and how everything works together.
00:02:46So instead of using the fix flag, I'm going to hook fallo up to my agent,
00:02:49which you can do using the MCP server or by using the VS code plugin, which I guess will work with cursor.
00:02:55But I'm going to keep things simple and just install the fallo skill, which contains some guardrails, some agent rules and some common pitfalls.
00:03:03So with the skill installed, I'm going to run clause code and I'm going to give it a prompt of study this project to understand how the code works,
00:03:10then run fallo to deal with the duplicated code, making sure removing it doesn't break core functionality.
00:03:16And when you're done, put the changes in a feature branch and run test to make sure the app works as expected.
00:03:22So we can see here loads the fallo skill.
00:03:24Then it runs the fallo dupes command and gets the format to export JSON, which is a machine friendly format.
00:03:29And after about four minutes, Claude has finished fixing three files instead of all the files fallo suggested,
00:03:34mainly because the others are test files, which are sometimes supposed to have duplicated code.
00:03:39I also asked it to create a PR and if we have a look at it, it's added 54 lines of code and removed 43.
00:03:46But this is because I've asked it to add a fallo configuration file, which is about 20 lines to ignore all test files in future reports.
00:03:54And of course, we should continue going down this line using Claude code or any other agent to fix complexity issues or any dead code.
00:04:00But fallo can also review PRs.
00:04:02So if we take a look at this PR I showed you earlier, running the fallo audit command will check any issues on this branch versus main so that we can only fix specific issues.
00:04:12And if we wanted to base it off a different branch, we could just use the base flag.
00:04:16But if we also didn't want to prompt Claude over and over again each time to use fallo, we could run this setup hooks command, which will generate some Claude code hooks for fallo.
00:04:24Fallo can also run as a GitHub action with PR annotations.
00:04:28It supports workspaces.
00:04:30It can export health badges and supports baselines, meaning the current issues can be fixed over time.
00:04:35And the CI only picks up new issues, which is great for fixing a big project with lots of issues.
00:04:41It basically has a lot of features, but all of them are pretty much static code analysis, which means it doesn't actually execute your functions.
00:04:49If you wanted something that did that, then fallo supports something called runtime intelligence to tell you what functions are being triggered when your app in production encounters real traffic.
00:04:59It does this by using V8 runtime coverage, emerges the results to an existing health report through a sidecar that can run locally or can be deployed anywhere you want.
00:05:08But this, of course, is a paid feature, which kind of makes sense.
00:05:11Overall, fallo is a great tool that I'm going to be using a lot more of, even though I think it has a lot of features and it only supports the JavaScript tech stack.
00:05:19Although other languages do have their own tools, I'm not sure it combines everything together as well as fallo does, and I think it's creator Bart done a good job of creating this tool, which actually uses OXC for passing semantic analysis and module resolution before the graph based analysis begins.
00:05:36So basically, it's never going to leave JavaScript, and I'm sure this makes Evanu very happy, not the JavaScript bit, but the OXC bit, since it's a tool that he's funding with void zero.
00:05:46Speaking of Evanu, if you want to hear us grill him about void zero, the plus, if react server components was a good idea and everything in between, then check out this video, which is an hour long podcast, and I think it's one of my favourite as of the ones we've done.