All Projects → alokmenghrajani → riskybird

alokmenghrajani / riskybird

Licence: AGPL-3.0 license
Regular expression authors best friend

Programming Languages

Opa
4 projects

Projects that are alternatives of or similar to riskybird

montre
The original timed regular expression matcher over temporal behaviors
Stars: ✭ 14 (-70.83%)
Mutual labels:  regular-expression
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (+39.58%)
Mutual labels:  linter
reuse-action
A Github action to check repositories for REUSE compliance
Stars: ✭ 31 (-35.42%)
Mutual labels:  linter
LLRegex
Regular expression library in Swift, wrapping NSRegularExpression.
Stars: ✭ 18 (-62.5%)
Mutual labels:  regular-expression
linter-glsl
Atom package that lints GLSL shaders on the fly.
Stars: ✭ 15 (-68.75%)
Mutual labels:  linter
parsesig
A Telegram bot that forwards messages from one private/public channel to another after formatting
Stars: ✭ 40 (-16.67%)
Mutual labels:  regular-expression
termco
Regular Expression Counts of Terms and Substrings
Stars: ✭ 24 (-50%)
Mutual labels:  regular-expression
standard-www
👆 Website for JavaScript Standard Style (@standard)
Stars: ✭ 28 (-41.67%)
Mutual labels:  linter
eslint-plugin-roku
ESLint plugin to parse and lint BrightScript files
Stars: ✭ 44 (-8.33%)
Mutual labels:  linter
fury-kubernetes-opa
Kubernetes Fury OPA. Policy enforcement for your Kubernetes Cluster
Stars: ✭ 34 (-29.17%)
Mutual labels:  opa
elodin-old
Quality and Optimisation tools for CSS in JavaScript
Stars: ✭ 15 (-68.75%)
Mutual labels:  linter
opa-docker-authz
A policy-enabled authorization plugin for Docker.
Stars: ✭ 67 (+39.58%)
Mutual labels:  opa
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-70.83%)
Mutual labels:  linter
goreporter
A Golang tool that does static analysis, unit testing, code review and generate code quality report.
Stars: ✭ 3,019 (+6189.58%)
Mutual labels:  linter
asterisklint
Asterisk PBX configuration syntax checker
Stars: ✭ 45 (-6.25%)
Mutual labels:  linter
es6-template-regex
Regular expression for matching es6 template delimiters in a string.
Stars: ✭ 15 (-68.75%)
Mutual labels:  regular-expression
pre-commit-opa
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development
Stars: ✭ 53 (+10.42%)
Mutual labels:  opa
CVparser
CVparser is software for parsing or extracting data out of CV/resumes.
Stars: ✭ 28 (-41.67%)
Mutual labels:  regular-expression
rubocop-graphql
Rubocop extension for enforcing graphql-ruby best practices
Stars: ✭ 143 (+197.92%)
Mutual labels:  linter
edit
A stand-alone implementation of the Acme text editor's command language.
Stars: ✭ 29 (-39.58%)
Mutual labels:  regular-expression

RiskyBird

Regular expression authors best friend

Overview

Regular Expressions are notoriously hard to get right. When you are writing a new expression, it is hard for reviewers to read & assert with confidence that the expression is correct. Tweaking existing expressions can often lead to unintended consequences.

RiskyBird tries to mitigate this by offering a set of tools for software engineers:

  1. A parser: guarantees the expression is well formed.
  2. A pretty printer: helps interpret the regular expression.
  3. A lint engine: catches common mistakes.
  4. A unittest engine: prevents future mishapes.
  5. A collaboration platform: reviewers can add tests and provide feedback.

This project also provides a reusable regular expression parser.

Why RiskyBird

We love AngryBirds and we wanted a name that starts with R.

See it in action

https://www.quaxio.com/regexp_lint/

Some notes

I haven't found a nice place to put these, so leaving these notes here.

Here are some tips to help you write better regular expressions:

  1. Is the language regular(*)? We have often tried to write regular expressions for languages which are not regular! This always leads to issues down the road. If the language is not regular, you will need to use a Lexer/Grammar.

    (*) regular expression engines actually implement some features which cannot be described by regular languages (in the formal sense), but you get my point.

  2. Can I use a less powerful but faster library (i.e. pattern matching instead of regular expressions)?

  3. Am I trying to match a URI (or part of one)? It is extreemly hard to get URI parsing right, and different browsers interpret URIs differently. The only way to get this right is to split the URI into parts (protocol, user, password, domain, port, path, etc.), run the desired checks on the parts and then rebuilt a new URI with the proper escaping applied to each part. Again, we have libraries to do this!

    If you aren't convinced this is required, go read the browser security handbook or the Tangled Web.

  4. Don't be lazy. If you know your expression should match the beginning of a string put the ^ anchor. If you are expecting a ".", use . instead of the dot metacharacter. Use non capturing groups when you don't need to capture a group. Etc.

  5. Different engines / different programming languages behave in slightly different ways (what were you expecting?). Don't just copy paste regular expressions from one language in to another!

    Proof:

    • in JavaScript: new RegExp(/^[\\abc]+$/).test('abc\\'); → true
    • in PHP: preg_match("/^[\\abc]+$/", "abc\\"); → false

Code Layout

  • riskybird.opa: web code
  • riskybird_parser.opa: regular expression parser
  • riskybird_string_printer.opa: pretty printer
  • riskybird_xhtml_printer.opa: pretty printer
  • riskybird_lint.opa: lint engine
  • riskybird_eval.opa: evaluation engine
  • riskybird_unittest.opa: unittests

License

RiskyBird is distribtued under the AGPL license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].