Skip to content

Commit

Permalink
Version 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
f-meloni committed Jan 7, 2019
1 parent e71025e commit 89a20f7
Show file tree
Hide file tree
Showing 52 changed files with 1,246 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,8 @@

## Master

## 1.1.0

- Make globalResults private by [@f-meloni][]
- Make swiftlint rule id code on the message by [@f-meloni][]
- Append Swiftlint rule id to the Swiftlint danger messages by [@f-meloni][]
Expand Down
60 changes: 48 additions & 12 deletions Documentation/reference/Danger.swift
Expand Up @@ -371,13 +371,42 @@ extension DangerDSL {
public struct DangerUtils {
/// Let's you go from a file path to the contents of the file
/// with less hassle.
///
/// It specifically assumes golden path code so Dangerfiles
/// don't have to include error handlings - an error will
/// exit evaluation entirely as it should only happen at dev-time.
///
/// - Parameter file: the file reference from git.modified/creasted/deleted etc
/// - Returns: the file contents, or bails
public func readFile(_ file: File) -> String

/// Returns the line number of the lines that contain a specific string in a file
///
/// - Parameter string: The string you want to search
/// - Parameter file: The file path of the file where you want to search the string
/// - Returns: the line number of the lines where the passed string is contained
public func lines(for string: String, inFile file: File) -> [Int]

/// Gives you the ability to cheaply run a command and read the
/// output without having to mess around
///
/// It generally assumes that the command will pass, as you only get
/// a string of the STDOUT. If you think your command could/should fail
/// then you want to use `spawn` instead.
///
/// - Parameter command: The first part of the command
/// - Parameter arguments: An optional array of arguements to pass in extra
/// - Returns: the stdout from the command
public func exec(_ command: String, arguments: [String] = default) -> String

/// Gives you the ability to cheaply run a command and read the
/// output without having to mess around too much, and exposes
/// command errors in a pretty elegant way.
///
/// - Parameter command: The first part of the command
/// - Parameter arguments: An optional array of arguements to pass in extra
/// - Returns: the stdout from the command
public func spawn(_ command: String, arguments: [String] = default) throws -> String
}

/// A simple typealias for strings representing files
Expand Down Expand Up @@ -801,12 +830,19 @@ public struct GitHubUser: Decodable, Equatable {
/// Meta information for showing in the text info
public struct Meta: Codable {}

public enum SpawnError: Error {
case commandFailed(exitCode: Int32, stdout: String, stderr: String, task: Process)
}

/// The SwiftLint plugin has been embedded inside Danger, making
/// it usable out of the box.
public struct SwiftLint {
/// This is the main entry point for linting Swift in PRs using Danger-Swift.
/// Call this function anywhere from within your Dangerfile.swift.
public static func lint(inline: Bool = default, directory: String? = default, configFile: String? = default, lintAllFiles: Bool = default, swiftlintPath: String = default) -> [Danger.SwiftLintViolation]
/// This is the main entry point for linting Swift in PRs.
///
/// When the swiftlintPath is not specified,
/// it uses by default swift run swiftlint if the Package.swift contains swiftlint as dependency,
/// otherwise calls directly the swiftlint command
public static func lint(inline: Bool = default, directory: String? = default, configFile: String? = default, lintAllFiles: Bool = default, swiftlintPath: String? = default) -> [Danger.SwiftLintViolation]
}

public struct SwiftLintViolation: Codable {
Expand All @@ -824,14 +860,14 @@ public struct SwiftLintViolation: Codable {
/// The result of a warn, message, or fail.
public struct Violation: Codable {}

/// Adds an inline fail message to the Danger report
public func fail(message: String, file: String, line: Int)

/// Adds a warning message to the Danger report
///
/// - Parameter message: A markdown-ish
public func fail(_ message: String)

/// Adds an inline fail message to the Danger report
public func fail(message: String, file: String, line: Int)

/// Fails on the Danger report
public var fails: [Danger.Violation] { get }

Expand All @@ -846,28 +882,28 @@ public func markdown(message: String, file: String, line: Int)
/// Markdowns on the Danger report
public var markdowns: [Danger.Violation] { get }

/// Adds an inline message to the Danger report
public func message(message: String, file: String, line: Int)

/// Adds a warning message to the Danger report
///
/// - Parameter message: A markdown-ish
public func message(_ message: String)

/// Adds an inline message to the Danger report
public func message(message: String, file: String, line: Int)

/// Messages on the Danger report
public var messages: [Danger.Violation] { get }

/// Adds an inline suggestion to the Danger report (sends a normal message if suggestions are not supported)
public func suggestion(code: String, file: String, line: Int)

/// Adds an inline warning message to the Danger report
public func warn(message: String, file: String, line: Int)

/// Adds a warning message to the Danger report
///
/// - Parameter message: A markdown-ish
public func warn(_ message: String)

/// Adds an inline warning message to the Danger report
public func warn(message: String, file: String, line: Int)

/// Warnings on the Danger report
public var warnings: [Danger.Violation] { get }

Expand Down
8 changes: 8 additions & 0 deletions Documentation/reference/enums/FileType.md
Expand Up @@ -2,5 +2,13 @@

# `FileType`

```swift
public enum FileType: String, Equatable
```

## Cases
### `h`

```swift
case h, json, m, markdown = "md", mm, pbxproj, plist, storyboard, swift, xcscheme, yaml, yml
```
16 changes: 16 additions & 0 deletions Documentation/reference/enums/IssueState.md
Expand Up @@ -2,9 +2,25 @@

# `IssueState`

```swift
public enum IssueState: String, Decodable
```

## Cases
### `open`

```swift
case open
```

### `closed`

```swift
case closed
```

### `locked`

```swift
case locked
```
16 changes: 16 additions & 0 deletions Documentation/reference/enums/MilestoneState.md
Expand Up @@ -2,9 +2,25 @@

# `MilestoneState`

```swift
public enum MilestoneState: String, Decodable
```

## Cases
### `open`

```swift
case open
```

### `closed`

```swift
case closed
```

### `all`

```swift
case all
```
20 changes: 20 additions & 0 deletions Documentation/reference/enums/PullRequestState.md
Expand Up @@ -2,11 +2,31 @@

# `PullRequestState`

```swift
public enum PullRequestState: String, Decodable
```

## Cases
### `open`

```swift
case open
```

### `closed`

```swift
case closed
```

### `merged`

```swift
case merged
```

### `locked`

```swift
case locked
```
24 changes: 24 additions & 0 deletions Documentation/reference/enums/ReviewState.md
Expand Up @@ -2,13 +2,37 @@

# `ReviewState`

```swift
public enum ReviewState: String, Decodable
```

## Cases
### `approved`

```swift
case approved = "APPROVED"
```

### `requestedChanges`

```swift
case requestedChanges = "CHANGES_REQUESTED"
```

### `comment`

```swift
case comment = "COMMENTED"
```

### `pending`

```swift
case pending = "PENDING"
```

### `dismissed`

```swift
case dismissed = "DISMISSED"
```
8 changes: 8 additions & 0 deletions Documentation/reference/enums/SpawnError.md
Expand Up @@ -2,5 +2,13 @@

# `SpawnError`

```swift
public enum SpawnError: Error
```

## Cases
### `commandFailed(exitCode:stdout:stderr:task:)`

```swift
case commandFailed(exitCode: Int32, stdout: String, stderr: String, task: Process)
```
12 changes: 12 additions & 0 deletions Documentation/reference/enums/UserType.md
Expand Up @@ -2,7 +2,19 @@

# `UserType`

```swift
public enum UserType: String, Decodable
```

## Cases
### `user`

```swift
case user = "User"
```

### `organization`

```swift
case organization = "Organization"
```

0 comments on commit 89a20f7

Please sign in to comment.