-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
236 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This workflow will build a Swift project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run tests | ||
run: swift test | ||
- name: Danger | ||
if: github.event_name == 'pull_request' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
brew install danger/tap/danger-swift | ||
cd Danger | ||
swift run danger-swift ci --cwd ../ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Last-Checked SwiftLint Version: x.y.z | ||
|
||
# Configuration | ||
|
||
allow_zero_lintable_files: true | ||
|
||
# Overall Rules: | ||
|
||
excluded: # paths to ignore during linting. Takes precedence over `included`. | ||
# SwiftLint is using Darwin.glob to resolve file paths, and Darwin.glob simply doesn't support `"**"` as recursive path wildcard. | ||
# https://github.com/realm/SwiftLint/issues/3586#issuecomment-1026861753 | ||
- "*/.build" | ||
- ".build" | ||
- "*/DerivedData" | ||
- "Build" | ||
- "DerivedData" | ||
- "Carthage" | ||
- "Pods" | ||
- "vendor" | ||
- "*/SupportingFiles" | ||
- "Danger" | ||
- "Tests" | ||
|
||
disabled_rules: | ||
# Rules below are just exceptions under scratch phase and should be re-enabled in the future. | ||
- todo | ||
- inclusive_language | ||
|
||
opt_in_rules: | ||
- closure_body_length | ||
- closure_end_indentation | ||
- closure_spacing | ||
- collection_alignment | ||
- contains_over_filter_count | ||
- contains_over_filter_is_empty | ||
- contains_over_first_not_nil | ||
- contains_over_range_nil_comparison | ||
- empty_collection_literal | ||
- empty_count | ||
- empty_string | ||
- enum_case_associated_values_count | ||
- extension_access_modifier | ||
- fatal_error_message | ||
- file_name | ||
- file_name_no_space | ||
- file_types_order | ||
- first_where | ||
- flatmap_over_map_reduce | ||
- identical_operands | ||
- implicitly_unwrapped_optional | ||
# - indentation_width | ||
- last_where | ||
- legacy_multiple | ||
- legacy_random | ||
- literal_expression_end_indentation | ||
- lower_acl_than_parent | ||
- modifier_order | ||
- multiline_arguments_brackets | ||
- multiline_literal_brackets | ||
- multiline_parameters_brackets | ||
- number_separator | ||
- object_literal | ||
- operator_usage_whitespace | ||
- optional_enum_case_matching | ||
- overridden_super_call | ||
- prefer_self_type_over_type_of_self | ||
- prefer_zero_over_explicit_init | ||
- private_action | ||
- private_outlet | ||
- prohibited_super_call | ||
- reduce_into | ||
- single_test_class | ||
- sorted_first_last | ||
- static_operator | ||
- switch_case_on_newline | ||
- test_case_accessibility | ||
- toggle_bool | ||
# - type_contents_order # SwiftUI で init を body の前に置くため | ||
- vertical_parameter_alignment_on_call | ||
- vertical_whitespace_between_cases | ||
- xct_specific_matcher | ||
- yoda_condition | ||
|
||
analyzer_rules: | ||
- unused_declaration | ||
- unused_import | ||
|
||
# Single-Rule Configurations: | ||
|
||
file_name: | ||
excluded: | ||
- Dangerfile.swift | ||
suffix_pattern: "Extensions?|\\+.*" | ||
|
||
force_try: | ||
severity: warning | ||
|
||
function_parameter_count: | ||
warning: 7 | ||
error: 10 | ||
|
||
identifier_name: | ||
max_length: 50 | ||
excluded: | ||
- i | ||
- x | ||
- y | ||
- id | ||
- on | ||
- to | ||
- us | ||
- at | ||
- vc | ||
- ok | ||
- ci | ||
|
||
line_length: | ||
ignores_function_declarations: true | ||
ignores_comments: true | ||
warning: 175 | ||
error: 300 | ||
|
||
nesting: | ||
type_level: | ||
warning: 2 | ||
function_level: | ||
warning: 5 | ||
|
||
trailing_comma: | ||
mandatory_comma: true | ||
|
||
trailing_whitespace: | ||
ignores_empty_lines: true | ||
|
||
number_separator: | ||
minimum_length: 6 | ||
|
||
type_name: | ||
max_length: 50 | ||
|
||
vertical_whitespace: | ||
max_empty_lines: 3 | ||
|
||
cyclomatic_complexity: | ||
ignores_case_statements: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
import Danger | ||
import DangerSwiftEda // package: https://github.com/yumemi-inc/danger-swift-eda.git | ||
|
||
// MARK: - チェックルーチン | ||
let danger = Danger() | ||
|
||
// SwiftLint のワーニング等確認 | ||
SwiftLint.lint(.modifiedAndCreatedFiles(directory: nil), inline: true, swiftlintPath: .swiftPackage("$(pwd)/Danger")) | ||
|
||
// PR ルーチンチェック | ||
let configuration = GitHubFlow.Configuration( | ||
suggestsChangeLogUpdate: .no | ||
) | ||
danger.eda.checkPR(workflow: GitHubFlow(configuration: configuration)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// swift-tools-version:5.7 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Dangerfile", | ||
platforms: [.macOS("10.15")], | ||
products: [ | ||
.library( | ||
name: "DangerDepsProduct", | ||
type: .dynamic, | ||
targets: ["DangerDependencies"] | ||
), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/realm/SwiftLint", from: "0.54.0"), | ||
// Danger | ||
.package(name: "danger-swift", url: "https://github.com/danger/swift.git", from: "3.17.1"), | ||
// Danger Plugins | ||
.package(name: "DangerSwiftEda", url: "https://github.com/yumemi-inc/danger-swift-eda", from: "0.2.0"), | ||
], | ||
targets: [ | ||
.target( | ||
name: "DangerDependencies", | ||
dependencies: [ | ||
.product(name: "Danger", package: "danger-swift"), | ||
"DangerSwiftEda", | ||
] | ||
), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Only in order to keep this directory tracked by git so SwiftPM can work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Only in order to keep this directory tracked by git so SwiftPM can work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
import Danger | ||
import DangerSwiftEda // package: https://github.com/yumemi-inc/danger-swift-eda.git | ||
|
||
// MARK: - チェックルーチン | ||
let danger = Danger() | ||
|
||
// SwiftLint のワーニング等確認 | ||
SwiftLint.lint(.modifiedAndCreatedFiles(directory: nil), inline: true) | ||
|
||
// PR ルーチンチェック | ||
let configuration = GitHubFlow.Configuration( | ||
suggestsChangeLogUpdate: .no | ||
) | ||
danger.eda.checkPR(workflow: GitHubFlow(configuration: configuration)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters