rubocop-md 1.0.1 → 1.1.0
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 +18 -10
- data/.github/workflows/test-jruby.yml +1 -11
- data/.github/workflows/test.yml +5 -14
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -2
- data/README.md +6 -4
- data/lib/rubocop/markdown/rubocop_ext.rb +17 -6
- data/lib/rubocop/markdown/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf66c2759aece8c1924b0a8d54752bc9973a5c6435494f996564e60fcb02f19
|
4
|
+
data.tar.gz: 261e4725b749854bc320b7f9b14cd7d1fbabfbb0c179c16e0530ed35ba092f72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09983fd1562ce4d2ec4820799bf662be764910cff9a38c02ef2ef2a8c717b6d07ba25a7536cd36363a124583fe8f39cdaa502a8be58000c788813d5301f63c19'
|
7
|
+
data.tar.gz: 5acf841fdfadd326664bab788a9a3f2f706bce8454af1b177967ebaca8e648c051db9b7cf65129ca58a5d9548d0d365c09f76e05cf1d8abef49a80e930c97439
|
data/.github/workflows/lint.yml
CHANGED
@@ -15,19 +15,27 @@ jobs:
|
|
15
15
|
CI: true
|
16
16
|
steps:
|
17
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
18
|
- uses: ruby/setup-ruby@v1
|
25
19
|
with:
|
26
20
|
ruby-version: 2.7
|
27
|
-
|
28
|
-
run: |
|
29
|
-
bundle config path /home/runner/bundle
|
30
|
-
bundle install
|
21
|
+
bundler-cache: true
|
31
22
|
- name: Run Rubocop
|
32
23
|
run: |
|
33
24
|
bundle exec rubocop
|
25
|
+
rubocop-md:
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
env:
|
28
|
+
BUNDLE_JOBS: 4
|
29
|
+
BUNDLE_RETRY: 3
|
30
|
+
CI: true
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v2
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: 3.1
|
36
|
+
bundler-cache: true
|
37
|
+
- name: Run Rubocop
|
38
|
+
run: |
|
39
|
+
bundle exec rubocop -r./lib/rubocop-md.rb README.md CHANGELOG.md
|
40
|
+
git status
|
41
|
+
git diff --exit-code
|
@@ -15,20 +15,10 @@ jobs:
|
|
15
15
|
CI: true
|
16
16
|
steps:
|
17
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
18
|
- uses: ruby/setup-ruby@v1
|
25
19
|
with:
|
26
20
|
ruby-version: jruby
|
27
|
-
|
28
|
-
run: |
|
29
|
-
bundle config path /home/runner/bundle
|
30
|
-
bundle install
|
31
|
-
bundle update
|
21
|
+
bundler-cache: true
|
32
22
|
- name: Run tests
|
33
23
|
run: |
|
34
24
|
bundle exec rake test
|
data/.github/workflows/test.yml
CHANGED
@@ -5,6 +5,8 @@ on:
|
|
5
5
|
branches:
|
6
6
|
- master
|
7
7
|
pull_request:
|
8
|
+
schedule:
|
9
|
+
- cron: "10 4 * * */2"
|
8
10
|
|
9
11
|
jobs:
|
10
12
|
test:
|
@@ -16,7 +18,7 @@ jobs:
|
|
16
18
|
strategy:
|
17
19
|
fail-fast: false
|
18
20
|
matrix:
|
19
|
-
ruby: ["2.7"]
|
21
|
+
ruby: ["2.7", "3.0", "3.1", ruby-head]
|
20
22
|
gemfile: [
|
21
23
|
"Gemfile"
|
22
24
|
]
|
@@ -25,25 +27,14 @@ jobs:
|
|
25
27
|
gemfile: "Gemfile"
|
26
28
|
- ruby: "2.6"
|
27
29
|
gemfile: "Gemfile"
|
28
|
-
- ruby: "
|
30
|
+
- ruby: "3.1"
|
29
31
|
gemfile: "gemfiles/rubocopmaster.gemfile"
|
30
32
|
steps:
|
31
33
|
- 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
34
|
- uses: ruby/setup-ruby@v1
|
39
35
|
with:
|
40
36
|
ruby-version: ${{ matrix.ruby }}
|
41
|
-
|
42
|
-
run: |
|
43
|
-
bundle config path /home/runner/bundle
|
44
|
-
bundle config --global gemfile ${{ matrix.gemfile }}
|
45
|
-
bundle install
|
46
|
-
bundle update
|
37
|
+
bundler-cache: true
|
47
38
|
- name: Run tests
|
48
39
|
run: |
|
49
40
|
bundle exec rake test
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ This project was developed to keep [test-prof](https://github.com/test-prof/test
|
|
19
19
|
Add this line to your application's Gemfile:
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
gem
|
22
|
+
gem "rubocop-md"
|
23
23
|
```
|
24
24
|
|
25
25
|
And then execute:
|
@@ -96,7 +96,7 @@ $ rubocop
|
|
96
96
|
|
97
97
|
Also you can add special rules in the second `.rubocop.yml`
|
98
98
|
|
99
|
-
```
|
99
|
+
```yml
|
100
100
|
# rubocop.yml in docs folder
|
101
101
|
|
102
102
|
Metrics/LineLength:
|
@@ -111,7 +111,7 @@ Lint/Void:
|
|
111
111
|
|
112
112
|
You can use this tricks
|
113
113
|
|
114
|
-
```
|
114
|
+
```md
|
115
115
|
# my_post.md
|
116
116
|
|
117
117
|
... some markdown ...
|
@@ -122,7 +122,9 @@ You can use this tricks
|
|
122
122
|
def my_poor_method(foo)
|
123
123
|
[:a, :b, :c] + ["#{foo}".to_sym]
|
124
124
|
end
|
125
|
-
```
|
125
|
+
```
|
126
|
+
|
127
|
+
end of snippet
|
126
128
|
|
127
129
|
<span style="display:none;"># rubocop:enable all</span>
|
128
130
|
|
@@ -55,14 +55,25 @@ RuboCop::Runner.prepend(Module.new do
|
|
55
55
|
super
|
56
56
|
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
def inspect_file(*args)
|
59
|
+
super.tap do |(offenses, *)|
|
60
|
+
# Skip offenses reported for ignored MD source (trailing whitespaces, etc.)
|
61
|
+
marker_comment = "##{RuboCop::Markdown::Preprocess::MARKER}"
|
62
|
+
offenses.reject! do |offense|
|
63
|
+
offense.location.source_line.start_with?(marker_comment)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
61
67
|
|
62
|
-
|
63
|
-
RuboCop::Markdown
|
68
|
+
def file_finished(file, offenses)
|
69
|
+
return super unless RuboCop::Markdown.markdown_file?(file)
|
70
|
+
|
71
|
+
# Run Preprocess.restore if file has been autocorrected
|
72
|
+
if @options[:auto_correct] || @options[:autocorrect]
|
73
|
+
RuboCop::Markdown::Preprocess.restore!(file)
|
74
|
+
end
|
64
75
|
|
65
|
-
offenses
|
76
|
+
super(file, offenses)
|
66
77
|
end
|
67
78
|
end)
|
68
79
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
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: 2022-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.3.7
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Run Rubocop against your Markdown files to make sure that code examples follow
|