> For the complete documentation index, see [llms.txt](https://42-guide.gitbook.io/42-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://42-guide.gitbook.io/42-guide/piscine-life/norminette-important.md).

# Norminette  !IMPORTANT

## Norminette: Coding Standards at 42

**Norminette** is a coding style checker used at the 42 school to ensure that your code adheres to specific formatting, structure, and best practices for C programming. It helps maintain consistency across all projects, making your code clean, readable, and easier to maintain.

### Purpose of Norminette

Norminette checks your code for issues such as:

* Proper indentation
* Consistent naming conventions
* Correct file structure
* Usage of appropriate functions and code patterns

By following **Norminette**, you’ll improve the readability of your code, which is important when collaborating in teams and during the peer-review process. The goal is not just to follow a set of arbitrary rules, but to develop good habits that result in clean, maintainable code.

### Key Rules Enforced by Norminette

Here are the main aspects that Norminette checks for:

#### 1. **File Naming**

* File names should be in **lowercase letters**, with **underscores** separating words.
* Example: `ft_putchar.c`, `ft_print_alphabet.c`

#### 2. **Indentation**

* Use tabs, not **4 spaces per indentation level** .
* Make sure the indentation is consistent and aligned.

#### 3. **Line Length**

* Lines should not exceed **80 characters**. This helps in keeping the code clean and readable, especially on small screens or when reviewing code.

#### 4. **Function Length**

* Functions should be **small** and **concise**.
* Try to keep your functions to **under 25 lines**. If a function exceeds this, it may need to be split into smaller, more manageable parts.

#### 5. **Braces and Control Structures**

* Opening braces `{` should be on the other **line** as the control structure (e.g., `if`, `while`).
* Example:

  ```c
  if (condition)
  {
      // code
  }
  ```

While not all code requires comments, it’s important to add them when the logic is complex. Avoid redundant comments, such as those that just restate what the code is doing. and all the comments have to be outside function.

## 8. Function Declaration and Prototypes

Functions should be declared before the `main()` function or in a header file. Function prototypes must match the implementation exactly.

## 9. Global Variables

Avoid using global variables. They can make your code harder to understand and test. Stick to local variables and pass them as arguments when necessary. And always check if it is allowed to use global variables.

## How to Use Norminette

### 1. Installing Norminette

To use Norminette, you need to install it or use an environment that already has it installed, such as the 42-piscine Docker image.

**On your local machine:** You can follow the 42 school's official documentation to install Norminette.

**Using Docker:** If you prefer, you can use a pre-configured Docker container, which includes Norminette and other 42 tools.

### 2. Running Norminette

Once you've written your code, navigate to your project folder in the terminal and run the following command to check your code:

```bash
norminette
```

This will run the Norminette checker and display any issues with your code.

### 3. Fixing Errors

If Norminette identifies any errors, it will provide you with error messages and suggestions for improvement. Common errors include:

* Incorrect indentation
* Exceeding line length
* Missing or incorrect function prototypes

Once you fix the errors, re-run Norminette to ensure your code is compliant with the style guide.

### 4. Dealing with Warnings

While warnings may not prevent your code from compiling or passing evaluation, it’s important to fix them to maintain good coding habits and avoid issues later on.

## Norminette in Practice

* **Be Patient:** It’s easy to overlook small details (like extra spaces or missing braces). Norminette helps catch these issues early.
* **Consistency is Key:** The main goal is to be consistent with your style throughout your codebase. Following the rules improves both your skills and your ability to work in teams.
* **Use Tools:** In addition to Norminette, you can use an editor with built-in linting or a plugin that shows real-time feedback on your code’s format.

## Conclusion

Norminette is an essential tool in the 42 curriculum, helping you write clean, consistent, and error-free code. It’s a way to ensure that your work adheres to industry-standard coding practices while preparing you for collaborative development environments.

By following Norminette, you’ll improve the quality of your code, and it will also help you develop better habits for programming in general. So, take the time to familiarize yourself with the rules, run the checker frequently, and fix any issues promptly!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://42-guide.gitbook.io/42-guide/piscine-life/norminette-important.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
