Guest User

Untitled

a guest
May 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. # Sometimes it's a README fix, or something like that - which isn't relevant for
  2. # including in a project's CHANGELOG for example
  3. declared_trivial = github.pr_title.include? '#trivial'
  4. wip = github.pr_title.include? '[WIP]'
  5. added_and_modified_files = git.added_files + git.modified_files
  6.  
  7. warn('Big PR') if git.lines_of_code > 500
  8.  
  9. fail("PR not ready for review yet.") if wip
  10.  
  11. fail('Python debugger left in code', :sticky => true) if `egrep -r 'import i*pdb|pdb.set_trace' reply_nlu/`.length > 1
  12.  
  13. # Inline comment PEP8 errors
  14. if added_and_modified_files.include?('*.py')
  15. pep8.base_dir = 'reply_nlu'
  16. pep8.config_file = 'setup.cfg'
  17. pep8.lint use_inline_comments: true
  18. end
  19.  
  20. # Warn about new todos added to the code
  21. todoist.warn_for_todos
  22.  
  23. # Ensure no merge commits
  24. if git.commits.any? { |c| c.message =~ /^Merge branch/ }
  25. fail('Please rebase to get rid of the merge commits in this PR')
  26. end
  27.  
  28. # Highlight api update if any change include view or serializers files
  29. view_changes = added_and_modified_files.include?("*views*")
  30. serializer_changes = added_and_modified_files.include?("*serializers*")
  31. apidoc_changes = added_and_modified_files.include?("*apidoc.md*")
  32. postman_changes = added_and_modified_files.include?("*postman-collection.json*")
  33. if (view_changes or serializer_changes) and not (apidoc_changes and postman_changes)
  34. warn('You make changes to the API without editing the documentation/postman collection.')
  35. end
  36.  
  37. # Ensure entry in changelog if PR is not trivial
  38. if !added_and_modified_files.include?("CHANGELOG.md") && !declared_trivial
  39. fail("Please include a CHANGELOG entry.", sticky: false)
  40. end
  41.  
  42. # Analyse only the PR Diff
  43. github.dismiss_out_of_range_messages
Add Comment
Please, Sign In to add comment