Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 2359c12

Browse files
authored
Adding Super Linter (#7864)
1 parent 05bebb6 commit 2359c12

File tree

109 files changed

+465
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+465
-486
lines changed

.github/linters/.markdownlint.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"default": false,
3+
"MD001": true,
4+
"MD003": { "style": "atx" },
5+
"MD004": true,
6+
"MD005": true,
7+
"MD006": true,
8+
"MD007": { "indent": 3 },
9+
"MD009": true,
10+
"MD010": true,
11+
"MD012": true,
12+
"MD018": true,
13+
"MD019": true,
14+
"MD023": true,
15+
"MD025": true,
16+
"MD029": true,
17+
"MD030": { "ol_single": 1, "ol_multi": 1, "ul_single": 2, "ul_multi": 2 },
18+
"MD032": true,
19+
"MD035": true,
20+
"MD036": true,
21+
"MD037": true,
22+
"MD038": true,
23+
"MD040": true,
24+
"MD046": { "style": "fenced"}
25+
}

.github/linters/.ruby-lint.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
#######################
3+
# Rubocop Config file #
4+
#######################
5+
6+
inherit_gem:
7+
rubocop-github:
8+
- config/default.yml
9+
10+
Style/StringLiterals:
11+
EnforcedStyle: single_quotes

.github/workflows/linter.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
###########################
3+
###########################
4+
## Linter GitHub Actions ##
5+
###########################
6+
###########################
7+
name: Lint Code Base
8+
9+
#
10+
# Documentation:
11+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
12+
#
13+
14+
#############################
15+
# Start the job on all push #
16+
#############################
17+
on:
18+
pull_request:
19+
branches:
20+
- master
21+
- 2.*-develop
22+
23+
###############
24+
# Set the Job #
25+
###############
26+
jobs:
27+
28+
build:
29+
# Name the Job
30+
name: Lint Code Base
31+
# Set the agent to run on
32+
runs-on: ubuntu-latest
33+
34+
##################
35+
# Load all steps #
36+
##################
37+
steps:
38+
##########################
39+
# Checkout the code base #
40+
##########################
41+
- name: Checkout Code
42+
uses: actions/checkout@v2
43+
44+
################################
45+
# Run Linter against code base #
46+
################################
47+
- name: Lint Code Base
48+
uses: github/super-linter@v3
49+
env:
50+
VALIDATE_ALL_CODEBASE: false
51+
DEFAULT_BRANCH: master
52+
VALIDATE_HTML: false
53+
VALIDATE_MD: false

.markdownlint.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github/linters/.markdownlint.json

Gemfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ source 'https://rubygems.org'
44

55
gem 'devdocs', git: 'https://github.com/magento-devdocs/devdocs-theme.git'
66
gem 'jekyll'
7-
gem 'whatsup_github'
87
gem 'rake'
8+
gem 'whatsup_github'
99

1010
gem 'wdm', platform: :mswin
1111

1212
group :test do
1313
gem 'html-proofer'
14-
gem 'mdl'
1514
gem 'launchy'
15+
gem 'mdl'
1616
end
1717

1818
group :optimization do
@@ -22,9 +22,9 @@ end
2222

2323
group :jekyll_plugins do
2424
gem 'jekyll-algolia', '~> 1.0'
25+
gem 'jekyll-optional-front-matter'
2526
gem 'jekyll-redirect-from'
27+
gem 'jekyll-relative-links'
2628
gem 'jekyll-sitemap'
2729
gem 'jekyll-titles-from-headings'
28-
gem 'jekyll-relative-links'
29-
gem 'jekyll-optional-front-matter'
3030
end

Rakefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ desc 'Generate data for a news digest. Default timeframe is a week since today.
7171
task :whatsnew do
7272
date = ENV['since']
7373
print 'Generating data for the weekly digest: $ '.magenta
74-
if date.nil? or date.empty?
74+
if date.nil? || date.empty?
7575
sh 'bin/whatsup_github'
7676
elsif date.is_a? String
7777
sh 'bin/whatsup_github', 'since', ENV['since'].to_s
@@ -84,8 +84,8 @@ desc 'Generate index for Algolia'
8484
task index: %w[init] do
8585
puts 'Generating index for Algolia ...'
8686
sh 'bin/jekyll',
87-
'algolia',
88-
'--config=_config.yml,_config.index.yml'
87+
'algolia',
88+
'--config=_config.yml,_config.index.yml'
8989
end
9090

9191
desc 'Convert HTML text to kramdown in your terminal'
@@ -94,4 +94,4 @@ task :convert do
9494
result = `bin/kramdown --input=html --output=kramdown`
9595
puts 'Converted text:'.magenta
9696
puts result.bold
97-
end
97+
end

_plugins/algolia.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
# frozen_string_literal: true
2+
13
# Copyright © Magento, Inc. All rights reserved.
24
# See COPYING.txt for license details.
35

46
module Jekyll
57
module Algolia
68
module Hooks
7-
def self.before_indexing_each(record, node, context)
9+
def self.before_indexing_each(record, _node, _context)
810
# Do not index records larger than 20000 bytes
9-
return nil if record.to_s.bytesize > 20000
10-
11+
return nil if record.to_s.bytesize > 20_000
12+
1113
record
1214
end
1315
end

_plugins/liquid-tags/collapsible.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Copyright © Magento, Inc. All rights reserved.
24
# See COPYING.txt for license details.
35

@@ -30,7 +32,7 @@ def render(context)
3032
<b class="collapsible-title">#{@title}</b>
3133
<div class="collapsible-content">#{content}</div>
3234
</div>
33-
HTML
35+
HTML
3436
end
3537
end
3638

