Skip to content

Instantly share code, notes, and snippets.

@Sigmanificient
Last active May 1, 2024 12:15
Show Gist options
  • Save Sigmanificient/6ef147920ad057ef6bcd9b057f81d83d to your computer and use it in GitHub Desktop.
Save Sigmanificient/6ef147920ad057ef6bcd9b057f81d83d to your computer and use it in GitHub Desktop.
Epitech Coding Style Checker on Arch GNU/Linux

Running the coding style on Arch

In order to run the Epitech coding style checker natively, you will need to compile the vera binary.

I. Clone the vera-banana repo from Epitech

The repo is private, but you can access it using your ssh key

git clone git@github.com:Epitech/banana-vera.git
cd banana-vera

II. Install the dependencies

Use yay or your favourite AUR helper

yay -Sy tcl cmake python3

III. Configure cmake for vera

cmake . -DVERA_LUA=OFF -DPANDOC=OFF -DVERA_USE_SYSTEM_BOOST=ON

IV. Compile the binary

Note: -j allow to compile using all cpu cores

make -j

V. Install the command system-wide

sudo make install

VI. Create a file named cs in your ~/scripts folder.

# Running the coding style on Arch

In order to run the Epitech coding style checker natively,
you will need to compile the `vera` binary.

<kbd>I.</kbd> Clone the vera-banana repo from Epitech

> *The repo is private, but you can access it using your ssh key*
```shell
git clone git@github.com:Epitech/banana-vera.git
cd banana-vera

II. Install the dependencies

Use yay or your favourite AUR helper

yay -Sy tcl cmake python3

III. Configure cmake for vera

cmake . -DVERA_LUA=OFF -DPANDOC=OFF -DVERA_USE_SYSTEM_BOOST=ON

IV. Compile the binary

Note: -j allow to compile using all cpu cores

make -j

V. Install the command system-wide

sudo make install

VI. Create a file named cs in your ~/scripts folder.

#!/usr/bin/env bash

ruleset_dir="$HOME/scripts/banana-coding-style-checker/vera"

start_time=$(date +%s)
if [ -z "$1" ]; then
  project_dir=$(pwd)
else
  project_dir="$1"
fi
echo "Running norm in $project_dir"

count=$(find "$project_dir"       \
    -type f                       \
    -not -path "*/.git/*"         \
    -not -path "*/.idea/*"        \
    -not -path "*/.vscode/*"      \
    -not -path "bonus/*"          \
    -not -path "tests/*"          \
    -not -path "/*build/*"        \
    -not -path "\#*\#"            \
    -not -path "*\~"              \
    | vera++                      \
    --profile epitech             \
    --root $ruleset_dir           \
    --error                       \
    2>&1                          \
    | sed "s|$project_dir/||"     \
    | tee /dev/tty | wc -l
)

end_time=$(date +%s)

echo "Found $count issues"
echo "Ran in $((end_time - start_time))s"

if [ $count -gt 0 ]; then
  exit 1
fi
exit 0

VII. Retrieve the rules

Clone the banana-coding-style-checkerrule into your ~/scripts

git clone git@github.com:Epitech/banana-coding-style-checker.git 

VIII. Make the cs executable

chmod +x cs

IX. Add the script folder in the path

editing your .bashrc, .profile or .zshrc accordingly, add the following line at the end

export PATH="$PATH:$HOME/scripts"

X. Run it!


<kbd>VII.</kbd> Retrieve the rules

Clone the `banana-coding-style-checker`rule into your `~/scripts`

```shell
git clone git@github.com:Epitech/banana-coding-style-checker.git 

VIII. Make the cs executable

chmod +x cs

IX. Add the script folder in the path

editing your .bashrc, .profile or .zshrc accordingly, add the following line at the end

export PATH="$PATH:$HOME/scripts"

X. Run it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment