Return a boolean from source map generated check by ctmayn · Pull Request #7398 · github-linguist/linguist · GitHub
Skip to content

Return a boolean from source map generated check#7398

Merged
lildude merged 1 commit into
github-linguist:mainfrom
ctmayn:main
Jun 2, 2025
Merged

Return a boolean from source map generated check#7398
lildude merged 1 commit into
github-linguist:mainfrom
ctmayn:main

Conversation

@ctmayn

@ctmayn ctmayn commented May 21, 2025

Copy link
Copy Markdown
Contributor

Description

The =~ operator returns the position of the first match, not a boolean. So the return value of the source_map? and generated? functions can return integers which is unexpected of boolean functions. This change also allows the test to compare the test and actual values directly instead of a forcing the boolean.

Checklist:

  • I am adding a new extension to a language.

    • The new extension is used in hundreds of repositories on GitHub.com
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am adding a new language.

    • The extension of the new language is used in hundreds of repositories on GitHub.com.
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a syntax highlighting grammar: [URL to grammar repo]
    • I have added a color
      • Hex value: #RRGGBB
      • Rationale:
    • I have updated the heuristics to distinguish my language from others using the same extension.
  • I am fixing a misclassified language

    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am changing the source of a syntax highlighting grammar

    • Old: [URL to grammar repo]
    • New: [URL to grammar repo]
  • I am updating a grammar submodule

  • I am adding new or changing current functionality

    • I have added or updated the tests for the new or changed functionality.
  • I am changing the color associated with a language

    • I have obtained agreement from the wider language community on this color change.
      • [URL to public discussion]
      • [Optional: URL to official branding guidelines for the language]

@ctmayn ctmayn requested a review from a team as a code owner May 21, 2025 22:45
@lildude lildude added this pull request to the merge queue Jun 2, 2025
Merged via the queue into github-linguist:main with commit 705e624 Jun 2, 2025
5 checks passed
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants