Skip to content

Commit 0dadd3e

Browse files
ci: add dependabot grouping and conventional commit instructions (microsoft#731)
1 parent 8530d52 commit 0dadd3e

File tree

3 files changed

+133
-0
lines changed

3 files changed

+133
-0
lines changed

.github/copilot-instructions.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,100 @@ go generate ./...
227227
4. Add tests for new functionality
228228
5. Keep commits focused and well-described
229229

230+
## Commit Message Format
231+
232+
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automated version management and changelog generation via [Release Please](https://github.com/googleapis/release-please).
233+
234+
### Required Format
235+
236+
**ALWAYS** use conventional commit format for PR titles and commit messages:
237+
238+
```
239+
<type>: <description>
240+
241+
[optional body]
242+
243+
[optional footer]
244+
```
245+
246+
### Commit Types and Version Bumps
247+
248+
| Type | Version Bump | When to Use | Example |
249+
|------|-------------|-------------|---------|
250+
| `feat:` | Minor (X.Y.0) | New features or functionality | `feat: add support for SQL Server 2025` |
251+
| `fix:` | Patch (X.Y.Z) | Bug fixes | `fix: resolve timeout issue in query parsing` |
252+
| `feat!:` or `BREAKING CHANGE:` | Major (X.0.0) | Breaking changes | `feat!: change CLI flag behavior` |
253+
| `docs:` | No bump | Documentation only changes | `docs: update README with examples` |
254+
| `chore:` | No bump | Maintenance tasks | `chore: update dependencies` |
255+
| `deps:` | No bump | Dependency updates | `deps: bump go-mssqldb to v1.10.0` |
256+
| `ci:` | No bump | CI/CD changes | `ci: update GitHub Actions workflow` |
257+
| `test:` | No bump | Test additions or fixes | `test: add coverage for edge cases` |
258+
| `refactor:` | No bump | Code refactoring without behavior change | `refactor: simplify command parsing` |
259+
| `perf:` | Patch (X.Y.Z) | Performance improvements | `perf: optimize batch processing` |
260+
261+
### Examples
262+
263+
Good commit messages:
264+
```
265+
feat: add --server-name flag for tunneled connections
266+
fix: help flags preprocessing for -h and -help
267+
deps: bump go-mssqldb to v1.9.8
268+
ci: add release-please workflow
269+
```
270+
271+
Bad commit messages:
272+
```
273+
Update README
274+
Bug fix
275+
Added new feature
276+
Bump go directive to go 1.25.9
277+
```
278+
279+
## Code Quality Standards
280+
281+
- **Simplicity first**: Make every change as simple as possible. Minimal code impact. Maximum modularity.
282+
- **No laziness**: Find root causes. No temporary fixes. Senior developer standards.
283+
- **Minimal impact**: Changes should only touch what's necessary. Avoid introducing bugs.
284+
- **Write code for the maintenance programmer**: Write clear, concise code that is easy to read and understand.
285+
286+
### No AI Slop
287+
288+
Applies to all output: code, tests, docstrings, comments, PR descriptions, commit messages.
289+
290+
**Prose and comments:**
291+
- No filler phrases: "This ensures that...", "In order to...", "It's worth noting..."
292+
- No over-commenting obvious code (comments that restate what the code does)
293+
- No bloated docstrings with "Validates:" bullet lists or "Note:" paragraphs
294+
- No redundant inner docstrings on helpers inside tests
295+
296+
**Code:**
297+
- No redundant logic (e.g., `strings.ToLower()` inside `strings.EqualFold()`)
298+
- No duplicate validation (checking the same condition twice)
299+
- No excessive blank lines or formatting
300+
- No stale examples in docstrings that don't match the actual API
301+
302+
## Pre-Push Checklist
303+
304+
Before `git push`, always run the repo-specific checks. Default:
305+
306+
- `git fetch upstream && git rebase upstream/main` (avoid "out-of-date with base branch")
307+
- **Review your own diff** (`git diff upstream/main`) -- check for AI slop, stale docstrings, weak assertions, anti-patterns. Read every changed line as a reviewer, not the author.
308+
- Build
309+
- Run full test suite
310+
- Run linter
311+
312+
If repo has `.github/copilot-instructions.md`, follow its build/test/lint instructions instead.
313+
314+
**Rule**: Review means reading every changed line as a hostile reviewer, not the author. For each addition, ask: (1) Is this used? grep for it. (2) Is this consistent with parallel code? Check sibling maps/lists. (3) Does the docstring match the code? Compare them line by line. (4) Would a senior engineer flag this? If you can't articulate why each line is correct, you haven't reviewed it.
315+
316+
**Tests:**
317+
- DAMP over DRY: tests should be Descriptive And Meaningful Phrases, each readable top-to-bottom as a self-contained story
318+
- Test behavior, not implementation
319+
- Assertions must match claims: if the test says "all types", check all of them
320+
- Cover what motivated the fix: the case that caused the bug is the most important assertion
321+
322+
When in doubt: would a senior engineer roll their eyes at this?
323+
230324
## Common Tasks
231325

232326
### Adding a New Command (Modern CLI)

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ updates:
2121
commit-message:
2222
prefix: "deps"
2323
include: "scope"
24+
groups:
25+
go-dependencies:
26+
patterns:
27+
- "*"
2428

2529
# Enable version updates for GitHub Actions
2630
- package-ecosystem: "github-actions"
@@ -34,3 +38,7 @@ updates:
3438
- "github-actions"
3539
commit-message:
3640
prefix: "ci"
41+
groups:
42+
github-actions:
43+
patterns:
44+
- "*"

.github/workflows/pr-title.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PR Title Check
2+
on:
3+
pull_request_target:
4+
types: [opened, edited, synchronize]
5+
6+
permissions:
7+
pull-requests: read
8+
9+
jobs:
10+
validate:
11+
name: Validate PR title
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
with:
18+
types: |
19+
feat
20+
fix
21+
docs
22+
chore
23+
deps
24+
ci
25+
test
26+
refactor
27+
perf
28+
build
29+
requireScope: false
30+
subjectPattern: ^[a-z].+$
31+
subjectPatternError: "Subject must start with a lowercase letter"

0 commit comments

Comments
 (0)