rubocop-md 0.3.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +33 -0
- data/.github/workflows/test-jruby.yml +34 -0
- data/.github/workflows/test.yml +49 -0
- data/.rubocop.yml +12 -1
- data/.travis.yml +6 -3
- data/CHANGELOG.md +22 -0
- data/LICENSE.txt +1 -1
- data/README.md +5 -5
- data/config/default.yml +55 -0
- data/lib/rubocop/markdown/preprocess.rb +2 -2
- data/lib/rubocop/markdown/rubocop_ext.rb +16 -2
- data/lib/rubocop/markdown/version.rb +1 -1
- data/rubocop-md.gemspec +3 -3
- metadata +15 -13
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd427ec8e44c548cc33d0894f4cc8b0375ae3d92cbd5dac2ec0e5d5159cfc8cd
|
4
|
+
data.tar.gz: 920755489abe9ccb53e04b3386c980ab5b633649c8d0bcbedc566d0219d99f38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97928bbbf89b26e887baae4220f7db61f88897bc1e96bdaf623df188c0345839e49ccb9d66bb0569ef98a69efd6e7127fb9b760bf416c16909a79b367c93893
|
7
|
+
data.tar.gz: 63a5bc235da592a26613f1ada3a2992e0d0c878b2576909e35f0a65cbfeced0faf9e0fe69dbd2bb6e381cb3c24d9b40870c8d3461714655f7d133463ac759f3d
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Lint
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rubocop:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
env:
|
13
|
+
BUNDLE_JOBS: 4
|
14
|
+
BUNDLE_RETRY: 3
|
15
|
+
CI: true
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: actions/cache@v1
|
19
|
+
with:
|
20
|
+
path: /home/runner/bundle
|
21
|
+
key: bundle-lint-${{ hashFiles('Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
|
22
|
+
restore-keys: |
|
23
|
+
bundle-lint-
|
24
|
+
- uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: 2.7
|
27
|
+
- name: Bundle install
|
28
|
+
run: |
|
29
|
+
bundle config path /home/runner/bundle
|
30
|
+
bundle install
|
31
|
+
- name: Run Rubocop
|
32
|
+
run: |
|
33
|
+
bundle exec rubocop
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: JRuby Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
env:
|
13
|
+
BUNDLE_JOBS: 4
|
14
|
+
BUNDLE_RETRY: 3
|
15
|
+
CI: true
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: actions/cache@v1
|
19
|
+
with:
|
20
|
+
path: /home/runner/bundle
|
21
|
+
key: bundle-${{ hashFiles('Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
|
22
|
+
restore-keys: |
|
23
|
+
bundle-
|
24
|
+
- uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: jruby
|
27
|
+
- name: Bundle install
|
28
|
+
run: |
|
29
|
+
bundle config path /home/runner/bundle
|
30
|
+
bundle install
|
31
|
+
bundle update
|
32
|
+
- name: Run tests
|
33
|
+
run: |
|
34
|
+
bundle exec rake test
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
env:
|
13
|
+
BUNDLE_JOBS: 4
|
14
|
+
BUNDLE_RETRY: 3
|
15
|
+
CI: true
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: ["2.7"]
|
20
|
+
gemfile: [
|
21
|
+
"Gemfile"
|
22
|
+
]
|
23
|
+
include:
|
24
|
+
- ruby: "2.5"
|
25
|
+
gemfile: "Gemfile"
|
26
|
+
- ruby: "2.6"
|
27
|
+
gemfile: "Gemfile"
|
28
|
+
- ruby: "2.7"
|
29
|
+
gemfile: "gemfiles/rubocopmaster.gemfile"
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- uses: actions/cache@v1
|
33
|
+
with:
|
34
|
+
path: /home/runner/bundle
|
35
|
+
key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
|
36
|
+
restore-keys: |
|
37
|
+
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
|
38
|
+
- uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: ${{ matrix.ruby }}
|
41
|
+
- name: Bundle install
|
42
|
+
run: |
|
43
|
+
bundle config path /home/runner/bundle
|
44
|
+
bundle config --global gemfile ${{ matrix.gemfile }}
|
45
|
+
bundle install
|
46
|
+
bundle update
|
47
|
+
- name: Run tests
|
48
|
+
run: |
|
49
|
+
bundle exec rake test
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
NewCops: enable
|
2
3
|
Include:
|
3
4
|
- 'lib/**/*.rb'
|
4
5
|
- 'lib/**/*.rake'
|
@@ -12,7 +13,8 @@ AllCops:
|
|
12
13
|
- '*.gemspec'
|
13
14
|
DisplayCopNames: true
|
14
15
|
StyleGuideCopsOnly: false
|
15
|
-
TargetRubyVersion: 2.
|
16
|
+
TargetRubyVersion: 2.5
|
17
|
+
SuggestExtensions: false
|
16
18
|
|
17
19
|
Style/Documentation:
|
18
20
|
Exclude:
|
@@ -28,6 +30,15 @@ Style/ClassAndModuleChildren:
|
|
28
30
|
Exclude:
|
29
31
|
- 'test/**/*.rb'
|
30
32
|
|
33
|
+
Style/HashEachMethods:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Style/HashTransformKeys:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Style/HashTransformValues:
|
40
|
+
Enabled: true
|
41
|
+
|
31
42
|
Layout/EmptyLinesAroundArguments:
|
32
43
|
Enabled: false
|
33
44
|
|
data/.travis.yml
CHANGED
@@ -4,6 +4,9 @@ before_install:
|
|
4
4
|
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
5
5
|
- gem install bundler -v '< 2'
|
6
6
|
|
7
|
+
notifications:
|
8
|
+
email: false
|
9
|
+
|
7
10
|
matrix:
|
8
11
|
fast_finish: true
|
9
12
|
include:
|
@@ -11,16 +14,16 @@ matrix:
|
|
11
14
|
gemfile: gemfiles/rubocopmaster.gemfile
|
12
15
|
- rvm: jruby-9.2.8.0
|
13
16
|
gemfile: Gemfile
|
14
|
-
- rvm: 2.
|
17
|
+
- rvm: 2.7
|
15
18
|
gemfile: gemfiles/rubocopmaster.gemfile
|
19
|
+
- rvm: 2.7
|
20
|
+
gemfile: Gemfile
|
16
21
|
- rvm: 2.6
|
17
22
|
gemfile: Gemfile
|
18
23
|
- rvm: 2.5
|
19
24
|
gemfile: Gemfile
|
20
25
|
- rvm: 2.4.2
|
21
26
|
gemfile: Gemfile
|
22
|
-
- rvm: 2.3.1
|
23
|
-
gemfile: Gemfile
|
24
27
|
allow_failures:
|
25
28
|
- rvm: ruby-head
|
26
29
|
gemfile: gemfiles/rubocopmaster.gemfile
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 1.0.1 (2020-12-28)
|
6
|
+
|
7
|
+
- Exclude `EmptyLineBetweenDefs` for MD files.
|
8
|
+
|
9
|
+
## 1.0.0 (2020-12-24)
|
10
|
+
|
11
|
+
- Drop Ruby 2.4 support and require RuboCop 1.0.
|
12
|
+
|
13
|
+
## 0.4.1 (2020-11-05)
|
14
|
+
|
15
|
+
- Relax required RuboCop version.
|
16
|
+
|
17
|
+
## 0.4.0 (2020-07-03)
|
18
|
+
|
19
|
+
- [#10](https://github.com/rubocop-hq/rubocop-md/pull/10): **Drop Ruby 2.3 support** ([@dominicsayers][])
|
20
|
+
|
21
|
+
## 0.3.2 (2020-03-18)
|
22
|
+
|
23
|
+
- [#9](https://github.com/rubocop-hq/rubocop-md/pull/9): Add file extensions for Markdown ([@ybiquitous][])
|
24
|
+
|
5
25
|
## 0.3.1 (2019-12-25)
|
6
26
|
|
7
27
|
- Upgrade to RuboCop 0.78 ([@palkan][])
|
@@ -13,3 +33,5 @@ Change the default config to use the new cop names for (e.g., `Layout/LineLength
|
|
13
33
|
- **Drop Ruby 2.2 support** ([@palkan][])
|
14
34
|
|
15
35
|
[@palkan]: https://github.com/palkan
|
36
|
+
[@ybiquitous]: https://github.com/ybiquitous
|
37
|
+
[@dominicsayers]: https://github.com/dominicsayers
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
3
|
+
Copyright (c) 2017-2021 Vladimir Dementyev
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/rubocop-md.svg)](http://badge.fury.io/rb/rubocop-md)
|
2
|
-
|
2
|
+
![Test](https://github.com/rubocop-hq/rubocop-md/workflows/Test/badge.svg)
|
3
3
|
|
4
4
|
# Rubocop Markdown
|
5
5
|
|
@@ -12,7 +12,7 @@ Run Rubocop against your Markdown files to make sure that code examples follow s
|
|
12
12
|
- Preserves specified language (i.e., do not try to analyze "\`\`\`sh")
|
13
13
|
- **Supports autocorrect 📝**
|
14
14
|
|
15
|
-
This project was developed to keep [test-prof](https://github.com/
|
15
|
+
This project was developed to keep [test-prof](https://github.com/test-prof/test-prof) guides consistent with Ruby style guide.
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
@@ -126,7 +126,7 @@ end
|
|
126
126
|
|
127
127
|
<span style="display:none;"># rubocop:enable all</span>
|
128
128
|
|
129
|
-
... continuation of article ...
|
129
|
+
... continuation of article ...
|
130
130
|
```
|
131
131
|
|
132
132
|
## How it works?
|
@@ -145,13 +145,13 @@ end
|
|
145
145
|
|
146
146
|
## Development
|
147
147
|
|
148
|
-
After checking out the repo, run `
|
148
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests.
|
149
149
|
|
150
150
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
151
151
|
|
152
152
|
## Contributing
|
153
153
|
|
154
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
154
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop-hq/rubocop-md.
|
155
155
|
|
156
156
|
## License
|
157
157
|
|
data/config/default.yml
CHANGED
@@ -22,11 +22,66 @@ Layout/TrailingEmptyLines:
|
|
22
22
|
- '**/*.md'
|
23
23
|
- '**/*.markdown'
|
24
24
|
|
25
|
+
Layout/EmptyLineBetweenDefs:
|
26
|
+
Exclude:
|
27
|
+
- '**/*.md'
|
28
|
+
- '**/*.markdown'
|
29
|
+
|
30
|
+
Lint/DuplicateRequire:
|
31
|
+
Exclude:
|
32
|
+
- '**/*.md'
|
33
|
+
- '**/*.markdown'
|
34
|
+
|
35
|
+
Lint/DuplicateMethods:
|
36
|
+
Exclude:
|
37
|
+
- '**/*.md'
|
38
|
+
- '**/*.markdown'
|
39
|
+
|
40
|
+
Lint/RedundantCopDisableDirective:
|
41
|
+
Exclude:
|
42
|
+
- '**/*.md'
|
43
|
+
- '**/*.markdown'
|
44
|
+
|
45
|
+
Lint/RedundantCopEnableDirective:
|
46
|
+
Exclude:
|
47
|
+
- '**/*.md'
|
48
|
+
- '**/*.markdown'
|
49
|
+
|
50
|
+
Lint/RedundantRequireStatement:
|
51
|
+
Exclude:
|
52
|
+
- '**/*.md'
|
53
|
+
- '**/*.markdown'
|
54
|
+
|
55
|
+
Lint/UnusedMethodArgument:
|
56
|
+
Exclude:
|
57
|
+
- '**/*.md'
|
58
|
+
- '**/*.markdown'
|
59
|
+
|
60
|
+
Lint/UnusedBlockArgument:
|
61
|
+
Exclude:
|
62
|
+
- '**/*.md'
|
63
|
+
- '**/*.markdown'
|
64
|
+
|
25
65
|
Lint/UselessAssignment:
|
26
66
|
Exclude:
|
27
67
|
- '**/*.md'
|
28
68
|
- '**/*.markdown'
|
29
69
|
|
70
|
+
Lint/UselessMethodDefinition:
|
71
|
+
Exclude:
|
72
|
+
- '**/*.md'
|
73
|
+
- '**/*.markdown'
|
74
|
+
|
75
|
+
Lint/UselessAccessModifier:
|
76
|
+
Exclude:
|
77
|
+
- '**/*.md'
|
78
|
+
- '**/*.markdown'
|
79
|
+
|
80
|
+
Lint/Void:
|
81
|
+
Exclude:
|
82
|
+
- '**/*.md'
|
83
|
+
- '**/*.markdown'
|
84
|
+
|
30
85
|
Naming/FileName:
|
31
86
|
Exclude:
|
32
87
|
- '**/*.md'
|
@@ -73,8 +73,8 @@ module RuboCop
|
|
73
73
|
walker = Walker.new
|
74
74
|
|
75
75
|
parts.each do |part|
|
76
|
-
if walker.code_body?
|
77
|
-
next walker.next!
|
76
|
+
if walker.code_body? && maybe_ruby?(@syntax) && valid_syntax?(@syntax, part)
|
77
|
+
next walker.next!
|
78
78
|
end
|
79
79
|
|
80
80
|
if walker.code_attr?
|
@@ -2,10 +2,24 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Markdown # :nodoc:
|
5
|
-
|
5
|
+
# According to Linguist.
|
6
|
+
# See https://github.com/github/linguist/blob/96ca71ab99c2f9928d5d69f4c08fd2a51440d045/lib/linguist/languages.yml#L3065-L3083
|
7
|
+
MARKDOWN_EXTENSIONS = %w[
|
8
|
+
.md
|
9
|
+
.markdown
|
10
|
+
.mdown
|
11
|
+
.mdwn
|
12
|
+
.mdx
|
13
|
+
.mkd
|
14
|
+
.mkdn
|
15
|
+
.mkdown
|
16
|
+
.ronn
|
17
|
+
.workbook
|
18
|
+
].freeze
|
6
19
|
|
7
20
|
class << self
|
8
21
|
attr_accessor :config_store
|
22
|
+
|
9
23
|
# Merge markdown config into default configuration
|
10
24
|
# See https://github.com/backus/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
11
25
|
def inject!
|
@@ -64,7 +78,7 @@ RuboCop::ProcessedSource.prepend(Module.new do
|
|
64
78
|
def parse(src, *args)
|
65
79
|
# only process Markdown files
|
66
80
|
src = RuboCop::Markdown::Preprocess.new(path).call(src) if
|
67
|
-
path
|
81
|
+
path && RuboCop::Markdown.markdown_file?(path)
|
68
82
|
super(src, *args)
|
69
83
|
end
|
70
84
|
end)
|
data/rubocop-md.gemspec
CHANGED
@@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
|
|
25
25
|
"source_code_uri" => "http://github.com/rubocop-hq/rubocop-md"
|
26
26
|
}
|
27
27
|
|
28
|
-
spec.required_ruby_version = ">= 2.
|
28
|
+
spec.required_ruby_version = ">= 2.5.0"
|
29
29
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.add_runtime_dependency "rubocop", "
|
32
|
+
spec.add_runtime_dependency "rubocop", ">= 1.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "bundler", ">= 1.15"
|
35
|
-
spec.add_development_dependency "rake", "
|
35
|
+
spec.add_development_dependency "rake", ">= 13.0"
|
36
36
|
spec.add_development_dependency "minitest", "~> 5.0"
|
37
37
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +75,9 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".gem_release.yml"
|
78
|
+
- ".github/workflows/lint.yml"
|
79
|
+
- ".github/workflows/test-jruby.yml"
|
80
|
+
- ".github/workflows/test.yml"
|
78
81
|
- ".gitignore"
|
79
82
|
- ".rubocop.yml"
|
80
83
|
- ".travis.yml"
|
@@ -83,7 +86,6 @@ files:
|
|
83
86
|
- LICENSE.txt
|
84
87
|
- README.md
|
85
88
|
- Rakefile
|
86
|
-
- bin/setup
|
87
89
|
- config/default.yml
|
88
90
|
- gemfiles/rubocopmaster.gemfile
|
89
91
|
- lib/rubocop-md.rb
|
@@ -109,14 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
111
|
requirements:
|
110
112
|
- - ">="
|
111
113
|
- !ruby/object:Gem::Version
|
112
|
-
version: 2.
|
114
|
+
version: 2.5.0
|
113
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
116
|
requirements:
|
115
117
|
- - ">="
|
116
118
|
- !ruby/object:Gem::Version
|
117
119
|
version: '0'
|
118
120
|
requirements: []
|
119
|
-
rubygems_version: 3.0.
|
121
|
+
rubygems_version: 3.0.6
|
120
122
|
signing_key:
|
121
123
|
specification_version: 4
|
122
124
|
summary: Run Rubocop against your Markdown files to make sure that code examples follow
|