From fff917cd44ce88aae7852bcfc7db69670861e320 Mon Sep 17 00:00:00 2001 From: Mathieu Rul Date: Sat, 9 Sep 2023 01:57:08 +0200 Subject: [PATCH] Replace old `master` branch with `main` (#460) * Replace `master` with `main` Signed-off-by: Mathieu Rul --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- CHANGELOG.md | 4 ++-- CONTRIBUTING.md | 8 ++++---- docs/rolling_a_release.md | 2 +- lib/mdl/doc.rb | 7 +++---- lib/mdl/rules.rb | 11 +++++------ lib/mdl/style.rb | 2 +- test/fixtures/output/json/with_matches.json | 2 +- test/fixtures/output/sarif/with_matches.sarif | 2 +- test/test_cli.rb | 6 +++--- 10 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index efce25ce..582cf3f9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ ## Related Issues - + ## Types of changes diff --git a/CHANGELOG.md b/CHANGELOG.md index 36c5c99e..bfb58d8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -158,7 +158,7 @@ ### Added * You can now load your own custom rules with the `-u` option. See - [rules.rb](https://github.com/markdownlint/markdownlint/blob/master/lib/mdl/rules.rb) + [rules.rb](https://github.com/markdownlint/markdownlint/blob/main/lib/mdl/rules.rb) for an example of what a rules file looks like. Use the `-d` option if you don't want to load markdownlint's default ruleset. * You can now refer to rules by human-readable/writable aliases, such as @@ -280,7 +280,7 @@ * MD029 - Ordered list item prefix * MD030 - Spaces after list markers -[Unreleased]: https://github.com/markdownlint/markdownlint/tree/master +[Unreleased]: https://github.com/markdownlint/markdownlint/tree/main [v0.12.0]: https://github.com/markdownlint/markdownlint/tree/v0.12.0 [v0.11.0]: https://github.com/markdownlint/markdownlint/tree/v0.11.0 [v0.10.0]: https://github.com/markdownlint/markdownlint/tree/v0.10.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0176604f..550ec075 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ spending time and effort writing code that might not get used. * Check that the issue has not already been reported * Check that the issue has not already been fixed in the latest code - (a.k.a. `master`) + (a.k.a. `main`) * Select the appropriate issue type and open an issue with a descriptive title * Be clear, concise, and precise using grammatically correct, complete sentences in your summary of the problem @@ -98,9 +98,9 @@ respond to your pull request with any feedback they might have. The process at this point is as follows: 1. A review is required from at least one of the project maintainers. See the - master maintainers document for Markdownlint project at - . -1. Your change will be merged into the project's `master` branch, and all + maintainers document for Markdownlint project at + . +1. Your change will be merged into the project's `main` branch, and all [commits will be squashed](https://help.github.com/en/articles/about-pull-request-merges#squash-and-merge-your-pull-request-commits) during the merge. diff --git a/docs/rolling_a_release.md b/docs/rolling_a_release.md index 3f406369..9921f2fa 100644 --- a/docs/rolling_a_release.md +++ b/docs/rolling_a_release.md @@ -9,7 +9,7 @@ Bump the version. Markdownlint uses semantic versioning. From * Exception: Versions < 1.0 may introduce backwards-incompatible changes in a minor version. -To bump the version, edit `lib/mdl/version.rb` and commit to the master branch. +To bump the version, edit `lib/mdl/version.rb` and commit to the main branch. Update the changelog: diff --git a/lib/mdl/doc.rb b/lib/mdl/doc.rb index 6c35678b..1e8459b7 100644 --- a/lib/mdl/doc.rb +++ b/lib/mdl/doc.rb @@ -281,16 +281,15 @@ def extract_as_text(element) # If anything goes amiss here, e.g. unknown type, then nil will be # returned and we'll just not catch that part of the text, which seems # like a sensible failure mode. - lines = element.children.map do |e| - if e.type == :text or e.type == :codespan + element.children.map do |e| + if e.type == :text || e.type == :codespan e.value - elsif %i{strong em p a}.include?(e.type) + elsif %i{strong em p a}.include?(e.type) extract_as_text(e).join("\n") elsif e.type == :smart_quote quotes[e.value] end end.join.split("\n") - lines end private diff --git a/lib/mdl/rules.rb b/lib/mdl/rules.rb index cc1dfff5..50cc44ab 100644 --- a/lib/mdl/rules.rb +++ b/lib/mdl/rules.rb @@ -1,7 +1,7 @@ docs do |id, description| url_hash = [id.downcase, description.downcase.gsub(/[^a-z]+/, '-')].join('---') - "https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md##{url_hash}" + "https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md##{url_hash}" end rule 'MD001', 'Header levels should only increment by one level at a time' do @@ -126,7 +126,7 @@ end rule 'MD006', 'Consider starting bulleted lists at the beginning of the line' do - # Starting at the beginning of the line means that indendation for each + # Starting at the beginning of the line means that indentation for each # bullet level can be identical. tags :bullet, :ul, :indentation aliases 'ul-start-left' @@ -459,10 +459,9 @@ doc.find_type_elements(:blockquote).each do |e| linenum = doc.element_linenumber(e) lines = doc.extract_as_text(e) - # Handle first line specially as whitespace is stripped from the text element - if doc.element_line(e).match(/^\s*> /) - errors << linenum - end + # Handle first line specially as whitespace is stripped from the text + # element + errors << linenum if doc.element_line(e).match(/^\s*> /) lines.each do |line| errors << linenum if line.start_with?(' ') linenum += 1 diff --git a/lib/mdl/style.rb b/lib/mdl/style.rb index 52f41d7f..b02a36b0 100644 --- a/lib/mdl/style.rb +++ b/lib/mdl/style.rb @@ -58,7 +58,7 @@ def self.load(style_file, rules) warn "#{style_file} does not appear to be a built-in style." + ' If you meant to pass in your own style file, it must contain' + " a '/' or end in '.rb'. See https://github.com/markdownlint/" + - 'markdownlint/blob/master/docs/configuration.md' + 'markdownlint/blob/main/docs/configuration.md' exit(1) end style_file = tmp diff --git a/test/fixtures/output/json/with_matches.json b/test/fixtures/output/json/with_matches.json index 24cd4608..606bd4cc 100644 --- a/test/fixtures/output/json/with_matches.json +++ b/test/fixtures/output/json/with_matches.json @@ -1 +1 @@ -[{"filename":"(stdin)","line":1,"rule":"MD002","aliases":["first-header-h1"],"description":"First header should be a top level header","docs":"https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header"}] +[{"filename":"(stdin)","line":1,"rule":"MD002","aliases":["first-header-h1"],"description":"First header should be a top level header","docs":"https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header"}] diff --git a/test/fixtures/output/sarif/with_matches.sarif b/test/fixtures/output/sarif/with_matches.sarif index 855dae4f..75f8f864 100644 --- a/test/fixtures/output/sarif/with_matches.sarif +++ b/test/fixtures/output/sarif/with_matches.sarif @@ -1 +1 @@ -{"$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"Markdown lint","version":"0.12.0","informationUri":"https://github.com/markdownlint/markdownlint","rules":[{"id":"MD002","name":"FirstHeaderH1","defaultConfiguration":{"level":"note"},"properties":{"description":"First header should be a top level header","tags":["headers"],"queryURI":"https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header"},"shortDescription":{"text":"First header should be a top level header"},"fullDescription":{"text":"First header should be a top level header"},"helpUri":"https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header","help":{"text":"More info: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header","markdown":"[More info](https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header)"}}]}},"results":[{"ruleId":"MD002","ruleIndex":0,"message":{"text":"MD002 - First header should be a top level header"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"(stdin)","uriBaseId":"%SRCROOT%"},"region":{"startLine":1}}}]}]}]} +{"$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"Markdown lint","version":"0.12.0","informationUri":"https://github.com/markdownlint/markdownlint","rules":[{"id":"MD002","name":"FirstHeaderH1","defaultConfiguration":{"level":"note"},"properties":{"description":"First header should be a top level header","tags":["headers"],"queryURI":"https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header"},"shortDescription":{"text":"First header should be a top level header"},"fullDescription":{"text":"First header should be a top level header"},"helpUri":"https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header","help":{"text":"More info: https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header","markdown":"[More info](https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header)"}}]}},"results":[{"ruleId":"MD002","ruleIndex":0,"message":{"text":"MD002 - First header should be a top level header"},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"(stdin)","uriBaseId":"%SRCROOT%"},"region":{"startLine":1}}}]}]}]} diff --git a/test/test_cli.rb b/test/test_cli.rb index 2358e1f3..1397d770 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -235,7 +235,7 @@ def test_ignore_front_matter #{path}/jekyll_post_2.md:16: MD001 Header levels should only increment by one level at a time Further documentation is available for these failures: - - MD001: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md001---header-levels-should-only-increment-by-one-level-at-a-time + - MD001: https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md001---header-levels-should-only-increment-by-one-level-at-a-time OUTPUT assert_equal(result[:stdout], expected) @@ -258,7 +258,7 @@ def test_printing_url_links_in_tty result = run_cli_as_tty('-r MD002', "## header2\n") link_text = 'MD002' - url = 'https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header' + url = 'https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header' expected_link = "\e]8;;#{url}\e\\#{link_text}\e]8;;\e\\" expected = <<~OUTPUT @@ -271,7 +271,7 @@ def test_printing_url_links_in_tty def test_printing_url_links_outside_tty result = run_cli_with_input('-r MD002', "## header2\n") - url = 'https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header' + url = 'https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md002---first-header-should-be-a-top-level-header' expected = <<~OUTPUT (stdin):1: MD002 First header should be a top level header