---
title: Function names should be camel case
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Function names should be camel case
---

# Function names should be camel case

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

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

{% /callout %}

## Metadata{% #metadata %}

**ID:** `kotlin-best-practices/function-naming`

**Language:** Kotlin

**Severity:** Notice

**Category:** Best Practices

## Description{% #description %}

This rule mandates that function names in Kotlin should be written in camel case, starting with a lowercase letter using no underscores.

The exceptions are factory functions, which may be named the same as the type they create, and `@Composable` functions, which must still be in camel case, but starting with a capital letter.

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

```kotlin
fun Foo() {}

fun Foo_Bar() {}

fun foo_bar() {}
```

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

```kotlin
fun foo() {}

fun fooBar() {}

fun `fun`() {} 

// Factory functions can have the same name as the type they create
fun MyService(): MyService {}

fun Node(text: String) = Node(text = text)

// Composable functions are in CamelCase
@Composable
fun MyButton(text: String) {}

// Test functions may have any name
@Test
fun `test - works`() {}

fun `whatever I want to put here`() {
    // ...
}
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 