rubocop-md 1.0.1 → 1.2.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: 481459568a982c49d109a7514bc891f22acf485a22954372eae24fb94e7543bc
4
+ data.tar.gz: 9af60abc5f0fc512eeeba617cf52b12ce471db0ff0b39e452f2e5ac246dad51a
5
5
  SHA512:
6
- metadata.gz: b97928bbbf89b26e887baae4220f7db61f88897bc1e96bdaf623df188c0345839e49ccb9d66bb0569ef98a69efd6e7127fb9b760bf416c16909a79b367c93893
7
- data.tar.gz: 63a5bc235da592a26613f1ada3a2992e0d0c878b2576909e35f0a65cbfeced0faf9e0fe69dbd2bb6e381cb3c24d9b40870c8d3461714655f7d133463ac759f3d
6
+ metadata.gz: 8f7b69a5a9bb3aec08882635b3746ed6aececc5c485b3d228564c66bc41fbb06935b1574b69027fb18c7fdd1c6515a17e8f7f1a99e83b8b9ad2b1daa4de06bd2
7
+ data.tar.gz: 2917282ce852086f06facda93acdd037a5782f217376b709c00ab05a0805bf72c4e7ac67520e2a99ed60a17dbd7339eb74b57e9564fad65d96956a5326724574
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'weekly'
@@ -14,20 +14,28 @@ jobs:
14
14
  BUNDLE_RETRY: 3
15
15
  CI: true
16
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-
17
+ - uses: actions/checkout@v3
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@v3
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
@@ -14,21 +14,11 @@ jobs:
14
14
  BUNDLE_RETRY: 3
15
15
  CI: true
16
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-
17
+ - uses: actions/checkout@v3
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,34 +18,21 @@ jobs:
16
18
  strategy:
17
19
  fail-fast: false
18
20
  matrix:
19
- ruby: ["2.7"]
21
+ ruby: ["2.7", "3.0", "3.1", "3.2", ruby-head]
20
22
  gemfile: [
21
23
  "Gemfile"
22
24
  ]
23
25
  include:
24
- - ruby: "2.5"
25
- gemfile: "Gemfile"
26
26
  - ruby: "2.6"
27
27
  gemfile: "Gemfile"
28
- - ruby: "2.7"
28
+ - ruby: "3.1"
29
29
  gemfile: "gemfiles/rubocopmaster.gemfile"
30
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 }}-
31
+ - uses: actions/checkout@v3
38
32
  - uses: ruby/setup-ruby@v1
39
33
  with:
40
34
  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
35
+ bundler-cache: true
47
36
  - name: Run tests
48
37
  run: |
49
38
  bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.2.0 (2023-01-31)
6
+
7
+ - Fix parsing compound syntax hints in code snippets.
8
+
9
+ - Drop Ruby 2.5 support.
10
+
11
+ ## 1.1.0 (2022-10-24)
12
+
13
+ - Ignore offenses in non-code source.
14
+
5
15
  ## 1.0.1 (2020-12-28)
6
16
 
7
17
  - 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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017-2021 Vladimir Dementyev
3
+ Copyright (c) 2017-2023 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
@@ -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
 
@@ -11,8 +11,8 @@ module RuboCop
11
11
  #
12
12
  # Only recognizes backticks-style code blocks.
13
13
  #
14
- # Try it: http://rubular.com/r/iJaKBkSrrT
15
- MD_REGEXP = /^([ \t]*`{3,4})([\w[[:blank:]]]*\n)([\s\S]+?)(^[ \t]*\1[[:blank:]]*\n?)/m.freeze
14
+ # Try it: https://rubular.com/r/YMqSWiBuh2TKIJ
15
+ MD_REGEXP = /^([ \t]*`{3,4})([\w[[:blank:]]+]*\n)([\s\S]+?)(^[ \t]*\1[[:blank:]]*\n?)/m.freeze
16
16
 
17
17
  MARKER = "<--rubocop/md-->"
18
18
 
@@ -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.2.0"
6
6
  end
7
7
  end
data/rubocop-md.gemspec CHANGED
@@ -25,7 +25,7 @@ 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.5.0"
28
+ spec.required_ruby_version = ">= 2.6.0"
29
29
 
30
30
  spec.require_paths = ["lib"]
31
31
 
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-28 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gem_release.yml"
78
+ - ".github/dependabot.yml"
78
79
  - ".github/workflows/lint.yml"
79
80
  - ".github/workflows/test-jruby.yml"
80
81
  - ".github/workflows/test.yml"
@@ -103,7 +104,7 @@ metadata:
103
104
  documentation_uri: https://github.com/rubocop-hq/rubocop-md/blob/master/README.md
104
105
  homepage_uri: https://github.com/rubocop-hq/rubocop-md
105
106
  source_code_uri: http://github.com/rubocop-hq/rubocop-md
106
- post_install_message:
107
+ post_install_message:
107
108
  rdoc_options: []
108
109
  require_paths:
109
110
  - lib
@@ -111,15 +112,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
112
  requirements:
112
113
  - - ">="
113
114
  - !ruby/object:Gem::Version
114
- version: 2.5.0
115
+ version: 2.6.0
115
116
  required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  requirements:
117
118
  - - ">="
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubygems_version: 3.0.6
122
- signing_key:
122
+ rubygems_version: 3.3.11
123
+ signing_key:
123
124
  specification_version: 4
124
125
  summary: Run Rubocop against your Markdown files to make sure that code examples follow
125
126
  style guidelines.