Coder Social home page Coder Social logo

guidelines's Introduction

General guidelines for Hyperextended

Contributing

Conventional commits

The use of conventional commits is strongly encouraged when contributing to any ox or hx resources, they provide a very clear structure for commit titles that assist in organisation and auto-generation of release notes.

The basic structure is as follows: <type>[optional scope]: <description>

E.g. feat(client/shops): support for shop peds chore: bump manifest version to v2.22.4

Commit types

  • feat Commits that add a new feature
  • fix Commits that fix a bug
  • refactor Commits that rewrite/restructure your code
  • perf Commits are special refactor commits, that improve performance
  • style Commits that do not affect the code execution (white-space, formatting, missing semi-colons, etc)
  • tweak Commits that make small subjective adjustments e.g. changing a colour or wait length
  • chore Miscellaneous commits e.g. bumping version, removing unused code

Scope

Scope is optional, however, it should be included if possible. More than 2 levels deep should be avoided in most cases.

Description

Should be informative and to the point, not more than a few words. Additional detail is always welcome and should be added to the comment of the commit.

Pull requests

Features, refactors and major fixes should first committed to a separate branch or fork before being merged into main. This allows for code review and reduces the number of bugs that make it to main. Small fixes like typos can be committed directly after a sanity check or two.

Code style

Project Error's repo on this subject is a great starting point (fivem-lua-style)

Code Spacing

Space code out appropriately - separate variable definitions, if statements and loops with a new line if they are at the same indentation level. A few lines can make a remarkable difference to readability.

-- Bad
lib.callback.register('environment:getInvitees', function(source, groupName)
    local player = Ox.GetPlayer(source)
    local group = GlobalState[('group.%s'):format(groupName)]
    if not player.hasGroup(group.name, group.adminGrade) then return false end
    local invitees = {}
    local playerPos = player.getCoords()
    local players = Ox.GetPlayers()
    local len = #players
    for i = 1, len do
        local nearbyPlayer = players[i]
        if nearbyPlayer.source ~= player.source and not nearbyPlayer.hasGroup(group.name) and #(nearbyPlayer.getCoords() - playerPos) < 10 then
            invitees[#invitees + 1] = {
                name = nearbyPlayer.name,
                id = nearbyPlayer.source
            }
        end
    end
    return invitees
end)

-- Good
lib.callback.register('environment:getInvitees', function(source, groupName)
    local player = Ox.GetPlayer(source)
    local group = GlobalState[('group.%s'):format(groupName)]

    if not player.hasGroup(group.name, group.adminGrade) then return false end

    local invitees = {}
    local playerPos = player.getCoords()
    local players = Ox.GetPlayers()
    local len = #players

    for i = 1, len do
        local nearbyPlayer = players[i]

        if nearbyPlayer.source ~= player.source and not nearbyPlayer.hasGroup(group.name) and #(nearbyPlayer.getCoords() - playerPos) < 10 then
            invitees[#invitees + 1] = {
                name = nearbyPlayer.name,
                id = nearbyPlayer.source
            }
        end
    end

    return invitees
end)

guidelines's People

Contributors

dokadoka avatar

Stargazers

Nitipoom Aumpitak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.