Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 1.33 KB

File metadata and controls

70 lines (55 loc) · 1.33 KB

Contributing to arhus

arhus is a local-first security scanner for TypeScript & JavaScript.

Setup

git clone https://github.com/sudoeren/arhus.git
cd arhus
bun install
bun link

Development

# Interactive mode
arhus

# Scan the project itself
arhus scan .

# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Build for Node.js
bun run build

Adding a Rule

  1. Create a new file in src/rules/<rule-name>.ts
  2. Implement the Rule interface:
    import { Severity } from '../types';
    import type { Rule } from '../types';
    
    export const myRule: Rule = {
      id: 'my-rule-id',
      name: 'My Rule',
      description: 'What it detects',
      severity: Severity.High,
      check(context) {
        // Walk context.sourceFile AST with visitor pattern
        // Return Finding[] for each match
      },
    };
  3. Register it in src/rules/index.ts:
    import { registerRule } from '../rule';
    import { myRule } from './my-rule';
    
    registerRule(myRule);
  4. Write tests in tests/rules/my-rule.test.ts
  5. Run bun test to verify

Commit Messages

This project follows Conventional Commits:

  • feat: - new feature
  • fix: - bug fix
  • chore: - maintenance
  • docs: - documentation
  • test: - tests
  • ci: - CI/CD changes