---
title: Enforce nullable type spacing
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Enforce nullable type spacing
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Enforce nullable type spacing

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `kotlin-code-style/nullable-type-spacing`

**Language:** Kotlin

**Severity:** Notice

**Category:** Code Style

## Description{% #description %}

A type can be declared as nullable by appending a question mark (`?`) to the type name. The proper coding convention is to have no space between the type name and the question mark. This rule ensures that there is no space between the type and the question mark.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```kotlin
val foo: String ? = null
val foo: List<String ?> = listOf(null)
val foo: Map<String, String> ? = listOf(null);
```

## Compliant Code Examples{% #compliant-code-examples %}

```kotlin
val foo: String? = null
val foo: List<String?> = listOf(null)
val foo: Map<String, String>? = listOf(null);
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 