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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd427ec8e44c548cc33d0894f4cc8b0375ae3d92cbd5dac2ec0e5d5159cfc8cd
4
- data.tar.gz: 920755489abe9ccb53e04b3386c980ab5b633649c8d0bcbedc566d0219d99f38
3
+ metadata.gz: bbf66c2759aece8c1924b0a8d54752bc9973a5c6435494f996564e60fcb02f19
4
+ data.tar.gz: 261e4725b749854bc320b7f9b14cd7d1fbabfbb0c179c16e0530ed35ba092f72
5
5
  SHA512:
6
- metadata.gz: b97928bbbf89b26e887baae4220f7db61f88897bc1e96bdaf623df188c0345839e49ccb9d66bb0569ef98a69efd6e7127fb9b760bf416c16909a79b367c93893
7
- data.tar.gz: 63a5bc235da592a26613f1ada3a2992e0d0c878b2576909e35f0a65cbfeced0faf9e0fe69dbd2bb6e381cb3c24d9b40870c8d3461714655f7d133463ac759f3d
6
+ metadata.gz: '09983fd1562ce4d2ec4820799bf662be764910cff9a38c02ef2ef2a8c717b6d07ba25a7536cd36363a124583fe8f39cdaa502a8be58000c788813d5301f63c19'
7
+ data.tar.gz: 5acf841fdfadd326664bab788a9a3f2f706bce8454af1b177967ebaca8e648c051db9b7cf65129ca58a5d9548d0d365c09f76e05cf1d8abef49a80e930c97439
@@ -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
- - name: Bundle install
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
- - name: Bundle install
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
@@ -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: "2.7"
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
- - 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
37
+ bundler-cache: true
47
38
  - name: Run tests
48
39
  run: |
49
40
  bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.1.0 (2022-10-24)
6
+
7
+ - Ignore offenses in non-code source.
8
+
5
9
  ## 1.0.1 (2020-12-28)
6
10
 
7
11
  - Exclude `EmptyLineBetweenDefs` for MD files.
data/Gemfile CHANGED
@@ -5,8 +5,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in rubocop-md.gemspec
6
6
  gemspec
7
7
 
8
- gem "pry-byebug", platform: :mri
9
-
10
8
  local_gemfile = "Gemfile.local"
11
9
 
12
10
  if File.exist?(local_gemfile)
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 'rubocop-md'
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
- ```ruby
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
- ``` end of snippet
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
- # Run Preprocess.restore if file has been autocorrected
59
- def process_file(file)
60
- return super unless @options[:auto_correct] && RuboCop::Markdown.markdown_file?(file)
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
- offenses = super
63
- RuboCop::Markdown::Preprocess.restore!(file)
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown
5
- VERSION = "1.0.1"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
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.1
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: 2020-12-28 00:00:00.000000000 Z
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.0.6
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