
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Panache is a simple way to create style checkers for various languages. It does simple parsing of source files and then applies user-specified rules to detect style violations.
Code parsing is not full lexing; it is an intentional design goal to limit code introspection in order to avoid overlap with tasks best left to language-specific linters and static analysis tools. To that end, the code parsing is done with Textpow, which uses TextMate syntax files and annotates source with tags (so that we can detect things like comments, string literals, etc). Then rules are applied based on Textpow tags.
$ gem install panache
$ panache [-s panache_styles] code_path [code_path ...]
panache_styles
is the directory where your style files are stored and each code_path
is a file
or directory to check.
One of the most useful ways to use Panache is as a pre-commit or post-commit hook in your repository. For example, to check each file that was modified after you commit your git post-commit hook could look like:
#!/bin/sh
panache -s ~/repos/panache_styles $(git show --pretty="format:" --name-only)
To create a new style, you will need a Textmate syntax file and a rules file written in the Panache DSL.
The easiest way to get Textmate syntax files is to copy them out of a Textmate installation on your computer. They should have the path
/Applications/TextMate.app/Contents/SharedSupport/Bundles/<your-language>.tmbundle/Syntaxes/<your-language>.plist
This is a binary plist file, and Panache requires it to be in the text XML format; you can convert it like this:
$ plutil -convert xml1 <your-language>.plist
(Of course, you'll want to copy the plist file into the project directory to avoid corrupting your TextMate installation). You can download other, more exotic TextMate syntax files from the TextMate subversion repository.
Next, you need to write your rules file.
TODO(caleb): Update steps below.
<language>_style.rb
, where <language>
is the type of file you want to check.Dumb example:
Panache::Style.create(/\.txt$/) do
rule /(q)/, "The letter 'q' is not allowed in text files."
end
TODO(caleb) Implement these. Ideas:
FAQs
Unknown package
We found that panache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.