Smart Policy
  • Updated on 02 May 2019
  • 2 minutes to read
  • Contributors
  • Share
  • Dark
    Light

Smart Policy

  • Share
  • Dark
    Light

What is it?

The Smart Policy feature is a pull request gatekeeper that makes sure all developers are aligned within an organization, follow policies, and adhere to specific best practices.

Smart Policy helps to maintain technical excellence, professionalism, and business goals, by preventing common developer errors, such as pushing a private key to remote, or misconfiguration of a commit etc.

Why is it important?

Most development horror stories are base on human errors, like accidentally pushing a private key to remote, using the wrong package version caused discrepancy in production, forget to update the route after changes where made in the back broke your API, or just misconfiguration of commit made it harder to trace back who is responsible for function in your codebase which just crashed.

Those are all are common examples of mistakes made in good faith, but affect your technical excellence and business goals.

How does it work?

We have a set of built-in smart policy rules to choose from, together with the option to choose on which repositories they will be applied:

Select a rule and choose the repositories you wish to apply the rule to.

3x-8b524f0-Screen_Shot_2019-01-16_at_17.11.07.png

The selected rules are checked per each pull request made to the default branch, and verifies if all the rules are applied.

3x-0e28908-31a3c04a-070e-415f-b0cc-a8980bd0f904.png

View the smart policy check status in the conversation and checks section of your GitHub pull request.

3x-d6dda42-2019-01-22_17_42_54-Create_node_modules_by_mashtuba__Pull_Request_8__datree-demo_firefly.png

Who gets it?

Organizations with catalog and smart policy plan

Which integration are supported?

Languages: node.js / ruby / python / c# / java

Git vendors: GitHub

Common questions

Can I set my own custom policy?

🐐 Yes. You can either edit an existing built-in rule or you can create a new rule related to the following categories:

  • Custom commit message - e.g validate all commits messages follow "Angular's commit message convention"
  • Exclude files or dirs - e.g do not include ".env" files in your repositories
  • Mandatory files or dirs - e.g always have a CODEOWNERS files
  • Black / white listing code components - e.g skip ESLint malicious version
  • Docker file properties - e.g. set all docker images to “node:10”
  • Manifest file properties - e.g. verify “package.json” files contain “test coverage” scripts
  • CI/CD file properties - e.g. make sure all the “Jenkins” files contain “security scan” steps

Will it blocks me from merging my pull request?

It depends on your GitHub repository settings, so you can decide if applying to the smart policy will block the user from merging the pull request.
Can every user set a policy?

No. Only users with “Admin” permissions can set policies.


What's Next?

Activate a policy
Was this article helpful?