def test_languages_recognised(): assert detect_language.detect_language("/tmp/some_file.js") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.jsx") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.bsl") == "1C Enterprise" assert detect_language.detect_language( "/tmp/some_file.os") == "1C Enterprise" assert detect_language.detect_language("/tmp/some_file.asm") == "Assembly" assert detect_language.detect_language("/tmp/some_file.bat") == "Batchfile" assert detect_language.detect_language("/tmp/some_file.c") == "C" assert detect_language.detect_language("/tmp/some_file.cpp") == "C++" assert detect_language.detect_language("/tmp/some_file.cxx") == "C++" assert detect_language.detect_language("/tmp/some_file.cs") == "C#" assert detect_language.detect_language("/tmp/some_file.clj") == "Clojure" assert detect_language.detect_language( "/tmp/some_file.coffee") == "CoffeeScript" assert detect_language.detect_language("/tmp/some_file.cbl") == "COBOL" assert detect_language.detect_language("/tmp/some_file.COB") == "COBOL" assert detect_language.detect_language("/tmp/some_file.cpy") == "COBOL" assert detect_language.detect_language("/tmp/some_file.dart") == "Dart" assert detect_language.detect_language("/tmp/some_file.groovy") == "Groovy" assert detect_language.detect_language("/tmp/some_file.gsh") == "Groovy" assert detect_language.detect_language("/tmp/some_file.gvy") == "Groovy" assert detect_language.detect_language("/tmp/some_file.ex") == "Elixir" assert detect_language.detect_language("/tmp/some_file.exs") == "Elixir" assert detect_language.detect_language("/tmp/some_file.elm") == "Elm" assert detect_language.detect_language("/tmp/some_file.erb") == "ERB" assert detect_language.detect_language("/tmp/some_file.html.erb") == "ERB" assert detect_language.detect_language("/tmp/some_file.erl") == "Erlang" assert detect_language.detect_language("/tmp/some_file.hrl") == "Erlang" assert detect_language.detect_language("/tmp/some_file.fs") == "F#" assert detect_language.detect_language("/tmp/some_file.fsi") == "F#" assert detect_language.detect_language("/tmp/some_file.fsx") == "F#" assert detect_language.detect_language("/tmp/some_file.fsscript") == "F#" assert detect_language.detect_language("/tmp/some_file.f90") == "Fortran" assert detect_language.detect_language("/tmp/some_file.F90") == "Fortran" assert detect_language.detect_language("/tmp/some_file.f95") == "Fortran" assert detect_language.detect_language("/tmp/some_file.f03") == "Fortran" assert detect_language.detect_language("/tmp/some_file.for") == "Fortran" assert detect_language.detect_language("/tmp/some_file.go") == "Go" assert detect_language.detect_language("/tmp/some_file.lhs") == "Haskell" assert detect_language.detect_language("/tmp/some_file.html") == "HTML" assert detect_language.detect_language("/tmp/some_file.htm") == "HTML" assert detect_language.detect_language("/tmp/some_file.json") == "JSON" assert detect_language.detect_language("/tmp/some_file.java") == "Java" assert detect_language.detect_language( "/tmp/some_file.ipynb") == "Jupyter Notebook" assert detect_language.detect_language("/tmp/some_file.liquid") == "Liquid" assert detect_language.detect_language("/tmp/some_file.lua") == "Lua" assert detect_language.detect_language("/tmp/some_file.m") == "MATLAB" assert detect_language.detect_language( "/tmp/some_file.mm") == "Objective-C" assert detect_language.detect_language( "/tmp/some_file.p") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.w") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.i") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.cls") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.ab") == "OpenEdge ABL" assert detect_language.detect_language("/tmp/some_file.pkb") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pks") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pl") == "Perl" assert detect_language.detect_language("/tmp/some_file.php") == "PHP" assert detect_language.detect_language( "/tmp/some_file.proto") == "Protocol Buffer" assert detect_language.detect_language("/tmp/some_file.pks") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pkb") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.py") == "Python" assert detect_language.detect_language("/tmp/some_file.r") == "R" assert detect_language.detect_language("/tmp/some_file.rb") == "Ruby" assert detect_language.detect_language("/tmp/some_file.rs") == "Rust" assert detect_language.detect_language("/tmp/some_file.scala") == "Scala" assert detect_language.detect_language("/tmp/some_file.scss") == "SCSS" assert detect_language.detect_language("/tmp/some_file.sh") == "Shell" assert detect_language.detect_language("/tmp/some_file.st") == "Smalltalk" assert detect_language.detect_language("/tmp/some_file.svelte") == "Svelte" assert detect_language.detect_language("/tmp/some_file.swift") == "Swift" assert detect_language.detect_language("/tmp/some_file.ts") == "TypeScript" assert detect_language.detect_language( "/tmp/some_file.tsx") == "TypeScript" assert detect_language.detect_language("/tmp/some_file.vue") == "Vue"
def set_commit_stats(self, stats, repo_dir): for f in stats: full_path = repo_dir + "/" + f self.changed_files.append( FileChange(f, stats[f]['deletions'], stats[f]['insertions'], detect_language.detect_language(full_path)))
def test_languages_recognised(): # In case of Docker environment pwd = os.getcwd() if pwd == "/": pwd = "/app" assert detect_language.detect_language( "/tmp/some_file.bsl") == "1C Enterprise" assert detect_language.detect_language( "/tmp/some_file.os") == "1C Enterprise" assert detect_language.detect_language("/tmp/some_file.cls") == "Apex" assert detect_language.detect_language("/tmp/some_file.asm") == "Assembly" assert detect_language.detect_language("/tmp/some_file.bat") == "Batchfile" assert detect_language.detect_language("/tmp/some_file.cmd") == "Batchfile" assert detect_language.detect_language("/tmp/some_file.btm") == "Batchfile" assert detect_language.detect_language("/tmp/some_file.c") == "C" assert detect_language.detect_language("/tmp/some_file.h") == "C" assert detect_language.detect_language("/tmp/some_file.cpp") == "C++" assert detect_language.detect_language("/tmp/some_file.cxx") == "C++" assert detect_language.detect_language("/tmp/some_file.hpp") == "C++" assert detect_language.detect_language("/tmp/some_file.cc") == "C++" assert detect_language.detect_language("/tmp/some_file.hxx") == "C++" assert detect_language.detect_language("/tmp/some_file.hh") == "C++" assert detect_language.detect_language("/tmp/some_file.cs") == "C#" assert detect_language.detect_language("/tmp/some_file.clj") == "Clojure" assert detect_language.detect_language( "/tmp/some_file.coffee") == "CoffeeScript" assert detect_language.detect_language("/tmp/some_file.cbl") == "COBOL" assert detect_language.detect_language("/tmp/some_file.COB") == "COBOL" assert detect_language.detect_language("/tmp/some_file.cpy") == "COBOL" assert detect_language.detect_language("/tmp/some_file.dart") == "Dart" assert detect_language.detect_language("/tmp/some_file.groovy") == "Groovy" assert detect_language.detect_language("/tmp/some_file.gsh") == "Groovy" assert detect_language.detect_language("/tmp/some_file.gvy") == "Groovy" assert detect_language.detect_language("/tmp/some_file.Ejs") == "EJS" assert detect_language.detect_language("/tmp/some_file.ex") == "Elixir" assert detect_language.detect_language("/tmp/some_file.exs") == "Elixir" assert detect_language.detect_language("/tmp/some_file.elm") == "Elm" assert detect_language.detect_language("/tmp/some_file.epp") == "EPP" assert detect_language.detect_language("/tmp/some_file.erb") == "ERB" assert detect_language.detect_language("/tmp/some_file.html.erb") == "ERB" assert detect_language.detect_language("/tmp/some_file.erl") == "Erlang" assert detect_language.detect_language("/tmp/some_file.hrl") == "Erlang" assert detect_language.detect_language("/tmp/some_file.fs") == "F#" assert detect_language.detect_language("/tmp/some_file.fsi") == "F#" assert detect_language.detect_language("/tmp/some_file.fsx") == "F#" assert detect_language.detect_language("/tmp/some_file.fsscript") == "F#" assert detect_language.detect_language("/tmp/some_file.f90") == "Fortran" assert detect_language.detect_language("/tmp/some_file.F90") == "Fortran" assert detect_language.detect_language("/tmp/some_file.f95") == "Fortran" assert detect_language.detect_language("/tmp/some_file.f03") == "Fortran" assert detect_language.detect_language("/tmp/some_file.for") == "Fortran" assert detect_language.detect_language("/tmp/some_file.go") == "Go" assert detect_language.detect_language("/tmp/some_file.lhs") == "Haskell" assert detect_language.detect_language("/tmp/some_file.hs") == "Haskell" assert detect_language.detect_language("/tmp/some_file.hcl") == "HCL" assert detect_language.detect_language("/tmp/some_file.tf") == "HCL" assert detect_language.detect_language("/tmp/some_file.tfvars") == "HCL" assert detect_language.detect_language("/tmp/some_file.html") == "HTML" assert detect_language.detect_language("/tmp/some_file.htm") == "HTML" assert detect_language.detect_language("/tmp/some_file.xhtml") == "HTML" assert detect_language.detect_language("/tmp/some_file.json") == "JSON" assert detect_language.detect_language("/tmp/some_file.java") == "Java" assert detect_language.detect_language("/tmp/some_file.js") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.mjs") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.cjs") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.jsx") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.ipynb") == "Jupyter Notebook" assert detect_language.detect_language("/tmp/some_file.kv") == "Kivy" assert detect_language.detect_language("/tmp/some_file.kt") == "Kotlin" assert detect_language.detect_language("/tmp/some_file.kts") == "Kotlin" assert detect_language.detect_language("/tmp/some_file.vi") == "LabVIEW" assert detect_language.detect_language( "/tmp/some_file.lvproj") == "LabVIEW" assert detect_language.detect_language( "/tmp/some_file.lvclass") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.ctl") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.ctt") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.llb") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.lvbit") == "LabVIEW" assert detect_language.detect_language( "/tmp/some_file.lvbitx") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.lvlad") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.lvlib") == "LabVIEW" assert detect_language.detect_language( "/tmp/some_file.lvmodel") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.lvsc") == "LabVIEW" assert detect_language.detect_language( "/tmp/some_file.lvtest") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.vidb") == "LabVIEW" assert detect_language.detect_language("/tmp/some_file.l") == "Lex" assert detect_language.detect_language("/tmp/some_file.liquid") == "Liquid" assert detect_language.detect_language("/tmp/some_file.lua") == "Lua" assert detect_language.detect_language( pwd + "/test/fixtures/matlab.m") == "MATLAB" assert detect_language.detect_language("/tmp/some_file.nix") == "Nix" assert detect_language.detect_language( pwd + "/test/fixtures/objective-c.m") == "Objective-C" assert detect_language.detect_language( "/tmp/some_file.mm") == "Objective-C" assert detect_language.detect_language( "/tmp/some_file.p") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.w") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.i") == "OpenEdge ABL" assert detect_language.detect_language( "/tmp/some_file.ab") == "OpenEdge ABL" assert detect_language.detect_language("/tmp/some_file.pkb") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pks") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pl") == "Perl" assert detect_language.detect_language("/tmp/some_file.pm") == "Perl" assert detect_language.detect_language("/tmp/some_file.t") == "Perl" assert detect_language.detect_language("/tmp/some_file.php") == "PHP" assert detect_language.detect_language( "/tmp/some_file.proto") == "Protocol Buffer" assert detect_language.detect_language("/tmp/some_file.pks") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pkb") == "PLSQL" assert detect_language.detect_language("/tmp/some_file.pp") == "Puppet" assert detect_language.detect_language("/tmp/some_file.py") == "Python" assert detect_language.detect_language("/tmp/some_file.qml") == "QML" assert detect_language.detect_language("/tmp/some_file.r") == "R" assert detect_language.detect_language("/tmp/some_file.robot") == "Robot" assert detect_language.detect_language("/tmp/some_file.rb") == "Ruby" assert detect_language.detect_language("/tmp/some_file.rs") == "Rust" assert detect_language.detect_language("/tmp/some_file.scala") == "Scala" assert detect_language.detect_language("/tmp/some_file.scss") == "SCSS" assert detect_language.detect_language("/tmp/some_file.sh") == "Shell" assert detect_language.detect_language("/tmp/some_file.st") == "Smalltalk" assert detect_language.detect_language("/tmp/some_file.styl") == "Stylus" assert detect_language.detect_language("/tmp/some_file.svelte") == "Svelte" assert detect_language.detect_language("/tmp/some_file.swift") == "Swift" assert detect_language.detect_language("/tmp/some_file.ts") == "TypeScript" assert detect_language.detect_language( "/tmp/some_file.tsx") == "TypeScript" assert detect_language.detect_language("/tmp/some_file.vue") == "Vue" assert detect_language.detect_language("/tmp/some_file.xtend") == "Xtend" assert detect_language.detect_language("/tmp/some_file.xtext") == "Xtext" assert detect_language.detect_language("/tmp/some_file.y") == "Yacc"
def test_languages_recognised(): assert detect_language.detect_language("/tmp/some_file.js") == "JavaScript" assert detect_language.detect_language( "/tmp/some_file.jsx") == "JavaScript" assert detect_language.detect_language("/tmp/some_file.bat") == "Batchfile" assert detect_language.detect_language("/tmp/some_file.c") == "C" assert detect_language.detect_language("/tmp/some_file.cpp") == "C++" assert detect_language.detect_language("/tmp/some_file.cxx") == "C++" assert detect_language.detect_language("/tmp/some_file.cs") == "C#" assert detect_language.detect_language("/tmp/some_file.clj") == "Clojure" assert detect_language.detect_language( "/tmp/some_file.coffee") == "CoffeeScript" assert detect_language.detect_language("/tmp/some_file.ex") == "Elixir" assert detect_language.detect_language("/tmp/some_file.exs") == "Elixir" assert detect_language.detect_language("/tmp/some_file.go") == "Go" assert detect_language.detect_language("/tmp/some_file.lhs") == "Haskell" assert detect_language.detect_language("/tmp/some_file.html") == "HTML" assert detect_language.detect_language("/tmp/some_file.htm") == "HTML" assert detect_language.detect_language("/tmp/some_file.json") == "JSON" assert detect_language.detect_language("/tmp/some_file.java") == "Java" assert detect_language.detect_language( "/tmp/some_file.ipynb") == "Jupyter Notebook" assert detect_language.detect_language("/tmp/some_file.liquid") == "Liquid" assert detect_language.detect_language("/tmp/some_file.lua") == "Lua" assert detect_language.detect_language("/tmp/some_file.m") == "MATLAB" assert detect_language.detect_language( "/tmp/some_file.mm") == "Objective-C" assert detect_language.detect_language("/tmp/some_file.pl") == "Perl" assert detect_language.detect_language("/tmp/some_file.php") == "PHP" assert detect_language.detect_language( "/tmp/some_file.proto") == "Protocol Buffer" assert detect_language.detect_language("/tmp/some_file.py") == "Python" assert detect_language.detect_language("/tmp/some_file.r") == "R" assert detect_language.detect_language("/tmp/some_file.rb") == "Ruby" assert detect_language.detect_language("/tmp/some_file.rs") == "Rust" assert detect_language.detect_language("/tmp/some_file.scala") == "Scala" assert detect_language.detect_language("/tmp/some_file.scss") == "SCSS" assert detect_language.detect_language("/tmp/some_file.sh") == "Shell" assert detect_language.detect_language("/tmp/some_file.swift") == "Swift" assert detect_language.detect_language("/tmp/some_file.ts") == "TypeScript" assert detect_language.detect_language( "/tmp/some_file.tsx") == "TypeScript" assert detect_language.detect_language("/tmp/some_file.vue") == "Vue"
def set_commit_stats(self, stats): for f in stats: self.changed_files.append(FileChange( f, stats[f]['deletions'], stats[f]['insertions'], detect_language.detect_language(f)))