Joana Silva
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Code Development Guidelines ## **Commit Guidelines:** * Commit messages are forced to have one of the following tags inside brackets: * FIX * FEATURE * ENHANCE * TEST * DOC * REFACTOR * PERFORMANCE * SETUP * MERGE <br> Then, are followed by a space and finally, the commit message. This is possible using the regex: `/^[(FIX|FEATURE|ENHANCE|TEST|DOC|REFACTOR|PERFORMANCE|SETUP|MERGE)] .+/` e.g., `[FIX] This is a 'fix' commit message` **(Enforced by Gitlab)** * Commit subject lines must be in the imperative mood, precise and illustrative. - e.g.,` [FEATURE] Add navbar to user's page` * Never commit directly to master **(Enforced by Gitlab)** * Branch names should match `(feature|test|setup|fix|enhance|refactor).+ `— the name should start with either feature, test, setup, fix, enhance or refactor and then contain a descriptive name of the issue in hands — e.g., `feature/seeMedicalRecords` **(Enforced by Gitlab)** ## **Merging Guidelines** * Procedure to do before a MR: * Checkout to master, `git checkout master`, and pull to have all of the changes made; * Change to working branch; * Do command `git rebase master`, this brings to the branch, the master commits that are ahead of the branch (due to other MR that have been accepted); * Fix possible conflicts one by one and do `git rebase --continue` to move on to the next commit; * Add files that have been fixed using `git add <file>`; * After all is clean do `git push --force-with-lease`. <br> * A Merge Request (MR) must be approved by 2 people **(Enforced by Gitlab)** * Merge Requests with UI need to contain screenshots ## **Structure Guidelines** * **React components** must be structured in the following way: ```bash ├──components/ | ├──ComponentA/ | | ├──ComponentA.js | | ├──ComponentA.css | | | ├──ComponentB/ | ├──ComponentB.js | ├──ComponentB.css | ├──pages/ | ├──component-a.js | ├──component-b.js | ├──tests/ ├──ComponentA.test.js ├──ComponentB.test.js ``` * Component’s file name should be in Pascal Case- eg,. `EditButton` * All components must be inside of the components directory * The name of a component must be equal to the name of the component folder * The filename for the Page Component must be in lowercase and each word separated by a hyphen- eg,. `edit-button` * Keep components shallow so that there are better chances for reusing them * **Backend components** must be structured in the following way: ```bash ├──api/ | ├──middleware/ | ├──validator/ | | ├──validatorA.js | | ├──validatorB.js | ├──routes/ ├──routes/ | ├──routeA.js | ├──routeB.js | ├──controllers/ | ├──controllerA.js | ├──controllerB.js | ├──models/ ├──modelA.js ├──modelB.js ``` * All validators must be inside of the validators directory * All routes must be inside of the routes directory * All controllers must be inside of the controllers directory * All models must be inside of the models directory * The filename for the models must be in lowercase * All controllers, routes and validators related to a model should have the same filename as the model. ## **Linting** A linter is a tool that checks and analyzes code in order to report programming and stylistic errors, bugs and suspicious constructs. The goal of a linter is to make code more consistent and help to avoid bugs, making it easier to review. * **ESLint:** Use ESLint, a linter tool for ECMAScript/JavaScript code. To setup ESLint with VSCode install ESLint extension and on the main directory of the project do: `cd backend` `npm install` `cd ../frontend` `npm install` * **Prettier:** Use to maintain consistency in the codebase. ## **Testing** React components are tested using Enzyme integrated with Jest. Each test must be inside of the tests directory of the frontend folder. To run the tests use the command `npm run test`. Backend testing is done using SuperTest integrated with Jest. Each test must be insife of the test directory of backend. ## **CI/CD** The CI is currently divided into 5 stages: **security**, **test**, **quality**, **build** and **deploy**. * **Security** runs a static analysis and dependency scan. It will eventually be departed from the pipeline into a scheduled job and it will only run automatically for merge requests to assure that the master remains safe. The goal is to keep the CI cost as low as possible. * The **test** stage runs a script for the backend and one for the frontend. These scripts ensure the linting of the code and runs the tests via docker compose. * The **build** and **deploy** stages assure the maintenance of staging and deployment of the application to a public host. * A merge can only be accepted if the pipeline succeeds. **(Enforced by Gitlab)** ## **Branching Strategy** * `master` is the default branch; * `feature`, `fix`, `test`, `setup` and`refactor` branch from `master`; * Merge requests trigger `security`, `test`, `quality` and `deploy` jobs; * If CI has successfully ran and the merge as been approved during the review, the MR can be merged into `master`;

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully