From c0a26126763c80e6259445d8359b4e616c0d5903 Mon Sep 17 00:00:00 2001 From: Xorima Bot Date: Sun, 24 May 2020 17:29:23 +0000 Subject: [PATCH] Standardise files with files in sous-chefs/repo-management Signed-off-by: Xorima Bot --- .circleci/config.yml | 10 ++++++++++ .github/lock.yml | 8 ++++++++ .overcommit.yml | 20 +++++++++++++++++++ Dangerfile | 47 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .github/lock.yml create mode 100644 .overcommit.yml create mode 100644 Dangerfile diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..8af810e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,10 @@ +--- +version: 2.1 +orbs: + kitchen: sous-chefs/kitchen@2 +workflows: + danger: + jobs: + - kitchen/danger: + name: danger + context: Danger-Minimal diff --git a/.github/lock.yml b/.github/lock.yml new file mode 100644 index 0000000..8344a7b --- /dev/null +++ b/.github/lock.yml @@ -0,0 +1,8 @@ +--- +daysUntilLock: 365 +exemptLabels: [] +lockLabel: false +lockComment: > + This thread has been automatically locked since there has not been + any recent activity after it was closed. Please open a new issue for + related bugs. diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..1d27ed8 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,20 @@ +--- +PreCommit: + TrailingWhitespace: + enabled: true + YamlLint: + enabled: true + Rspec: + enabled: true + required_executable: 'rspec' + Cookstyle: + enabled: true + required_executable: 'cookstyle' + command: ["cookstyle"] + Delivery: + enabled: true + required_executable: 'delivery' + flags: ['local', 'all'] +CommitMsg: + HardTabs: + enabled: true diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 0000000..bc08b7a --- /dev/null +++ b/Dangerfile @@ -0,0 +1,47 @@ +# Reference: http://danger.systems/reference.html + +# A pull request summary is required. Add a description of the pull request purpose. +# Changelog must be updated for each pull request that changes code. +# Warnings will be issued for: +# Pull request with more than 400 lines of code changed +# Pull reqest that change more than 5 lines without test changes +# Failures will be issued for: +# Pull request without summary +# Pull requests with code changes without changelog entry + +def code_changes? + code = %w(libraries attributes recipes resources files templates) + code.each do |location| + return true unless git.modified_files.grep(/#{location}/).empty? + end + false +end + +def test_changes? + tests = %w(spec test kitchen.yml kitchen.dokken.yml) + tests.each do |location| + return true unless git.modified_files.grep(/#{location}/).empty? + end + false +end + +failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10 + +warn 'This is a big Pull Request.' if git.lines_of_code > 400 + +warn 'This is a Table Flip.' if git.lines_of_code > 2000 + +# Require a CHANGELOG entry for non-test changes. +if !git.modified_files.include?('CHANGELOG.md') && code_changes? + failure 'Please include a CHANGELOG entry.' +end + +# Require Major Minor Patch version labels +unless github.pr_labels.grep /minor|major|patch/i + warn 'Please add a release label to this pull request' +end + +# A sanity check for tests. +if git.lines_of_code > 5 && code_changes? && !test_changes? + warn 'This Pull Request is probably missing tests.' +end -- GitLab