From 9525e692a7b77f4db6f69d95d70c82ce60e76fff Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Mon, 22 Oct 2018 01:15:56 +0200 Subject: [PATCH 1/9] Add danger prose into gemfile --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 434bb8a52..721fb8c1b 100644 --- a/Gemfile +++ b/Gemfile @@ -9,4 +9,5 @@ gem 'octokit', '~> 4.3' gem 'danger' gem 'danger-swiftlint' gem 'danger-xcode_summary' +gem 'danger-prose' gem 'xcpretty-json-formatter' From 49adb91ed5e4b0d0693164b9bc87270713d3a41b Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Mon, 22 Oct 2018 01:16:45 +0200 Subject: [PATCH 2/9] Update danger file to lint and check spelling doc files --- Dangerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Dangerfile b/Dangerfile index 66af65ce2..37c4af28b 100644 --- a/Dangerfile +++ b/Dangerfile @@ -47,6 +47,23 @@ if has_app_changes && missing_doc_changes && doc_changes_recommended && not_decl warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.") end +# Run danger-prose to lint doc files +proselint_installed = prose.proselint_installed? +if proselint_installed + prose.lint_files "docs/*.md" + prose.lint_files "docs_CN/*.md" +else + warn("prose lint is not installed to lint doc files") +end + +# Run danger-prose to check spelling doc files +mdspell_installed = prose.mdspell_installed? +if mdspell_installed + prose.check_spelling "docs/*.md" +else + warn("md spell is not installed to check spelling doc files") +end + # Wrapper for package manifest file name and update status PackageManifest = Struct.new(:fileName, :updated) From b928fd75bbdd2565c31e7d42ce536c5691645e94 Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 00:05:06 +0200 Subject: [PATCH 3/9] Update danger file to remove checking if proselint and mdspell installed --- Dangerfile | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Dangerfile b/Dangerfile index 37c4af28b..a5a8cabed 100644 --- a/Dangerfile +++ b/Dangerfile @@ -48,21 +48,11 @@ if has_app_changes && missing_doc_changes && doc_changes_recommended && not_decl end # Run danger-prose to lint doc files -proselint_installed = prose.proselint_installed? -if proselint_installed - prose.lint_files "docs/*.md" - prose.lint_files "docs_CN/*.md" -else - warn("prose lint is not installed to lint doc files") -end +prose.lint_files "docs/*.md" +prose.lint_files "docs_CN/*.md" # Run danger-prose to check spelling doc files -mdspell_installed = prose.mdspell_installed? -if mdspell_installed - prose.check_spelling "docs/*.md" -else - warn("md spell is not installed to check spelling doc files") -end +prose.check_spelling "docs/*.md" # Wrapper for package manifest file name and update status PackageManifest = Struct.new(:fileName, :updated) From a2abf44fa83cf1d1ba92bff754884d9029db788a Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 00:37:29 +0200 Subject: [PATCH 4/9] Add danger-prose install into ci config --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e023a9ac..f257f0d41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,6 +53,9 @@ jobs: - run: name: Install Swiftlint command: brew install swiftlint + - run: + name: Install danger-prose + command: gem install danger-prose - run: name: Install Ruby Dependencies command: bundle check || bundle install From 5a1736bf93d48d19cff8fae0602ae981b4ff54a6 Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 01:27:18 +0200 Subject: [PATCH 5/9] Remove danger-prose install from ci config --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f257f0d41..4e023a9ac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,9 +53,6 @@ jobs: - run: name: Install Swiftlint command: brew install swiftlint - - run: - name: Install danger-prose - command: gem install danger-prose - run: name: Install Ruby Dependencies command: bundle check || bundle install From d85967178b9709a4e70eb73294756609c24f4829 Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 01:27:43 +0200 Subject: [PATCH 6/9] Add Python directory to PATH in ci config --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e023a9ac..1117f2f07 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,6 +53,9 @@ jobs: - run: name: Install Swiftlint command: brew install swiftlint + - run: + name: Add Python directory to PATH + command: echo 'export PATH=~/Library/Python/2.7/bin:$PATH' >> $BASH_ENV - run: name: Install Ruby Dependencies command: bundle check || bundle install From c16d1e0c8dbc8505bacf8093ccf7a2ded1d8821f Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 22:12:46 +0200 Subject: [PATCH 7/9] Set language as en-US and ignore acronyms, numbers and some words for spell checking --- Dangerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dangerfile b/Dangerfile index a5a8cabed..66e9df9ef 100644 --- a/Dangerfile +++ b/Dangerfile @@ -52,6 +52,10 @@ prose.lint_files "docs/*.md" prose.lint_files "docs_CN/*.md" # Run danger-prose to check spelling doc files +prose.language = "en-us" +prose.ignored_words = ["Auth", "auth", "Moya", "enum", "enums", "OAuth", "Artsy's", "Heimdallr.swift", "SwiftyJSONMapper", "ObjectMapper", "Argo", "ModelMapper", "ReactiveSwift", "RxSwift", "multipart", "JSONEncoder", "Alamofire", "CocoaPods", "URLSession", "plugin", "plugins", "stubClosure", "requestClosure", "endpointClosure", "Unsplash", "ReactorKit", "Dribbble", "EVReflection", "Unbox"] +prose.ignore_acronyms = true +prose.ignore_numbers = true prose.check_spelling "docs/*.md" # Wrapper for package manifest file name and update status From f53ddc4c114a885915f7879b2df337996e86bad6 Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Wed, 24 Oct 2018 22:19:25 +0200 Subject: [PATCH 8/9] Run lint and check spelling only if doc files modified --- Dangerfile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Dangerfile b/Dangerfile index 66e9df9ef..500fc0b83 100644 --- a/Dangerfile +++ b/Dangerfile @@ -47,16 +47,20 @@ if has_app_changes && missing_doc_changes && doc_changes_recommended && not_decl warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.") end -# Run danger-prose to lint doc files -prose.lint_files "docs/*.md" -prose.lint_files "docs_CN/*.md" - -# Run danger-prose to check spelling doc files -prose.language = "en-us" -prose.ignored_words = ["Auth", "auth", "Moya", "enum", "enums", "OAuth", "Artsy's", "Heimdallr.swift", "SwiftyJSONMapper", "ObjectMapper", "Argo", "ModelMapper", "ReactiveSwift", "RxSwift", "multipart", "JSONEncoder", "Alamofire", "CocoaPods", "URLSession", "plugin", "plugins", "stubClosure", "requestClosure", "endpointClosure", "Unsplash", "ReactorKit", "Dribbble", "EVReflection", "Unbox"] -prose.ignore_acronyms = true -prose.ignore_numbers = true -prose.check_spelling "docs/*.md" +# Run danger-prose to lint doc files if docs modified +if en_docs_modified || cn_docs_modified + prose.lint_files "docs/*.md" + prose.lint_files "docs_CN/*.md" +end + +# Run danger-prose to check spelling doc files if docs modified +if en_docs_modified + prose.language = "en-us" + prose.ignored_words = ["Auth", "auth", "Moya", "enum", "enums", "OAuth", "Artsy's", "Heimdallr.swift", "SwiftyJSONMapper", "ObjectMapper", "Argo", "ModelMapper", "ReactiveSwift", "RxSwift", "multipart", "JSONEncoder", "Alamofire", "CocoaPods", "URLSession", "plugin", "plugins", "stubClosure", "requestClosure", "endpointClosure", "Unsplash", "ReactorKit", "Dribbble", "EVReflection", "Unbox"] + prose.ignore_acronyms = true + prose.ignore_numbers = true + prose.check_spelling "docs/*.md" +end # Wrapper for package manifest file name and update status PackageManifest = Struct.new(:fileName, :updated) From 625204cc70aa6c36a49b236f9153a736494d89d0 Mon Sep 17 00:00:00 2001 From: Maxim Tsvetkov <777.maxxx@gmail.com> Date: Sun, 2 Dec 2018 01:12:01 +0100 Subject: [PATCH 9/9] Run lint and check spelling only on added and modified doc files --- Dangerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dangerfile b/Dangerfile index 500fc0b83..13968bfa9 100644 --- a/Dangerfile +++ b/Dangerfile @@ -47,19 +47,23 @@ if has_app_changes && missing_doc_changes && doc_changes_recommended && not_decl warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.") end -# Run danger-prose to lint doc files if docs modified -if en_docs_modified || cn_docs_modified - prose.lint_files "docs/*.md" - prose.lint_files "docs_CN/*.md" +# Run danger-prose to lint Chinese docs +added_and_modified_cn_docs = (git.added_files.grep(%r{docs_CN/*.md}) + git.modified_files.grep(%r{docs_CN/*.md})) +if added_and_modified_cn_docs.empty? + prose.lint_files added_and_modified_cn_docs end -# Run danger-prose to check spelling doc files if docs modified -if en_docs_modified +# Run danger-prose to lint and check spelling English docs +added_and_modified_en_docs = (git.added_files.grep(%r{docs/*.md}) + git.modified_files.grep(%r{docs/*.md})) +if added_and_modified_en_docs.empty? + prose.lint_files added_and_modified_en_docs + prose.language = "en-us" prose.ignored_words = ["Auth", "auth", "Moya", "enum", "enums", "OAuth", "Artsy's", "Heimdallr.swift", "SwiftyJSONMapper", "ObjectMapper", "Argo", "ModelMapper", "ReactiveSwift", "RxSwift", "multipart", "JSONEncoder", "Alamofire", "CocoaPods", "URLSession", "plugin", "plugins", "stubClosure", "requestClosure", "endpointClosure", "Unsplash", "ReactorKit", "Dribbble", "EVReflection", "Unbox"] prose.ignore_acronyms = true prose.ignore_numbers = true - prose.check_spelling "docs/*.md" + + prose.check_spelling added_and_modified_en_docs end # Wrapper for package manifest file name and update status