You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
danger-js: Convert structs to clean interfaces without suffixes
Convert concrete structs (GitHub, GitLab, Settings, Git) to interfaces with clean names
and internal implementations (gitImpl, gitHubImpl, gitLabImpl, settingsImpl) to improve
testability and mockability while maintaining JSON marshaling compatibility.
- Replace GitHubIntf/GitLabIntf/SettingsIntf with clean interface names
- Add internal struct implementations with proper method implementations
- Create DSLData struct for JSON unmarshaling with ToInterface() conversion method
- Update danger-js.go and runner.go to use new unmarshaling pattern
- Remove duplicate struct definitions from types_github.go and types_gitlab.go
- All tests pass and backwards compatibility maintained
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Project Overview
6
+
7
+
This is **danger-go**, a Go implementation of the popular Danger tool that runs automation rules during PR reviews. It's a wrapper around Danger JS that allows writing Dangerfiles in Go instead of JavaScript.
8
+
9
+
The project consists of:
10
+
11
+
- A Go library for writing Danger rules (`api.go`, `types.go`)
12
+
- A command-line tool (`cmd/danger-go/`) that wraps Danger JS
13
+
- Type definitions for various platforms (GitHub, GitLab) in `danger-js/` directory
14
+
- Platform-specific types in separate files (`types_*.go`)
15
+
16
+
## Architecture
17
+
18
+
### Core Components
19
+
20
+
1.**API Layer** (`api.go`): Main public API with the `T` struct providing methods:
21
+
-`Message()` - Add informational messages
22
+
-`Warn()` - Add warnings that don't fail the build
23
+
-`Fail()` - Add failures that fail the build
24
+
-`Markdown()` - Add raw markdown to comments
25
+
26
+
2.**Types** (`types.go`): Core data structures like `Results`, `Violation`, `GitHubResults`
0 commit comments