rubocop-md 1.0.0 → 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: 3456efa614f5cb4f801f7b8b247e53b42022adfcdbffd3fab4752f4698ce321b
4
- data.tar.gz: ac12ebd0c7bed14a4c05afd24bd24f1e463ffa0541dcf8a55353f52fbe3c9afd
3
+ metadata.gz: bbf66c2759aece8c1924b0a8d54752bc9973a5c6435494f996564e60fcb02f19
4
+ data.tar.gz: 261e4725b749854bc320b7f9b14cd7d1fbabfbb0c179c16e0530ed35ba092f72
5
5
  SHA512:
6
- metadata.gz: 5309505cbbf58587a74f8ea7c50435f9258163cbc9ba8e75fa6f4361a92c13d05fe401bec4f8cb7611d26cefdf9a9f9f2adad0e4e1395d000c7d4f0b44f4754b
7
- data.tar.gz: 5cded0021d44ef0bdfb02279eefffd7eed20cf2c5c184c1de65fe9e2559fb86111ae09a96068a271c890f8d1d662c98a875d3d4f8e81af8840a5bfea99d5a1e9
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/.travis.yml ADDED
@@ -0,0 +1,33 @@
1
+ sudo: false
2
+ language: ruby
3
+ before_install:
4
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
5
+ - gem install bundler -v '< 2'
6
+
7
+ notifications:
8
+ email: false
9
+
10
+ matrix:
11
+ fast_finish: true
12
+ include:
13
+ - rvm: ruby-head
14
+ gemfile: gemfiles/rubocopmaster.gemfile
15
+ - rvm: jruby-9.2.8.0
16
+ gemfile: Gemfile
17
+ - rvm: 2.7
18
+ gemfile: gemfiles/rubocopmaster.gemfile
19
+ - rvm: 2.7
20
+ gemfile: Gemfile
21
+ - rvm: 2.6
22
+ gemfile: Gemfile
23
+ - rvm: 2.5
24
+ gemfile: Gemfile
25
+ - rvm: 2.4.2
26
+ gemfile: Gemfile
27
+ allow_failures:
28
+ - rvm: ruby-head
29
+ gemfile: gemfiles/rubocopmaster.gemfile
30
+ - rvm: jruby-9.2.8.0
31
+ gemfile: Gemfile
32
+ - rvm: 2.5.0
33
+ gemfile: gemfiles/rubocopmaster.gemfile
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.1.0 (2022-10-24)
6
+
7
+ - Ignore offenses in non-code source.
8
+
9
+ ## 1.0.1 (2020-12-28)
10
+
11
+ - Exclude `EmptyLineBetweenDefs` for MD files.
12
+
5
13
  ## 1.0.0 (2020-12-24)
6
14
 
7
15
  - Drop Ruby 2.4 support and require RuboCop 1.0.
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
 
data/config/default.yml CHANGED
@@ -22,7 +22,7 @@ Layout/TrailingEmptyLines:
22
22
  - '**/*.md'
23
23
  - '**/*.markdown'
24
24
 
25
- Lint/UselessAssignment:
25
+ Layout/EmptyLineBetweenDefs:
26
26
  Exclude:
27
27
  - '**/*.md'
28
28
  - '**/*.markdown'
@@ -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.0"
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.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: 2020-12-24 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
@@ -80,6 +80,7 @@ files:
80
80
  - ".github/workflows/test.yml"
81
81
  - ".gitignore"
82
82
  - ".rubocop.yml"
83
+ - ".travis.yml"
83
84
  - CHANGELOG.md
84
85
  - Gemfile
85
86
  - LICENSE.txt
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.0.6
121
+ rubygems_version: 3.3.7
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: Run Rubocop against your Markdown files to make sure that code examples follow