Git Product home page Git Product logo

styleguide-hooks's Introduction

styleguide-hooks

MENU

Dependencies

  • sh
  • python 3.6+

How to use the hooks

1. Clone this repo

git clone [email protected]:pdffiller/styleguide-hooks.git

2. Setup it as your template directory

git config --global init.templatedir $(pwd)/styleguide-hooks

You may ignore the remainder nevertheless it's better to follow the next steps in order to avoid running git init each time the 'global' hooks are changed or updated.

3. Create symlink to hooks

git config --global core.hooksPath $(pwd)/styleguide-hooks/hooks

Via post-checkout hook you create/recreate the symlink to your hooks directory after every git clone of git checkout. Documentation.

4. Make it always up-to-date

TODO: You can add to cron and setup post-update hook.

Style guide

Each feature, bug fix or any other change must be developed in a separate branch.

Commit message format

1. Every commit message MUST start with a capitalized verb in its base form

Example:

Add
Delete
Change
Fix
Update
Correct
Test
...

The only exception allowed is Initial commit

Reasons:

  • Has advantages with automatic code-review
  • Makes reading easier
  • Reduces the number of characters in the commit message (for example, Add versus Was added or Has been added)
  • Matches the format accepted by git itself

When making a commit message, just mentally add a phrase in front of it "When this commit is applied the git will ..." and your commit message should logically continue this phrase.

For example:
<span style="color:green">When this commit is applied the git will</span><span style="color:red">Add README.md</span>

2. Punctuation marks are omitted at the end

Example:
Add new feature instead of Add new feature.)

3. Length of the commit message should not exceed 50 characters

It's git recommendation and soft limit, 50+ characters can be truncated when displayed.
Hard limit - 72 characters.

Branch naming format

Used pattern: issue_type / [path_to_folder /] [Jira issue ID /| GitHub issue # /] short_description

  • short_description: a short phrase reflecting the essence of the changes, with a separator _
  • Jira issue ID: project name and issue number with a hyphen
  • GitHub issue: short numeric number of a specific issue previously created in this repository

Allowed issue_types

  • feature - new functionality
  • improve - improve existing functionality
  • fix - various fixes and fixes
  • test - branch for research, various tests, temporary copy, etc. It is useful, for example, for temporary merging of several branches that are not yet in the master for carrying out integration testing of these branches.
  • docs - everything related to documentation
  • style - fix typos, fix formatting
  • refactor - refactoring application code
  • legacy - in some cases, it may take a long time to parallelly develop several development directions in one repository (for example, we have already switched to the v3 module version, but for some terraform configurations, we need changes in the modules of v2 versions, and they will also need an indefinite long time). Such branches are strictly forbidden to be removed from the repository without the permission of the technical support.

Examples

Making changes to tracked branches

Definitions & basic info

Tracked branch is a branch, changes in which are tracked by any build-configuration of Teamcity or another CI process or tool.

Work branch is a branch that has budded off from any one being tracked to make changes to the code, and after that it will be rebased again with the parent branch.

Making any changes to the tracked branches should take place exclusively through pull request.

<span style="color:red">Direct push to the tracked branch is strictly prohibited!</span>

<span style="color:red">It is strictly not recommended to use any working branches of colleagues on GitHub!</span> Otherwise nobody is able to forcast all the consequences of such usage.

Use only stable, tracked branches on GitHub in your applications!

Before review

Make sure that the working branch does not conflict with the parent branch.

Merging work branch

The corresponding pull request can be merged into the tracked branch only after succesfull review at least one review.

Merge is performed by executing the "rebase and merge" command โ€” a special button at the bottom of the page โ€” from the interface of this pull request in GitHub.

Deleting work branch

Right after the working branch is returned to the church is rebased into the tracked branch - deleted. Branch is to be deleted by the PR assignee who perform the rebase.

Setup protectection for repo

Go to repo Settings.

Options - Data services

If private repo - enable Vulnerability alerts. In public it enable by default.

Enabled Data Services

Options - Merge button

Allow only Rebase

Disable other buttons

Branch - Branch protection rules

WIP check can be found here.

Also, you can enable WIP check protection (or any other) only after create first pull request.

Protection rules

Protection rules can be enforced by enforce_branch_protection.py script.

styleguide-hooks's People

Contributors

maxymvlasov avatar elderlom avatar

Watchers

James Cloos avatar Alex Poliukh 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.