Giter Site home page Giter Site logo

danger-prose's Introduction

danger-prose

A description of danger-prose.

Installation

As a pre-requisite, danger-prose requires a node environment for spell checking and a python environment for linting. So, make sure your CI environment has support for either or both of those.

$ gem install danger-prose

prose

Lint markdown files inside your projects. This is done using the proselint python egg. Results are passed out as a table in markdown.

Running linter with custom disabled linters
# Runs a linter with comma style and tense present disabled
prose.disable_linters = ["misc.scare_quotes", "misc.tense_present"]
prose.lint_files "_posts/*.md"
Running linter with default linters
# Runs a linter with all styles, on modified and added markdown files in this PR
prose.lint_files
Running the spell checker
# Runs a spell checker on all files in `_post`
prose.check_spelling "_posts/*.md"
Running the spell checker, with some words whitelisted
prose.ignored_words = ["orta", "artsy"]
prose.check_spelling

Attributes

disable_linters - Allows you to disable a collection of linters from running. Doesn't work yet. You can get a list of them here defaults to ["misc.scare_quotes", "typography.symbols"] when it's nil.

ignored_words - Allows you to add a collection of words to skip in spellchecking. defaults to [""] when it's nil.

ignore_numbers - Allows you to specify that you want to ignore reporting numbers as spelling errors. Defaults to false, switch it to true if you wish to ignore numbers.

ignore_acronyms - Allows you to specify that you want to ignore acronyms as spelling errors. Defaults to false, switch it to true if you wish to ignore acronyms.

language - Allows you to specify dictionary language to use for spell-checking. Defaults to en-gb, switch to en-us, en-au or es-es, to override.

Methods

lint_files - Lints the globbed markdown files. Will fail if proselint cannot be installed correctly. Generates a markdown list of warnings for the prose in a corpus of .markdown and .md files.

proselint_installed? - Determine if proselint is currently installed in the system paths.

mdspell_installed? - Determine if mdspell is currently installed in the system paths.

check_spelling - Runs a markdown-specific spell checker, against a corpus of .markdown and .md files.

danger-prose's People

Contributors

ashfurrow avatar cellane avatar dbgrandi avatar jwilk avatar mschmieder avatar orta avatar suchow avatar zhusee2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

danger-prose's Issues

Error when running in Docker ruby:2.4

I'm trying this on Drone CI using this configuration:

build:
  prose-lint:
    image: ruby:2.4
    environment:
      DANGER_GITHUB_API_TOKEN: $$BOT_GITHUB_TOKEN
    commands:
      - bundle install
      - bundle exec danger

which simply specifies to run bundle install and bundle exec danger in the ruby:2.4 docker image.

The Gemfile looks like:

source "https://rubygems.org"

gem "danger"
gem "danger-prose"

and the Dangerfile is:

prose.check_spelling "posts/*.md"

This is the error I get:

$ bundle exec danger
[!] The exception involves the following plugins:
-  danger-prose
bundler: failed to load command: danger (/usr/local/bundle/bin/danger)
Danger::DSLError: 
[!] Invalid `Dangerfile` file: mdspell is not in the user's PATH, or it failed to install
#  from Dangerfile:1
#  -------------------------------------------
>  prose.check_spelling "posts/*.md"
#  -------------------------------------------
Here's the full CI log, including the install phase
$ bundle install
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Fetching claide 1.0.1
Installing claide 1.0.1
Fetching colored2 3.1.2
Installing colored2 3.1.2
Fetching nap 1.1.0
Installing nap 1.1.0
Fetching open4 1.3.4
Installing open4 1.3.4
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching git 1.3.0
Installing git 1.3.0
Fetching kramdown 1.13.2
Installing kramdown 1.13.2
Fetching public_suffix 2.0.5
Installing public_suffix 2.0.5
Fetching unicode-display_width 1.2.1
Installing unicode-display_width 1.2.1
Using bundler 1.15.0
Fetching cork 0.3.0
Installing cork 0.3.0
Fetching faraday 0.12.1
Installing faraday 0.12.1
Fetching addressable 2.5.1
Installing addressable 2.5.1
Fetching terminal-table 1.8.0
Installing terminal-table 1.8.0
Fetching claide-plugins 0.9.2
Installing claide-plugins 0.9.2
Fetching faraday-http-cache 1.3.1
Installing faraday-http-cache 1.3.1
Fetching sawyer 0.8.1
Installing sawyer 0.8.1
Fetching octokit 4.7.0
Installing octokit 4.7.0
Fetching danger 5.2.2
Installing danger 5.2.2
Fetching danger-prose 2.0.4
Installing danger-prose 2.0.4
Bundle complete! 2 Gemfile dependencies, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
$ bundle exec danger
[!] The exception involves the following plugins:
-  danger-prose
bundler: failed to load command: danger (/usr/local/bundle/bin/danger)
Danger::DSLError: 
[!] Invalid `Dangerfile` file: mdspell is not in the user's PATH, or it failed to install
#  from Dangerfile:1
#  -------------------------------------------
>  prose.check_spelling "posts/*.md"
#  -------------------------------------------

 /usr/local/bundle/gems/danger-prose-2.0.4/lib/danger_plugin.rb:120:in `check_spelling'
 Dangerfile:1:in `block in parse'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:199:in `eval'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:195:in `parse'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/dangerfile.rb:272:in `run'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/danger_core/executor.rb:27:in `run'
 /usr/local/bundle/gems/danger-5.2.2/lib/danger/commands/runner.rb:66:in `run'
 /usr/local/bundle/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
 /usr/local/bundle/gems/danger-5.2.2/bin/danger:5:in `<top (required)>'
 /usr/local/bundle/bin/danger:17:in `load'
 /usr/local/bundle/bin/danger:17:in `<top (required)>'

