爱意满满的作品展示区。
IceHazymoon

基于 jev 写了一个全新的 lint 引擎,更快更智能更高效,节省 llm 的调用,尤其适合大型项目的开发

  •  
  •   IceHazymoon · 17h 14m ago · 369 views

    基于 TypeSafe 的 Jev 写了一个新的 lint 引擎 使用自然语言描述规则,对于传统 lint 无法做到或难以实现的部分,可以交由 jev 去做一次验证

    对于大型项目来说,每个模块或功能都有自己的一套规范和规则,agent 受限于上下文并不总是会遵循这些规范去开发,且让传统 llm 对照 skills 或规范去做审查和调整,无论效率还是成本都难以优化

    所以开发了这样一个引擎,基于 ast-grep 去匹配函数/文件/路径,且带有缓存,同样的代码每次运行不会重复调用 jev ,也会智能的去匹配对应的规则进行审查,并给出原始规则/修复建议,类似 eslint/oxlint 这样的传统引擎的使用体验

    规则定义大概是这样

    // jevlint.config.ts
    import { defineConfig, defineRule } from '@hazymoon/jevlint';
    
    const noSecretInLog = defineRule({
        id: 'logging/no-secret-in-log',
        severity: 'error',
        status: 'owned',
        why: 'Secrets written to logs spread to log storage, alerts and backups.',
        files: ['src/**/*.ts'],
        prefilter: /\b(?:console|logger)\.(?:log|info|warn|error|debug)\s*\(/,
        question: 'Does the code in `code` pass a password, API key, access token or other secret value to a logging call?',
        criteria: {
            true: 'A logging call receives a value that holds a password, API key, token or similar credential.',
            false: 'Logging calls only receive identifiers, counts, statuses or already-redacted values.',
        },
        fix: 'Remove the secret from the logging call, or log a redacted form of it.',
    });
    
    export default defineConfig({ rules: [noSecretInLog] });
    

    仓库如下: https://github.com/Ice-Hazymoon/jevlint

    欢迎 star 和使用,期待大家的反馈和建议

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3669 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 00:16 · PVG 08:16 · LAX 17:16 · JFK 20:16
    ♥ Do have faith in what you're doing.