rubocop-md 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -3
- data/lib/rubocop/markdown/preprocess.rb +2 -2
- data/lib/rubocop/markdown/rubocop_ext.rb +3 -2
- data/lib/rubocop/markdown/version.rb +1 -1
- data/lib/rubocop/markdown.rb +2 -2
- metadata +8 -19
- data/.gem_release.yml +0 -3
- data/.github/workflows/lint.yml +0 -41
- data/.github/workflows/test-jruby.yml +0 -24
- data/.github/workflows/test.yml +0 -40
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -63
- data/.travis.yml +0 -33
- data/Gemfile +0 -12
- data/Rakefile +0 -14
- data/gemfiles/rubocopmaster.gemfile +0 -5
- data/rubocop-md.gemspec +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e4b62aa5ac22f5dd82b132acd7439582c1d7e4a925d8a44cfeb48f250d579aa
|
4
|
+
data.tar.gz: 5acca30ab4a740b8bb9fdd25bd1b769f96504a63c8f6e4d3460ddfe61c66dbcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb68e5947593be1fce3b2c7131d7a445615b3a9a47c86db9e5b5e31ba966e0c4f7030c20578e140cfe1f55b824e1224a6a2ef3206317db51fa7bd89b60d93e52
|
7
|
+
data.tar.gz: '0138f08797108912f2fdcc4b68fbff18e1def69a35a133d94a4cdc409f1a12f695ca8d155df4f3349fa99da0a551b9863a47e61b9984609ef2d815e553969a20'
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 1.2.1 (2023-10-20)
|
6
|
+
|
7
|
+
- Fix incompatibility when loading the plugin from YAML and using other RuboCop options.
|
8
|
+
|
9
|
+
## 1.2.0 (2023-01-31)
|
10
|
+
|
11
|
+
- Fix parsing compound syntax hints in code snippets.
|
12
|
+
|
13
|
+
- Drop Ruby 2.5 support.
|
14
|
+
|
5
15
|
## 1.1.0 (2022-10-24)
|
6
16
|
|
7
17
|
- Ignore offenses in non-code source.
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
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
@@ -12,7 +12,12 @@ 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/test-prof/test-prof) guides consistent with Ruby style guide.
|
15
|
+
This project was developed to keep [test-prof](https://github.com/test-prof/test-prof) guides consistent with Ruby style guide back in 2017. Since then, many popular Ruby projects adopted it, including:
|
16
|
+
|
17
|
+
- [Ruby on Rails](https://github.com/rails/rails)
|
18
|
+
- [AnyCable](https://github.com/anycable/anycable)
|
19
|
+
- [ViewComponent](https://github.com/ViewComponent/view_component)
|
20
|
+
- [Action Policy](https://github.com/palkan/action_policy)
|
16
21
|
|
17
22
|
## Installation
|
18
23
|
|
@@ -111,7 +116,7 @@ Lint/Void:
|
|
111
116
|
|
112
117
|
You can use this tricks
|
113
118
|
|
114
|
-
|
119
|
+
````md
|
115
120
|
# my_post.md
|
116
121
|
|
117
122
|
... some markdown ...
|
@@ -129,7 +134,7 @@ end of snippet
|
|
129
134
|
<span style="display:none;"># rubocop:enable all</span>
|
130
135
|
|
131
136
|
... continuation of article ...
|
132
|
-
|
137
|
+
````
|
133
138
|
|
134
139
|
## How it works?
|
135
140
|
|
@@ -11,8 +11,8 @@ module RuboCop
|
|
11
11
|
#
|
12
12
|
# Only recognizes backticks-style code blocks.
|
13
13
|
#
|
14
|
-
# Try it:
|
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
|
|
@@ -42,9 +42,10 @@ RuboCop::Markdown.inject!
|
|
42
42
|
|
43
43
|
RuboCop::Runner.prepend(Module.new do
|
44
44
|
# Set config store for Markdown
|
45
|
-
def
|
45
|
+
def get_processed_source(*args)
|
46
|
+
RuboCop::Markdown.config_store = @config_store unless RuboCop::Markdown.config_store
|
47
|
+
|
46
48
|
super
|
47
|
-
RuboCop::Markdown.config_store = @config_store
|
48
49
|
end
|
49
50
|
|
50
51
|
# Do not cache markdown files, 'cause cache doesn't know about processing.
|
data/lib/rubocop/markdown.rb
CHANGED
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
10
10
|
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
|
11
11
|
|
12
|
-
require_relative "
|
13
|
-
require_relative "
|
12
|
+
require_relative "markdown/preprocess"
|
13
|
+
require_relative "markdown/rubocop_ext" if defined?(::RuboCop::ProcessedSource)
|
14
14
|
end
|
15
15
|
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.1
|
4
|
+
version: 1.2.1
|
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:
|
11
|
+
date: 2023-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -74,27 +74,16 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".gem_release.yml"
|
78
|
-
- ".github/workflows/lint.yml"
|
79
|
-
- ".github/workflows/test-jruby.yml"
|
80
|
-
- ".github/workflows/test.yml"
|
81
|
-
- ".gitignore"
|
82
|
-
- ".rubocop.yml"
|
83
|
-
- ".travis.yml"
|
84
77
|
- CHANGELOG.md
|
85
|
-
- Gemfile
|
86
78
|
- LICENSE.txt
|
87
79
|
- README.md
|
88
|
-
- Rakefile
|
89
80
|
- config/default.yml
|
90
|
-
- gemfiles/rubocopmaster.gemfile
|
91
81
|
- lib/rubocop-md.rb
|
92
82
|
- lib/rubocop/markdown.rb
|
93
83
|
- lib/rubocop/markdown/preprocess.rb
|
94
84
|
- lib/rubocop/markdown/rubocop_ext.rb
|
95
85
|
- lib/rubocop/markdown/version.rb
|
96
|
-
|
97
|
-
homepage: https://github.com/palkan/rubocop-md
|
86
|
+
homepage: https://github.com/rubocop-hq/rubocop-md
|
98
87
|
licenses:
|
99
88
|
- MIT
|
100
89
|
metadata:
|
@@ -103,7 +92,7 @@ metadata:
|
|
103
92
|
documentation_uri: https://github.com/rubocop-hq/rubocop-md/blob/master/README.md
|
104
93
|
homepage_uri: https://github.com/rubocop-hq/rubocop-md
|
105
94
|
source_code_uri: http://github.com/rubocop-hq/rubocop-md
|
106
|
-
post_install_message:
|
95
|
+
post_install_message:
|
107
96
|
rdoc_options: []
|
108
97
|
require_paths:
|
109
98
|
- lib
|
@@ -111,15 +100,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
100
|
requirements:
|
112
101
|
- - ">="
|
113
102
|
- !ruby/object:Gem::Version
|
114
|
-
version: 2.
|
103
|
+
version: 2.6.0
|
115
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
105
|
requirements:
|
117
106
|
- - ">="
|
118
107
|
- !ruby/object:Gem::Version
|
119
108
|
version: '0'
|
120
109
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
122
|
-
signing_key:
|
110
|
+
rubygems_version: 3.4.20
|
111
|
+
signing_key:
|
123
112
|
specification_version: 4
|
124
113
|
summary: Run Rubocop against your Markdown files to make sure that code examples follow
|
125
114
|
style guidelines.
|
data/.gem_release.yml
DELETED
data/.github/workflows/lint.yml
DELETED
@@ -1,41 +0,0 @@
|
|
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: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: 2.7
|
21
|
-
bundler-cache: true
|
22
|
-
- name: Run Rubocop
|
23
|
-
run: |
|
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
|
@@ -1,24 +0,0 @@
|
|
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: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: jruby
|
21
|
-
bundler-cache: true
|
22
|
-
- name: Run tests
|
23
|
-
run: |
|
24
|
-
bundle exec rake test
|
data/.github/workflows/test.yml
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
name: Test
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
pull_request:
|
8
|
-
schedule:
|
9
|
-
- cron: "10 4 * * */2"
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test:
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
env:
|
15
|
-
BUNDLE_JOBS: 4
|
16
|
-
BUNDLE_RETRY: 3
|
17
|
-
CI: true
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: ["2.7", "3.0", "3.1", ruby-head]
|
22
|
-
gemfile: [
|
23
|
-
"Gemfile"
|
24
|
-
]
|
25
|
-
include:
|
26
|
-
- ruby: "2.5"
|
27
|
-
gemfile: "Gemfile"
|
28
|
-
- ruby: "2.6"
|
29
|
-
gemfile: "Gemfile"
|
30
|
-
- ruby: "3.1"
|
31
|
-
gemfile: "gemfiles/rubocopmaster.gemfile"
|
32
|
-
steps:
|
33
|
-
- uses: actions/checkout@v2
|
34
|
-
- uses: ruby/setup-ruby@v1
|
35
|
-
with:
|
36
|
-
ruby-version: ${{ matrix.ruby }}
|
37
|
-
bundler-cache: true
|
38
|
-
- name: Run tests
|
39
|
-
run: |
|
40
|
-
bundle exec rake test
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
NewCops: enable
|
3
|
-
Include:
|
4
|
-
- 'lib/**/*.rb'
|
5
|
-
- 'lib/**/*.rake'
|
6
|
-
- 'test/**/*.rb'
|
7
|
-
Exclude:
|
8
|
-
- 'bin/**/*'
|
9
|
-
- 'vendor/**/*'
|
10
|
-
- 'tmp/**/*'
|
11
|
-
- 'Rakefile'
|
12
|
-
- 'Gemfile'
|
13
|
-
- '*.gemspec'
|
14
|
-
DisplayCopNames: true
|
15
|
-
StyleGuideCopsOnly: false
|
16
|
-
TargetRubyVersion: 2.5
|
17
|
-
SuggestExtensions: false
|
18
|
-
|
19
|
-
Style/Documentation:
|
20
|
-
Exclude:
|
21
|
-
- 'test/**/*.rb'
|
22
|
-
|
23
|
-
Style/StringLiterals:
|
24
|
-
EnforcedStyle: double_quotes
|
25
|
-
|
26
|
-
Style/RegexpLiteral:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/ClassAndModuleChildren:
|
30
|
-
Exclude:
|
31
|
-
- 'test/**/*.rb'
|
32
|
-
|
33
|
-
Style/HashEachMethods:
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
Style/HashTransformKeys:
|
37
|
-
Enabled: true
|
38
|
-
|
39
|
-
Style/HashTransformValues:
|
40
|
-
Enabled: true
|
41
|
-
|
42
|
-
Layout/EmptyLinesAroundArguments:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Layout/SpaceInsideStringInterpolation:
|
46
|
-
EnforcedStyle: no_space
|
47
|
-
|
48
|
-
Naming/FileName:
|
49
|
-
Exclude:
|
50
|
-
- 'lib/rubocop-md.rb'
|
51
|
-
|
52
|
-
Layout/LineLength:
|
53
|
-
Max: 100
|
54
|
-
Exclude:
|
55
|
-
- 'test/**/*.rb'
|
56
|
-
|
57
|
-
Metrics/MethodLength:
|
58
|
-
Exclude:
|
59
|
-
- 'test/**/*.rb'
|
60
|
-
|
61
|
-
Metrics/ClassLength:
|
62
|
-
Exclude:
|
63
|
-
- 'test/**/*.rb'
|
data/.travis.yml
DELETED
@@ -1,33 +0,0 @@
|
|
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/Gemfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in rubocop-md.gemspec
|
6
|
-
gemspec
|
7
|
-
|
8
|
-
local_gemfile = "Gemfile.local"
|
9
|
-
|
10
|
-
if File.exist?(local_gemfile)
|
11
|
-
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
|
12
|
-
end
|
data/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
require "rubocop/rake_task"
|
4
|
-
|
5
|
-
Rake::TestTask.new(:test) do |t|
|
6
|
-
t.libs << "test"
|
7
|
-
t.libs << "lib"
|
8
|
-
t.warning = false
|
9
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
-
end
|
11
|
-
|
12
|
-
RuboCop::RakeTask.new
|
13
|
-
|
14
|
-
task default: [:rubocop, :test]
|
data/rubocop-md.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "rubocop/markdown/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rubocop-md"
|
7
|
-
spec.version = RuboCop::Markdown::VERSION
|
8
|
-
spec.authors = ["Vladimir Dementyev"]
|
9
|
-
spec.email = ["dementiev.vm@gmail.com"]
|
10
|
-
|
11
|
-
spec.summary = %q{Run Rubocop against your Markdown files to make sure that code examples follow style guidelines.}
|
12
|
-
spec.description = %q{Run Rubocop against your Markdown files to make sure that code examples follow style guidelines.}
|
13
|
-
spec.homepage = "https://github.com/palkan/rubocop-md"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features)/})
|
18
|
-
end
|
19
|
-
|
20
|
-
spec.metadata = {
|
21
|
-
"bug_tracker_uri" => "http://github.com/rubocop-hq/rubocop-md/issues",
|
22
|
-
"changelog_uri" => "https://github.com/rubocop-hq/rubocop-md/blob/master/CHANGELOG.md",
|
23
|
-
"documentation_uri" => "https://github.com/rubocop-hq/rubocop-md/blob/master/README.md",
|
24
|
-
"homepage_uri" => "https://github.com/rubocop-hq/rubocop-md",
|
25
|
-
"source_code_uri" => "http://github.com/rubocop-hq/rubocop-md"
|
26
|
-
}
|
27
|
-
|
28
|
-
spec.required_ruby_version = ">= 2.5.0"
|
29
|
-
|
30
|
-
spec.require_paths = ["lib"]
|
31
|
-
|
32
|
-
spec.add_runtime_dependency "rubocop", ">= 1.0"
|
33
|
-
|
34
|
-
spec.add_development_dependency "bundler", ">= 1.15"
|
35
|
-
spec.add_development_dependency "rake", ">= 13.0"
|
36
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
37
|
-
end
|