Minor tweaks to the rules.

Mat. B 2020-04-25 22:26:02 -05:00
parent c05a93e306
commit d2e034defe
1 changed files with 11 additions and 9 deletions

@ -1,10 +1,11 @@
These are the code style guidelines that should be followed when contributing to fluxion. These are the code style guidelines that should be followed when contributing to fluxion.
## Indentation ## Indentation
_Indent = two tabs Due to the fact the tab length may vary between systems and users, use **two spaces** instead of real tabs.
<br> * No hard tabs (\t)
<br> * Not four spaces
Not hard tabs. Not four spaces. Not however many spaces you feel like. **2 tabs.** * Not however many spaces you feel like
* **Two spaces** ( )
## Line Length ## Line Length
Be reasonable. Keeping within 80 characters is recommended, 120 is the **maximum**. Be reasonable. Keeping within 80 characters is recommended, 120 is the **maximum**.
@ -21,19 +22,17 @@ This function is prefixed with "fluxion" to signify it belongs to the fluxion sc
## Variables ## Variables
* Limit the scope of variables to local if within a function. * Limit the scope of variables to local if within a function.
* Wrap your variables in ${curly} ${braces} for clarity.
* Use existing variables whenever possible to avoid pollution. * Use existing variables whenever possible to avoid pollution.
* Identify variables using **camel-case**. * Identify variables using **camel-case**.
* Prefix identifiers with the **capitalized** script name defining them. * Prefix identifiers with the **capitalized** script name defining them.
For example, the global "FluxionLanguage" For example, the global "CaptivePortalHashPath"
This global is prefixed with "Fluxion" to signify it belongs to the fluxion script. Using camel-case makes it clear it's not a subroutine. This global is prefixed with "CaptivePortal" to signify it belongs to the captive portal attack script. Using camel-case makes it clear it's not a subroutine, which use **snake-case**.
## Constants ## Constants
* Limit the scope of constants to local if within a function. * Limit the scope of constants to local if within a function.
* Wrap your constants in ${curly} ${braces} for clarity.
* Use existing constants whenever possible to avoid pollution. * Use existing constants whenever possible to avoid pollution.
* Identify constants using **camel-case**. * Identify constants using **camel-case**.
* Prefix identifiers with the **uppercased** script name defining them. * Prefix identifiers with the **uppercased** script name defining them.
@ -54,6 +53,9 @@ $(whoami)
``` ```
${USER} ${USER}
${PWD} ${PWD}
$USER
$PWD
``` ```
## Flow Logic ## Flow Logic
@ -81,7 +83,7 @@ foo() {
print 'bar' print 'bar'
} }
``` ```
NOTE: There are some exceptions but in general use POSIX. NOTE: There are some exceptions but in general use POSIX standards.
## Misc ## Misc
Do NOT use backticks (\`command\`) to execute something in a subshell. Do NOT use backticks (\`command\`) to execute something in a subshell.