Skip to content

Add remark lint #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# As default in RuboCop:
# https://github.com/rubocop/rubocop/blob/master/config/default.yml#L932
max_line_length = 120

[*.md]
indent_style = space
Expand Down
49 changes: 41 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,53 @@ on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '**.md'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use conditions for Ruby jobs later, but there is no simple way with current GH Actions syntax:

  • As I understand, if changed_files != 'markdown' will skip Ruby job for commits with Ruby files and Markdown (or other non-related) files.
  • But enumeration of all related to Ruby jobs files can be huge.


env:
BUNDLE_PATH: vendor/bundle

jobs:
lint:
lint-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: dorny/paths-filter@v2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw somewhere a syntax for semi-native GH Actions conditions, but lost it and didn't find.

id: changes
with:
filters: |
markdown:
- '**.md'
- '.remark*'
- 'package.json'
- 'yarn.lock'

- name: Get Yarn cache directory path
id: yarn-cache-dir-path
if: steps.changes.outputs.markdown == 'true'
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Yarn
uses: actions/cache@v2
if: steps.changes.outputs.markdown == 'true'
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install Node.js packages
if: steps.changes.outputs.markdown == 'true'
run: yarn install --frozen-lockfile

- name: Run Markdown linting
if: steps.changes.outputs.markdown == 'true'
run: yarn run remark

lint-ruby:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -26,10 +59,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run linting

- name: Run Ruby linting
run: ./bin/standardrb --no-fix

build:
runs-on: ubuntu-latest
services:
Expand Down
2 changes: 2 additions & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tmp/
/vendor/
11 changes: 11 additions & 0 deletions .remarkrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins:
- remark-preset-lint-markdown-style-guide
- remark-gfm
- - lint-maximum-line-length
- 120
- - lint-unordered-list-marker-style
- consistent
- - lint-no-file-name-irregular-characters
- '\\.a-zA-Z0-9-_'
- - lint-no-shell-dollars
- - error
19 changes: 8 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ include:

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand All @@ -55,7 +52,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at team@rubyapi.org. All
reported by contacting the project team at [team@rubyapi.org](mailto:team@rubyapi.org). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand All @@ -68,9 +65,9 @@ members of the project's leadership.
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
<https://www.contributor-covenant.org/faq>

[homepage]: https://www.contributor-covenant.org
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Ruby API makes it easy and fast to search or browse the Ruby language API docs.

## Why?

The existing websites for Ruby documentation are hard to search, and impossible to read on mobile devices. Ruby API provides instant search results, inspired by [Dash](http://kapeli.com/dash), and a responsive design that's easy to read on any size device.
The existing websites for Ruby documentation are hard to search, and impossible to read on mobile devices.
Ruby API provides instant search results, inspired by [Dash](http://kapeli.com/dash),
and a responsive design that's easy to read on any size device.

We aim to improve the Ruby ecosystem by being:

Expand All @@ -22,47 +24,48 @@ We aim to improve the Ruby ecosystem by being:
Install dependencies:

```sh
$ bundle install && yarn install
bundle install && yarn install
```

Start ElasticSearch:
Start ElasticSearch (can require root privilages on some systems):

```sh
$ docker-compose up -d
docker-compose up -d
```

Start the Rails Server

```sh
$ ./bin/rails server
./bin/rails server
```

Optionally, you also may want to start the webpack dev server

```sh
$ ./bin/webpack-dev-server
./bin/webpack-dev-server
```

## Importing Documentation

Ruby's documentation can be imported very easily. There's a rake task that will let you import a given versions' documentation:
Ruby's documentation can be imported very easily.
There's a rake task that will let you import a given versions' documentation:

```sh
$ ./bin/rake import:ruby[3.0.0]
./bin/rake import:ruby[3.0.0]
```

or you can easily import the latest versions of all currently supported versions of ruby:

```sh
$ ./bin/rake import:ruby:all
./bin/rake import:ruby:all
```

## Running tests

The test suite can be executed with:

```sh
$ ./bin/rake test
./bin/rake test
```

## Linting code
Expand All @@ -72,11 +75,11 @@ This project uses [StandardRB](https://github.com/testdouble/standard) for linti
StandardRB can be executed with:

```sh
$ ./bin/standardrb
./bin/standardrb
```

_Note: This command may make changes to your code, to make it conform to the formatting rules of
this project._
Note: This command may make changes to your code, to make it conform to the formatting rules of
this project.

For instructions on running StandardRB in your editor, [check out StandardRB's Documentation](https://github.com/testdouble/standard#how-do-i-run-standard-in-my-editor).

Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "ruby-api",
"private": true,
"scripts": {
"remark": "remark ."
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.28",
"@fortawesome/free-brands-svg-icons": "^5.13.0",
Expand All @@ -21,6 +24,10 @@
},
"devDependencies": {
"chokidar": "^3.5.1",
"remark": "^13.0.0",
"remark-cli": "^9.0.0",
"remark-gfm": "^1.0.0",
"remark-preset-lint-markdown-style-guide": "^4.0.0",
"webpack-dev-server": "^3.11.2"
}
}
Loading