check epitech c coding style
Project description
NorMatrix
check some norm for you
install
With Pipy
with pipy
pip install normatrix
Now you can use it with python3 -m normatrix
in your terminal
And if you want to just write normatrix
:
echo $SHELL
if you are using bash shell (the echo
print /something/bash
):
echo alias normatrix=\"python3 -m normatrix\" >> $HOME/.bashrc
else if you are using zsh shell (the echo
print /something/like/zsh
):
echo alias normatrix=\"python3 -m normatrix\" >> $HOME/.zshrc
else handle this yourself bruh;
From source
from source
git clone https://github.com/Saverio976/NorMatrix.git
cd NorMatrix
Now you can use it with ./path/to/folder/NorMatrix/main.py
in your terminal
And if you want to just write normatrix
:
echo $SHELL
if you are using bash shell (the echo
print /something/bash
):
echo alias normatrix=\"$PWD/main.py\" >> $HOME/.bashrc
else if you are using zsh shell (the echo
print /something/like/zsh
):
echo alias normatrix=\"$PWD/main.py\" >> $HOME/.zshrc
else handle this yourself bruh;
Current Checks
- 80 cols per line
- space/tab alone (in a line)/(at the end of line)
- two newline at end of file
- two newline between function (between all buf chhhtt)
- libc function call (pr welcome to add some libc function always banned)
- nested branch more than 3 branch
- no more than 20 lines per function
- comma with no space after
- end of parenthesis with a open curly bracket next
){
- star char
*
like thischar* buf
- preprocessors indentations (
#if..
,#endif
) - multiple statements
- 5 functions per file
- filename of source code only snake_case
- no line break at end of file
- 5+5 7/9 that need a space (but some false positiv goes in)
- no space after [ and space before ]
- header
- #define in .c
- make + check exe if the compiler add some banned function
- ...
doc
(if you use pipy) python -m normatrix
(if you use pipy) python -m normatrix
usage: python -m normatrix [-h] [--no-operators-pluggin] [--preview] [--conf] [paths ...]
The C Epitech Coding Style Norm Checker
positional arguments:
paths list of path to check (default: the current working directory)
options:
-h, --help show this help message and exit
--no-operators-pluggin
remove the operators pluggin (because it print some false positiv for now)
--preview add some plugin that are added recently
--conf tells if you have a .normatrix config file
source: https://github.com/Saverio976/NorMatrix
(only from source) main.py
(only from source) main.py
usage: python -m normatrix [-h] [--no-operators-pluggin] [--preview] [--conf] [paths ...]
The C Epitech Coding Style Norm Checker
positional arguments:
paths list of path to check (default: the current working directory)
options:
-h, --help show this help message and exit
--no-operators-pluggin
remove the operators pluggin (because it print some false positiv for now)
--preview add some plugin that are added recently
--conf tells if you have a .normatrix config file
source: https://github.com/Saverio976/NorMatrix
(only from source) exec.sh
(only from source) exec.sh
(this file exists only to keep compatibility to older version)
usage: python -m normatrix [-h] [--no-operators-pluggin] [--preview] [--conf] [paths ...]
The C Epitech Coding Style Norm Checker
positional arguments:
paths list of path to check (default: the current working directory)
options:
-h, --help show this help message and exit
--no-operators-pluggin
remove the operators pluggin (because it print some false positiv for now)
--preview add some plugin that are added recently
--conf tells if you have a .normatrix config file
source: https://github.com/Saverio976/NorMatrix
(only from source) Makefile
(only from source) Makefile
(this file exists only to keep compatibility to older version) (if you can, move to another choice)
USAGE:
make -C path/to/NorMatrix PATH_CHECK=$PWD
DESCRIPTION:
check the norm! in the current working directory
(call main.py)
ARGS:
-C path/to/NorMatrix run the makefile that is in path/to/NorMatrix
instead of the one where you are
PATH_CHECK=$PWD check the norm in your current working
directory
configuration
you can now configure what functions are banned, and what are not,
or add some file extension that not be present when you do a normatrix.
all you have to do is add --conf
when execute normatrix and
put a file .normatrix.json
where is the folder that
you want to check with this:
.normatrix.json
{
"banned": [],
"no-banned": [],
"no-extension": []
"enable-preview": true
}
just add inside []
string of what you want
for example to no-banned memset (because you can use it)
{
"no-banned": ["memset"]
}
by default (and default configuration will be load before yours) there are somthing like this:
{
"banned": ["printf", "memset", "strcpy", "strcat", "calloc"],
"no-banned": [],
"no-extension": [".a", ".o", ".so", ".gch", "~", "#", ".d"]
"enable-preview": false
}
example if you run it as a github workflow
this is not the latest normatrix but :
link : link
(N.B. : this workflow pass well, but it will not if you copy the code below)
run it as a github workflow
in the repo root :
mkdir .github
mkdir .github/workflows
echo '
name: NorMatrix Check
on: [push]
jobs:
norm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: clone NorMatrix
run: git clone https://github.com/Saverio976/NorMatrix.git
- name: NorMatrix
run: ./NorMatrix/main.py
' > .github/workflows/normatrix_check.yml
Contribute
[more information on CONTRIBUTNG.md]
special thanks
- chempa for his sample of file that dont follow the epitech norm
- and invisble testers that says "bha baah normatrix have a bug"
contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file normatrix-0.2.12.tar.gz
.
File metadata
- Download URL: normatrix-0.2.12.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd72e58345c156362ec25cda3fca80e78994d7056bc5924357d1e1d297c4087 |
|
MD5 | b92484c7c2e91aa5c2591413dda86438 |
|
BLAKE2b-256 | 8f65298cb307fb5b91e65042b7a3807e8634606fdd02d71d4c9daed4c33cef4b |
Provenance
File details
Details for the file normatrix-0.2.12-py3-none-any.whl
.
File metadata
- Download URL: normatrix-0.2.12-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ac892a9bd399dbf03c7b2ddee1798f48db303f301fc365bf48d88f1eea4f46b |
|
MD5 | 3e968d86da7b13f711d92cd8800e6dbb |
|
BLAKE2b-256 | 7dc2c645560724d58eb55f1971de6f339eab2713e4d3e3c967717fa463e3c07c |