NorMatrix
check some norm for you
install
With Pipy
with pipy
1
pip install normatrix
Now you can use it with python3 -m normatrix in your terminal
2
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;
3
to update it, you just have to run
pip install -U normatrix
4
to uninstall it (sad), run
pip uninstall normatrix
From source
from source
1
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
2
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;
3
to update it, just go where you have cloned normatrix run
git pull
4
to uninstall it (sad) Delete the folder
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, you can now configure what extension file are banned, and what are not,
all you have to do is add --conf when execute normatrix and
put a file .normatrix.json where you execute normatrix
example with nothing banned and no preview (preview = not stable check) check
.normatrix.json
{
"banned": [],
"no-banned": [],
"extension": [],
"no-extension": [],
"enable-preview": false
}
just add inside [] the string of what you want
other explanation with example
other explanation with example
- to no-banne memset (because you can use it)
{
"no-banned": ["memset"]
}
- to banne my_printf (because you dont want to use it)
{
"banned": ["my_printf"]
}
- to no-banne *.o file (because you dont need this warning)
{
"no-extension": [".o"]
}
- to banne *.c file (because you want c fiel banned)
{
"extension": [".c"]
}
- to enable preview check by default
{
"enable-preview": true
}
by default there are somthing like this:
{
"banned": ["printf", "memset", "strcpy", "strcat", "calloc"],
"no-banned": [],
"extension": [".a", ".o", ".so", ".gch", "~", "#", ".d"],
"no-extension": [],
"enable-preview": false
}
this configuration will be added even if you add a .normatrix.json file
and add the --conf.
but if you want to remove *.o, just add it to the no-extension
it will remove it from the default
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
Metadata
Release files for normatrix 0.2.13.post69
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| normatrix-0.2.13.post69.tar.gz | 17.7 kB | Without provenance | Details for normatrix-0.2.13.post69.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| normatrix-0.2.13.post69-py3-none-any.whl | Python 3 | none | any | Details for normatrix-0.2.13.post69-py3-none-any.whl |
Total release size: 42.8 kB
Release files / normatrix-0.2.13.post69.tar.gz
| Download URL | normatrix-0.2.13.post69.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ec253bbb1902074bdc190edc18994d7beb15e4cbd8fee352cab9e37ca0c43c6
|
|
BLAKE2b-256 checksum How to use checksums |
392242f6cc874cb92123a1f07481b5b9fd6d229ff2c9ae152c354e94d7612cee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.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
|
Release files / normatrix-0.2.13.post69-py3-none-any.whl
| Download URL | normatrix-0.2.13.post69-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25227dfece5252af7420226b8fbc5886600d09147e5d962f183a4ce4adf08432
|
|
BLAKE2b-256 checksum How to use checksums |
c94c33561ead9cdc8a93b319e12a83fcfc07cac73668be009c4fa981d6224fba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.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
|
Security for normatrix 0.2.13.post69
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.