mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-10 11:25:32 +00:00
Detect GFortran module files as generated
This commit is contained in:
@@ -69,7 +69,7 @@ module Linguist
|
|||||||
generated_protocol_buffer? ||
|
generated_protocol_buffer? ||
|
||||||
generated_jni_header? ||
|
generated_jni_header? ||
|
||||||
vcr_cassette? ||
|
vcr_cassette? ||
|
||||||
generated_kicad_module?
|
generated_module?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Internal: Is the blob an Xcode file?
|
# Internal: Is the blob an Xcode file?
|
||||||
@@ -313,17 +313,22 @@ module Linguist
|
|||||||
return lines[0].include?("Generated by Cython")
|
return lines[0].include?("Generated by Cython")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Internal: Is it a KiCAD module file?
|
# Internal: Is it a KiCAD or GFortran module file?
|
||||||
#
|
#
|
||||||
# KiCAD module files contain:
|
# KiCAD module files contain:
|
||||||
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
|
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
|
||||||
# on the first line.
|
# on the first line.
|
||||||
#
|
#
|
||||||
|
# GFortran module files contain:
|
||||||
|
# GFORTRAN module version 'x' created from
|
||||||
|
# on the first line.
|
||||||
|
#
|
||||||
# Return true of false
|
# Return true of false
|
||||||
def generated_kicad_module?
|
def generated_module?
|
||||||
return false unless extname == '.mod'
|
return false unless extname == '.mod'
|
||||||
return false unless lines.count > 1
|
return false unless lines.count > 1
|
||||||
return lines[0].include?("PCBNEW-LibModule-V")
|
return lines[0].include?("PCBNEW-LibModule-V") ||
|
||||||
|
lines[0].include?("GFORTRAN module version '")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
19
test/fixtures/Generated/ms2.mod
vendored
Normal file
19
test/fixtures/Generated/ms2.mod
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
GFORTRAN module version '0' created from ms2.f90 on Thu Sep 5 10:09:19 2013
|
||||||
|
MD5:8a80cd5db1bc612a28603959302dbf37 -- If you edit this, you'll get what you deserve.
|
||||||
|
|
||||||
|
(() () () () () () () () () () () () () () () () () () () () () () () ()
|
||||||
|
() () ())
|
||||||
|
|
||||||
|
()
|
||||||
|
|
||||||
|
()
|
||||||
|
|
||||||
|
()
|
||||||
|
|
||||||
|
()
|
||||||
|
|
||||||
|
(2 'ms2' 'ms2' 'ms2' 1 ((MODULE UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN
|
||||||
|
UNKNOWN) (UNKNOWN 0 0 0 UNKNOWN ()) 0 0 () () 0 () () () 0 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
('ms2' 0 2)
|
||||||
@@ -243,9 +243,6 @@ class TestBlob < Minitest::Test
|
|||||||
# Cython-generated C/C++
|
# Cython-generated C/C++
|
||||||
assert sample_blob("C/sgd_fast.c").generated?
|
assert sample_blob("C/sgd_fast.c").generated?
|
||||||
assert sample_blob("C++/wrapper_inner.cpp").generated?
|
assert sample_blob("C++/wrapper_inner.cpp").generated?
|
||||||
|
|
||||||
# KiCAD module files
|
|
||||||
assert fixture_blob("Generated/ABM8G.mod").generated?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_vendored
|
def test_vendored
|
||||||
|
|||||||
Reference in New Issue
Block a user