Skip to content

Commit

Permalink
Delete buggy detection for Mosel (#1936)
Browse files Browse the repository at this point in the history
The “Lexer Development” doc says:

    It is important to note that self.detect? should only return true if it is
    100% sure that the language is detected.

The specified function matches any file containing the words “model” or
“package” at the beginning of a line, which misfires quite a lot!

Regularly spotted with debian/changelog files on https://salsa.debian.org/
(powered by GitLab).

Co-authored-by: Cyril Brulebois <kibi@debian.org>
  • Loading branch information
CyrilBrulebois and Cyril Brulebois authored Apr 2, 2023
1 parent 916ed4b commit 3889923
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/rouge/lexers/mosel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ class Mosel < RegexLexer

mimetypes 'text/x-mosel'

def self.detect?(text)
return true if text =~ /^\s*(model|package)\s+/
end

id = /[a-zA-Z_][a-zA-Z0-9_]*/

############################################################################################################################
Expand Down

0 comments on commit 3889923

Please sign in to comment.