-
Notifications
You must be signed in to change notification settings - Fork 0
Guidelines
Jjampong edited this page Mar 9, 2021
·
16 revisions
- Indentations should use 4 spaces, not tabs.
- There should be 1 empty line between functions.
- Functions may only do 1 action and the neme should represent the action accurately.
- Functions which could be hard to understand at a first glance should include comments (
/* ... */) above them describing their action. - If necessary
.blade.phpfiles may contain comments ({{-- ... --}}) as well. - If possible use Artisan to generate files, instead of making them manually.
- Avoid data manipulation inside
.blade.phpfiles. - For recurring bits of front-end code use Blade's subviews.
- Front-end layout should be defined in Blade's components.
- Use Blade's CSRF protection.
- Avoid raw php inside
.blade.phpfiles. - Do not use html commenting (
<-- ... -->). - If a variable does not change during execution it should be marked as
const. - A variable name should always describe it's value. No ambiguous names such as
$aor$b. Simple variable names are only allowed when used as a counter inside of a loop. - Avoid
globalandstaticvariables. - Bool variable names should always be confirming. Correct example:
$is_avaiable, incorrect:$is_not_available. -
constvariables have to be declared as you would any other variable, do not usedefine(). - Prefer condition-level
returnstatements over root-levelreturnstatements. See example below (Pseudo-code):
public function IsFileReadable(file) {
if(file.exists()){
try {
file.read();
return true;
}
catch(error) {
return false;
}
}
else return false;
}
- Avoid
returnstatements not returning any value. - Do not use
continue. - A comma is always followed by a space.
- Operators are always surrounded by spaces.
- A code block is opened on the same line as it's definition.
- A code block is ended on a separate.
- Lengthy conditions should jump to the next line.
- Function and class names use PascalCase.
- variable names use snake_case.
- private variable names are prepended with an underscore.
-
constvariable names use SCREAMING_SNAKE_CASE. - Files generated with Artisan get named automatically. Do not change these names after generation.
- Files have different case types depending on their purpose, be consistent inside folders.
- For each userstory each user is allowed to make their own branch. The user branch should be directly based on dev and has the following format:
<UserstoryNr>_<User>. - Aside from user branches. Hotfix branches based on dev are also allowed.
- Main is updated once per sprint. (Every 2 weeks)
- 4 reviews are required to merge from dev into main.
- 2 reviews are required from any branch into dev. (Excluding the code owner's review)
- Reviews should come with useful feedback. Not just criticism.
- Use the Code Highlight tool.
- Merge conflicts should be solved by the merge request's owner.
- Draft merge requests don't have to be reviewed. If it is a draft be sure to mark it with the WIP label.
- The merge request owner is responsible for the assigning reviewers.
- Use the issues for bugs, glitches and thrown errors.
- An issue should include how to reproduce the issue.
- An issue should include the expected result and current result.
- If a pull request solves an issue, connect it to the issue.