Skip to content

Commit

Permalink
Heuristic rule for Puppet and Pascal .pp files (#4289)
Browse files Browse the repository at this point in the history
  • Loading branch information
pchaigno authored Oct 29, 2018
1 parent db1796c commit e443120
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ disambiguations:
named_pattern: perl6
- language: XPM
pattern: '^\s*\/\* XPM \*\/'
- extensions: ['.pp']
rules:
- language: Pascal
pattern: '^\s*end[.;]'
- language: Puppet
pattern: '^\s+\w+\s+=>\s'
- extensions: ['.pro']
rules:
- language: Prolog
Expand Down
8 changes: 8 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ def test_pm_by_heuristics
})
end

# Candidate languages = ["Pascal", "Puppet"]
def test_pp_by_heuristics
assert_heuristics({
"Pascal" => all_fixtures("Pascal", "*.pp"),
"Puppet" => all_fixtures("Puppet", "*.pp") - ["#{samples_path}/Puppet/stages-example.pp", "#{samples_path}/Puppet/hiera_include.pp"]
})
end

# Candidate languages = ["IDL", "Prolog", "QMake", "INI"]
def test_pro_by_heuristics
assert_heuristics({
Expand Down

0 comments on commit e443120

Please sign in to comment.