Any idea of what may be causing the issue?

New release?

Any chance of a new release with Gitlab support included from #27 ?
Thanks

Run Danger-prose over diffs, not modified files?

It seems that this plugin runs over the entire modified file, including text that was merged in previous commits but which is not modified in the PR under consideration. See, for example, amperser/proselint#609 (comment). Though these suggestions are valid, they are not not relevant to the PR and thus should not be included.

Fixing this issue is complicated because it requires determining which errors raised can be attributed to the PR. One possible solution is to run the prose linters twice, once over the proposed text and once over the original text. Any error that is flagged in the former that did not appear in the latter can be attributed to the proposed change. A second possible solution is to attribute to the PR any error that appears on a modified line. This will falsely flag existing errors that are adjacent to changes, but is a step in the right direction.

GitHub rate limit error

hey! i help maintain Moya, and we're noticing an issue on our CI that may be related to this plugin

it looks like

Cloning and building inline dependencies: import DangerSwiftProse // package: https://github.com/f-meloni/danger-swift-prose.git, import DangerXCodeSummary // package: https://github.com/f-meloni/danger-swift-xcodesummary.git, this might take some time.
Updating packages...
Using https://github.com/f-meloni/danger-swift-prose.git latest major:1
Updating packages...
Using https://github.com/f-meloni/danger-swift-xcodesummary.git latest major:1
Updating packages...

Failing the build, there are 19 fails.
Request failed [422]: https://api.github.com/repos/Moya/Moya/pulls/2120/comments
Response: {
  "message": "Validation Failed",
  "errors": [
    {
      "resource": "PullRequestReviewComment",
      "code": "invalid",
      "field": "position"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/reference/pulls#create-a-review-comment-for-a-pull-request"
}

we've noticed on repeated runs of this PR Moya/Moya#2120, and potentially now in our development branch now that we've merged the PR. before we dug deeper into it, i thought we'd check with y'all to see if you grok it, have seen it before, or know how to fix it?

i really appreciate all your work on this tool!

Wrong number of arguments for `prose.lint_files`

This was working fine before, but seems to be failing for some reason at this point over at Swift Weekly Brief. Any idea as to what causes this?

Dangerfile: https://github.com/SwiftWeekly/swiftweekly.github.io/blob/master/Dangerfile
Gemfile: https://github.com/SwiftWeekly/swiftweekly.github.io/blob/master/Gemfile
Gemfile.lock: https://github.com/SwiftWeekly/swiftweekly.github.io/blob/master/Gemfile.lock
Danger versions:

danger (5.3.2)
      claide (~> 1.0)
      claide-plugins (>= 0.9.2)
      colored2 (~> 3.1)
      cork (~> 0.1)
      faraday (~> 0.9)
      faraday-http-cache (~> 1.0)
      git (~> 1)
      kramdown (~> 1.5)
      octokit (~> 4.2)
      terminal-table (~> 1)
    danger-prose (2.0.4)
      danger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.