slopguard-rules 0.1.20

Builtin rule definitions for slopguard
Documentation
id: test-needs-timeout
language: rust
severity: warning
category: correctness
enabled: false
message: "Async test without tokio::time::timeout. Risk of silent hang in CI."
note: "Wrap the test body in timeout(Duration::from_secs(N), async { ... }). Opt-in rule: enable in slopguard.toml."
rule:
  kind: attribute_item
  all:
    - regex: 'tokio::test'
    - precedes:
        kind: function_item
        not:
          has:
            regex: 'timeout'
            stopBy: end
ignores:
  - "**/fixtures/**"
tests:
  should_match:
    - |
      #[tokio::test]
      async fn test_fetch() {
          let result = fetch().await;
          assert!(result.is_ok());
      }
    - |
      #[tokio::test]
      async fn test_send() {
          send_message().await;
      }
  should_not_match:
    - |
      #[tokio::test]
      async fn test_fetch() {
          let result = timeout(Duration::from_secs(5), fetch()).await;
          assert!(result.is_ok());
      }
    - |
      #[test]
      fn test_sync() {
          assert_eq!(1 + 1, 2);
      }