Skip to content
christophechrPublic

About

some basic script to check the coding style

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

99 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NorMatrix

check some norm for you

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 this char* buf
  • preprocessors indentations (#if.., #endif)
  • multiple statements
  • ...

example if you run it as a github workflow

this is not the latest normatrix but : link (this workflow pass well, but it will not if you copy the code below)

doc

Makefile

USAGE:
	make [-C path/to/NorMatrix] [rule] [VAR=VALUE]
DESCRIPTION:
	check the norm!
ARGS:
	-C path/to/NorMatrix		if you are on another working directory
					than NorMatrix, add this.

	rule				the rule to execute ('all', 'update',
					'up', 'tests_run'). If you dont say
					any rule, it will do the 'all' rule.

	VAR=VALUE			to set a different value for a
					specific var. Allow to change the
					directory to check.
					you will probably do:
					make -C path/NorMatrix PATH_CHECK=$PWD

exec.sh

USAGE:
	./exec.sh
DESCRIPTION:
	call the makefile for the all rule with PATH_CHECK to your current
	working directory
ARGS:
	NO

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: clone NorMatrix
      run: git clone https://github.com/Saverio976/NorMatrix

    - name: NorMatrix
      run: make -C NorMatrix/ PATH_CHECK=$PWD
' > .github/workflows/normatrix_check.yml

run it with an alias

with this, you will can just write normatrix in a shell and it will check the norm for your current working directory

if you are using bash shell:

echo alias normatrix="$PWD/exec.sh" >> $HOME/.bashrc

if you are using zsh shell:

echo alias normatrix="$PWD/exec.sh" >> $HOME/.zshrc

else, handle thsi yourself bruh

Contribute

if you want to add some checkers (in python, bash, or node), add a file in src/ folder with a filename clear enouth.

if the filename is test.sh, the file wiil be executed like this ./src/test.sh {file to check}

If there is one error or more, exit with the number of error, else status code 0. You must print the filename and the line where the error is

[more preicse information on the file : CONTRIBUTING.md]

thanks

chempa for his sample of file that dont follow the epitech norm

About

some basic script to check the coding style

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages