Uniswap / Uniswap/interface

Consider adding `danger` to repo for hygiene

Open
#3,184 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

example config:

import { danger, markdown, message, warn } from 'danger'

// Other ideas:
//  - verify TODO have work items linked

/* Keep Lockfile up to date  */
// TODO: CI job to run `yarn install` and confirm no changes
const packageChanged = danger.git.modified_files.includes('package.json')
const lockfileChanged = danger.git.modified_files.includes('yarn.lock')
if (packageChanged && !lockfileChanged) {
  const msg = 'Changes were made to package.json, but not to yarn.lock'
  const idea = 'Perhaps you need to run `yarn install`?'
  warn(`${msg} - <i>${idea}</i>`)
}

// More tests
const modifiedAppFiles = danger.git.modified_files.filter(
  (f) =>
    f.includes('src/') &&
    (f.endsWith('.ts') || f.endsWith('.js') || f.endsWith('.tsx') || f.endsWith('.jsx'))
)
/* Encourage more testing */
const hasAppChanges = modifiedAppFiles.length > 0
const testChanges = modifiedAppFiles.filter((filepath) => filepath.includes('.test.'))
const hasTestChanges = testChanges.length > 0

// Warn if there are library changes, but not tests
if (hasAppChanges && !hasTestChanges) {
  warn(
    "There are ts changes, but not tests."
  )
}

// Warn when there is a big PR
const bigPRThreshold = 500
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
  warn(':exclamation: Big PR')
  markdown(
    '> Pull Request size seems relatively large. If PR contains multiple changes, split each into separate PR will helps faster, easier review.'
  )
}

// No PR is too small to warrant a paragraph or two of summary
if (danger.github.pr.body.length === 0) {
  warn('There is no PR description. Get faster and better reviews by explaining what changed.')
}

// Congratulate when code was deleted
if (danger.github.pr.additions < danger.github.pr.deletions) {
  message(
    `✂️ Thanks for removing  ${danger.github.pr.deletions - danger.github.pr.additions} lines!`
  )
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the repository's existing CI and pull-request workflow, then compare it with the example checks for package.json, yarn.lock, src files, tests, and pull-request size or descriptions. Done means the selected Danger checks run for pull requests and report the intended hygiene warnings without blocking unrelated work.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.