nolo 0.1.1

A CLI tool for discovering and analyzing `TODO` comments across codebases.
Documentation
mod common;

use insta::assert_debug_snapshot;
use nolo::comment::extract_todo_comments_with_language_detection;

#[test]
fn extract_rust_todo_comments() {
    let fixture = common::fixture_path("rust_basic.rs");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    assert_debug_snapshot!(todos);
}

#[test]
fn extract_python_todo_comments() {
    let fixture = common::fixture_path("python_basic.py");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    assert_debug_snapshot!(todos);
}

#[test]
fn ignore_unknown_keywords() {
    let fixture = common::fixture_path("custom_keywords.js");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    assert_debug_snapshot!(todos);
}

#[test]
fn handle_files_with_no_todos() {
    let fixture = common::fixture_path("no_todos.rs");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    assert_debug_snapshot!(todos);
}

#[test]
fn handle_empty_files() {
    let fixture = common::fixture_path("empty_file.rs");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    assert_debug_snapshot!(todos);
}

#[test]
fn prevent_false_positives() {
    let fixture = common::fixture_path("false_positives.rs");
    let keywords = vec![
        "TODO".to_string(),
        "FIXME".to_string(),
        "NOTE".to_string(),
        "HACK".to_string(),
        "BUG".to_string(),
    ];
    let todos = extract_todo_comments_with_language_detection(fixture, &keywords);
    // Should be empty - no false positives from "debugger", "buggy", "notebook", etc.
    assert_debug_snapshot!(todos);
}