Skip to main content

format input file(s) to 42 norm automatically

Project description


42 ".c" Code Formatter

This tool automatically formats your C code to comply with the 42 norm.

Installation

To install the package, you can use either of the following methods:

With pip:

pip install 42formatter

Or with pipx (recommended for isolated environments):

pipx install 42formatter

Why pipx?

pipx is recommended if you want to install the tool in an isolated environment, avoiding conflicts with other Python packages.

How to Use

Run the following command to format your C file(s):

x42format <input_file(s)>

Features

  • Skip 42 header or Alert you if it's missing/invalid
  • Replace " " (4 spaces) by " " TAB
  • Fix variable declaration format
  • Put space after flow control keywork -> "while(" becomes "while (" | "break;" becomes "break ;"
  • Fix missing ";" at end of lines that needs one
  • Fix strange spaces before and after pointer -> "type * var" -> "type\t*var"
  • Fix merged spaces and tabs -> " \t " -> "\t"
  • Fix spaces around operators -> "1+1" -> "1 + 1"
  • Remove useless empty lines
  • Fix function declaration format
  • Fix newline after closing brace : "}"
  • Fix strange spaces around type casting

License

This project is under a Proprietary License.
All rights are reserved. The project remains the property of Antoine Josse.
Any modifications or contributions to the project require prior permission from the author (contact at ajosse@student.42.fr).
Redistribution under a different name is not allowed.
The project must always be attributed to the original author.

Contributing

If you have any suggestions for improvements, feel free to contact me at ajosse@student.42.fr.


This tool is here to save you time while battling with Norminette.

Antoine :)


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

42formatter-0.1.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

42formatter-0.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file 42formatter-0.1.1.tar.gz.

File metadata

  • Download URL: 42formatter-0.1.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for 42formatter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2f34825a24bdec67aab95bff52f46a06fbae4a7493e53d5b8baba213ab2827d
MD5 dc10fbb81e6ec4782f0245a2a8fcc49f
BLAKE2b-256 1406be3589f6e868d5a7f2d33b208018f5e2764e6d87ed044223c0cd47c8ddd7

See more details on using hashes here.

File details

Details for the file 42formatter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: 42formatter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for 42formatter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 77ed9f1c3b0df3a7fa6b54684ea51fe4b87baecf2bf5085052692062c5bf89b1
MD5 4e9923e45137a7d3cc6eacb438e344f5
BLAKE2b-256 c60c4bb835b40545a652b2ed5f0d23d7ab1bead1a1fe466406e85ad6540840b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page