@@ -58,7 +60,7 @@ def render(context)
5860
<h2 class="collapsible-title">#{@title}</h2>
5961
<div class="collapsible-content">#{content}</div>
6062
</div>
61-
HTML
63+
HTML
6264
end
6365
end
6466

@@ -85,7 +87,7 @@ def render(context)
8587
<h3 class="collapsible-title">#{@title}</h3>
8688
<div class="collapsible-content">#{content}</div>
8789
</div>
88-
HTML
90+
HTML
8991
end
9092
end
9193
end

_plugins/page-params/github-path.rb renamed to _plugins/page-params/github_path.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
# The parameter contains a file path relative to its repository.
1111
#
1212
Jekyll::Hooks.register :pages, :post_init do |page|
13-
1413
# Skip virtual pages like MRG topics
15-
next if page.kind_of? Jekyll::PageWithoutAFile
14+
next if page.is_a? Jekyll::PageWithoutAFile
1615
# Process only files with 'md' and 'html' extensions
1716
next unless File.extname(page.path).match?(/md|html/)
1817
# Skip redirects
@@ -22,7 +21,7 @@
2221
page.site.source,
2322
File.dirname(page.path)
2423
)
25-
24+
2625
filename = File.basename page.path
2726

2827
# Change to the parent directory of the page and read full file path

_plugins/page-params/last-modified-at.rb renamed to _plugins/page-params/last_modified_at.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
next if page.data['last_modified_at']
2626

2727
# Skip pages created by custom generators like 'mrg_pages'
28-
next if page.kind_of? Jekyll::PageWithoutAFile
28+
next if page.is_a? Jekyll::PageWithoutAFile
2929

3030
# Add site.source to the page path
3131
file_path = File.join(page.site.source, page.path)
32-
32+
3333
# Get real path of the page. If this is a symlink read it to get path of the real file with content.
3434
real_filepath = File.realpath(file_path)
3535

_plugins/page-params/page-baseurl-generator.rb renamed to _plugins/page-params/page_baseurl_generator.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Copyright © Magento, Inc. All rights reserved.
24
# See COPYING.txt for license details.
35

_plugins/page-params/page-canonical-url.rb renamed to _plugins/page-params/page_canonical_url.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Copyright © Magento, Inc. All rights reserved.
24
# See COPYING.txt for license details.
35

_plugins/page-params/page-versionless.rb renamed to _plugins/page-params/page_versionless.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
filtering_pattern = '/guides/v'
1818

1919
next if page.url.start_with? filtering_pattern
20-
20+
2121
page.data['versionless'] = true
22-
end
22+
end

_plugins/page-params/page-versions.rb renamed to _plugins/page-params/page_versions.rb

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
urls_filtered_by_pattern =
3030
pages.select do |site_page|
3131
next if site_page.name == 'redirect.html'
32+
3233
site_page.url.start_with? filtering_pattern
3334
end.map(&:url)
3435

bin/htmlproofer

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require "pathname"
12-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13-
Pathname.new(__FILE__).realpath)
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path("../bundle", __FILE__)
15+
bundle_binstub = File.expand_path('bundle', __dir__)
1616

1717
if File.file?(bundle_binstub)
1818
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
2323
end
2424
end
2525

26-
require "rubygems"
27-
require "bundler/setup"
26+
require 'rubygems'
27+
require 'bundler/setup'
2828

29-
load Gem.bin_path("html-proofer", "htmlproofer")
29+
load Gem.bin_path('html-proofer', 'htmlproofer')

bin/image_optim

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require "pathname"
12-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13-
Pathname.new(__FILE__).realpath)
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path("../bundle", __FILE__)
15+
bundle_binstub = File.expand_path('bundle', __dir__)
1616

1717
if File.file?(bundle_binstub)
1818
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
2323
end
2424
end
2525

26-
require "rubygems"
27-
require "bundler/setup"
26+
require 'rubygems'
27+
require 'bundler/setup'
2828

29-
load Gem.bin_path("image_optim", "image_optim")
29+
load Gem.bin_path('image_optim', 'image_optim')

bin/jekyll

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# This file was generated by Bundler.
46
#
@@ -7,8 +9,8 @@
79
#
810

911
require 'pathname'
10-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11-
Pathname.new(__FILE__).realpath)
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
1214

1315
require 'rubygems'
1416
require 'bundler/setup'

bin/kramdown

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require "pathname"
12-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13-
Pathname.new(__FILE__).realpath)
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path("../bundle", __FILE__)
15+
bundle_binstub = File.expand_path('bundle', __dir__)
1616

1717
if File.file?(bundle_binstub)
1818
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
2323
end
2424
end
2525

26-
require "rubygems"
27-
require "bundler/setup"
26+
require 'rubygems'
27+
require 'bundler/setup'
2828

29-
load Gem.bin_path("kramdown", "kramdown")
29+
load Gem.bin_path('kramdown', 'kramdown')

bin/mdl

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
# this file is here to facilitate running it.
99
#
1010

11-
require "pathname"
12-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13-
Pathname.new(__FILE__).realpath)
11+
require 'pathname'
12+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13+
Pathname.new(__FILE__).realpath)
1414

15-
bundle_binstub = File.expand_path("../bundle", __FILE__)
15+
bundle_binstub = File.expand_path('bundle', __dir__)
1616

1717
if File.file?(bundle_binstub)
1818
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
2323
end
2424
end
2525

26-
require "rubygems"
27-
require "bundler/setup"
26+
require 'rubygems'
27+
require 'bundler/setup'
2828

29-
load Gem.bin_path("mdl", "mdl")
29+
load Gem.bin_path('mdl', 'mdl')

0 commit comments

Comments
 (0)