tlv


Nametlv JSON
Version 1.5.3 PyPI version JSON
download
home_pagehttps://github.com/priv-kweihmann/tlv
Summary-- Too less variation -- Find duplicates in source code for various languages
upload_time2024-05-06 11:28:33
maintainerNone
docs_urlNone
authorKonrad Weihmann
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements Pygments chardet
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tlv

![Build status](https://github.com/priv-kweihmann/tlv/workflows/Build/badge.svg)
[![PyPI version](https://badge.fury.io/py/tlv.svg)](https://badge.fury.io/py/tlv)
[![Python version](https://img.shields.io/pypi/pyversions/tlv)](https://img.shields.io/pypi/pyversions/tlv)
[![Downloads](https://img.shields.io/pypi/dm/tlv)](https://img.shields.io/pypi/dm/tlv)

Too less variation - A tool to discover code duplication in various languages

## Purpose

Code duplication are hard to track across many files.
There are tools existing like [CPD](https://pmd.github.io/latest/pmd_userdocs_cpd.html) (from PMD) which are doing a great job, but they require JAVA (or even some more obscure language) to run.
So I decided to write a small tool which uses [Pygments](http://pygments.org/) and python [difflib](https://docs.python.org/3/library/difflib.html) to catch code duplications for as many languages as possible

## Requirements

* python3
* [Pygments](http://pygments.org/)

## Installation

### PyPi

simply run

```sh
pip3 install tlv
```

### From source

* Install the needed requirements by running ```pip3 install Pygments```
* git clone this repository
* cd to \<clone folder\>
* run ```sudo ./build.sh```

## Usage

```shell
usage: tlv [-h] [--minlines MINLINES] [--mintoken MINTOKEN] [-j JOBS]
           [--lexer {...}]
           [--wildcard_token {...}]
           [--verbose] [--nodetails]
           files [files ...]

Find code duplications across various languages
positional arguments:
  files                 Files to parse

optional arguments:
  -h, --help            show this help message and exit
  --minlines MINLINES   Minimum length of block in lines before reporting
  --mintoken MINTOKEN   Minimum length of block in token before reporting
  -j JOBS, --jobs JOBS  Number of jobs to run in parallel
  --lexer {3d,aap,actionscript,actionscript3,ada,ada2005,ada95,adl,agda,ahk,al,alloy,amienttalk,amienttalk/2,ampl,an,antlr,antlr-actionscript,antlr-as,antlr-c#,antlr-cpp,antlr-csharp,antlr-java,antlr-perl,antlr-python,antlr-r,antlr-ruy,apachecon,apl,applescript,arduino,arexx,as,as3,asemake,asic,asm,aspectj,aspx-cs,asy,asymptote,at,atch,augeas,autohotkey,autoit,awk,c,c#,c++,c++-ojdum,c-ojdump,ca65,cadl,camkes,capdl,capnp,casic,ceylon,chai,chaiscript,chapel,charmci,cheetah,chpl,cirru,cl,clay,clean,clj,cljs,clojure,clojurescript,cmake,cmas,co,code,common-lisp,componentpascal,console,control,cool,coq,cp,cpp,cpp-ojdump,cpsa,cr,crmsh,croc,cry,cryptol,crystal,csh,csharp,csound,csound-csd,csound-document,csound-orc,csound-sco,csound-score,css,css+django,css+er,css+genshi,css+genshitext,css+jinja,css+lasso,css+mako,css+mozpreproc,css+php,css+ruy,css+smarty,cu,cucumer,cuda,cxx-ojdump,cypher,cython,d,d-ojdump,dart,dasm16,decontrol,delphi,desources,dg,di,django,do,docker,dosatch,doscon,dpatch,dtd,duy,dylan,dylan-console,dylan-lid,dylan-repl,e,earl-grey,earlgrey,easytrieve,ec,ecl,eg,ei,elisp,elixir,elm,emacs,emacs-lisp,en,er,erl,erlang,evoque,ex,exs,extempore,ezhil,gap,gas,gawk,genshi,genshitext,gherkin,glsl,gnuplot,go,golo,gooddata-cl,gosu,gro,groovy,gst,haml,handlears,haskell,haxe,haxeml,hexdump,hlsl,hs,hsa,hsail,hspec,html,html+cheetah,html+django,html+er,html+evoque,html+genshi,html+handlears,html+jinja,html+kid,html+lasso,html+mako,html+myghty,html+ng2,html+php,html+ruy,html+smarty,html+spit,html+twig,htmldjango,http,hx,hxml,hxsl,hylang,i,i6t,idl,idl4,idr,idris,iex,igor,igorpro,ik,in,ini,io,ioke,ir,irc,isaelle,itex,j,jade,jags,jasmin,jasminxt,java,javascript,javascript+cheetah,javascript+django,javascript+er,javascript+genshi,javascript+genshitext,javascript+jinja,javascript+lasso,javascript+mako,javascript+myghty,javascript+php,javascript+ruy,javascript+smarty,jcl,jinja,jl,jlcon,jproperties,js,js+cheetah,js+django,js+er,js+genshi,js+genshitext,js+jinja,js+lasso,js+mako,js+myghty,js+php,js+ruy,js+smarty,js+spit,jsg,json,json-ld,json-oject,jsonld,jsp,julia,juttle,kal,kcon,kid,koka,kotlin,lagda,lasso,lassoscript,lcry,lcryptol,lean,less,lhaskell,lhs,lid,lidr,lidris,lighttpd,lighty,limo,liquid,lisp,literate-agda,literate-cryptol,literate-haskell,literate-idris,litzasic,litzmax,live-script,livescript,llvm,logos,logtalk,lua,m2,make,make,mako,maql,mask,mason,mathematica,matla,matlasession,mawk,max,md,minid,mma,modelica,modula2,moin,monkey,monte,moo,moocode,moon,moonscript,mq4,mq5,mql,mql4,mql5,msc,mscgen,mupad,mxml,myghty,mysql,n,nasm,nawk,ncl,nesc,newlisp,newspeak,ng2,nginx,nim,nimrod,nit,nix,nixos,nn,nsh,nsi,nsis,numpy,nusmv,oa,ocaml,octave,odin,oj-c,oj-c++,oj-j,ojc,ojc++,ojdump,ojdump-nasm,ojective-c,ojective-c++,ojective-j,ojectivec,ojectivec++,ojectivej,ojectpascal,ojj,oo,ooc,oogie,opa,openedge,openugs,pacmancon,pan,parasail,pas,pascal,pawn,pcmk,perl,perl6,php,php3,php4,php5,pig,pike,pkgcon,pl,pl6,plpgsql,plus,po,posh,postgres,postgres-console,postgresql,postgresql-console,postscr,postscript,pot,pov,powershell,praat,progress,prolog,properties,protou,ps1,ps1con,psm1,psql,pug,puppet,py,py3,py3t,pycon,pypy,pypylog,pyrex,pyt,python,python3,pyx,qasic,qml,qs,qvt,qvto,r,racket,ragel,ragel-c,ragel-cpp,ragel-d,ragel-em,ragel-java,ragel-ojc,ragel-r,ragel-ruy,rain,raw,rcon,rd,red,red/system,redcode,registry,reol,resource,resourceundle,rexx,rhtml,rkt,rnc,rng-compact,ro,roocon,root,rql,rs,rsl,rts,rust,ruy,s,sage,salt,sarl,sas,sass,satch,sc,scala,scaml,scheme,scila,scm,scss,shell-session,silver,slash,slim,sls,slurm,smali,smalltalk,smarty,sml,snool,sources.list,sourceslist,sp,sparql,spec,spit,splus,sql,sqlite3,squeak,squidcon,st,st-pytex,stan,stata,supercollider,sv,swi,swig,systemverilog,t-sql,tads3,tap,tasm,tcl,tcsh,tcshcon,tea,teraterm,teratermmacro,termcap,termin,terra,thri,todotxt,toml,tra,trac-wiki,treetop,ts,tsql,ttl,turtle,twig,typescript,typoscript,typoscriptcssdata,typoscripthtmldata,ucode,ugs,unicon,uriscript,v.net,vala,vapi,vcl,vclsnippet,vclsnippets,vctreestatus,velocity,vgl,vhdl,vim,vnet,vscript,wdi,whiley,winatch,winugs,x10,xml,xml+cheetah,xml+django,xml+er,xml+evoque,xml+genshi,xml+jinja,xml+kid,xml+lasso,xml+mako,xml+myghty,xml+php,xml+ruy,xml+smarty,xml+spit,xorg,xq,xql,xqm,xquery,xqy,xten,xtend,yaml,yaml+jinja}
                        Manually set a lexer to use on all files
  --wildcard_token {Token.Keyword,Token.Keyword.Constant,Token.Keyword.Declaration,Token.Keyword.Namespace,Token.Keyword.Pseudo,Token.Keyword.Reserved,Token.Keyword.Type,Token.Name,Token.Name.Attribute,Token.Name.Builtin,Token.Name.Builtin.Pseudo,Token.Name.Class,Token.Name.Constant,Token.Name.Decorator,Token.Name.Entity,Token.Name.Exception,Token.Name.Function,Token.Name.Function.Magic,Token.Name.Label,Token.Name.Namespace,Token.Name.Other,Token.Name.Tag,Token.Name.Variable,Token.Name.Variable.Class,Token.Name.Variable.Global,Token.Name.Variable.Instance,Token.Name.Variable.Magic,Token.Literal,Token.Literal.Date,Token.Literal.String,Token.Literal.String.Affix,Token.Literal.String.Backtick,Token.Literal.String.Char,Token.Literal.String.Delimiter,Token.Literal.String.Doc,Token.Literal.String.Double,Token.Literal.String.Escape,Token.Literal.String.Heredoc,Token.Literal.String.Interpol,Token.Literal.String.Other,Token.Literal.String.Regex,Token.Literal.String.Single,Token.Literal.String.Symbol,Token.Literal.Number,Token.Literal.Number.Bin,Token.Literal.Number.Float,Token.Literal.Number.Hex,Token.Literal.Number.Integer,Token.Literal.Number.Integer.Long,Token.Literal.Number.Oct,Token.Operator,Token.Operator.Word,Token.Punctuation,Token.Comment,Token.Comment.Hashbang,Token.Comment.Multiline,Token.Comment.Preproc,Token.Comment.Single,Token.Comment.Special,Token.Generic,Token.Generic.Deleted,Token.Generic.Emph,Token.Generic.Error,Token.Generic.Heading,Token.Generic.Inserted,Token.Generic.Output,Token.Generic.Prompt,Token.Generic.Strong,Token.Generic.Subheading,Token.Generic.Traceback,Token.Text.Whitespace}
                        Token types that are threated as wildcards (actual
                        value doesn't matter)
  --verbose             Verbose output
  --nodetails           Dump the details of a finding
```

By default tool guesses the content type by the filename, if that doesn't work for you please see below

### Specify a lexer

You can use a specific lexer by running the tool with the **--lexer=** option.
When doing this all input files are processed by the specified lexer, you have to ensure that all passed files are of the specified file, else the results might be bogus.

## Output

Output will be written to stdout.
There are 2 possible finding types

* Duplicate - The code is exactly the same
* TooLessVariation - The code is the same, when removing all token types specified by --wildcard_token

### Output example

```shell
/someplace/busybox/modutils/modutils.c:9:0:[TooLessVariation]:Block till 16:0 is nearly the same as in ../modprobe-small.c from 29:0 till 36:0
>>> #include <sys/syscall.h>
>>> 
>>> #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
>>> #if defined(__NR_finit_module)
>>> # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
>>> #endif
>>> #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
>>> 
<<<
>>> #include <sys/syscall.h>
>>> 
>>> #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
>>> #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)
>>> #ifdef __NR_finit_module
>>> # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)
>>> #endif
>>> 
<<<
/someplace/busybox/modutils/modutils.c:165:32:[Duplicate]:Block till 169:3 is the same as in ../modprobe-small.c from 324:18 till 327:0
>>> 
>>> 	fstat(fd, &st);
>>> 	image = NULL;
>>> 	/* st.st_size is off_t, we can't just pass it to mmap */
>>> 	if
<<<
/someplace/busybox/modutils/modprobe-small.c:236:15:[Duplicate]:Block till 240:10 is the same as in ../modutils.c from 265:26 till 269:10
>>> 
>>> 	case ENOEXEC:
>>> 		return "invalid module format";
>>> 	case ENOENT:
>>> 		return "
<<<
/someplace/busybox/modutils/modutils.c:115:0:[Duplicate]:Block till 130:43 is the same as in ../modprobe-small.c from 177:0 till 194:36
>>> 
>>> #if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS
>>> char* FAST_FUNC parse_cmdline_module_options(char **argv, int quote_spaces)
>>> {
>>> 	char *options;
>>> 	int optlen;
>>> 
>>> 	options = xzalloc(1);
>>> 	optlen = 0;
>>> 	while (*++argv) {
>>> 		const char *fmt;
>>> 		const char *var;
>>> 		const char *val;
>>> 
>>> 		var = *argv;
>>> 		options = xrealloc(options, optlen + 2 + 
<<<
```

if you don't want to see the code itself, pass the **--nodetails** option

## Further reading

* [Pygments](http://pygments.org/)

## Bugs & Contribution

Feel free to create issues or pull requests

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/priv-kweihmann/tlv",
    "name": "tlv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Konrad Weihmann",
    "author_email": "kweihmann@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/8e/ae/6a2060d5361acfeda9aff0db256d85b5a23e2dba7bb08e22fe26ef47f7fe/tlv-1.5.3.tar.gz",
    "platform": null,
    "description": "# tlv\n\n![Build status](https://github.com/priv-kweihmann/tlv/workflows/Build/badge.svg)\n[![PyPI version](https://badge.fury.io/py/tlv.svg)](https://badge.fury.io/py/tlv)\n[![Python version](https://img.shields.io/pypi/pyversions/tlv)](https://img.shields.io/pypi/pyversions/tlv)\n[![Downloads](https://img.shields.io/pypi/dm/tlv)](https://img.shields.io/pypi/dm/tlv)\n\nToo less variation - A tool to discover code duplication in various languages\n\n## Purpose\n\nCode duplication are hard to track across many files.\nThere are tools existing like [CPD](https://pmd.github.io/latest/pmd_userdocs_cpd.html) (from PMD) which are doing a great job, but they require JAVA (or even some more obscure language) to run.\nSo I decided to write a small tool which uses [Pygments](http://pygments.org/) and python [difflib](https://docs.python.org/3/library/difflib.html) to catch code duplications for as many languages as possible\n\n## Requirements\n\n* python3\n* [Pygments](http://pygments.org/)\n\n## Installation\n\n### PyPi\n\nsimply run\n\n```sh\npip3 install tlv\n```\n\n### From source\n\n* Install the needed requirements by running ```pip3 install Pygments```\n* git clone this repository\n* cd to \\<clone folder\\>\n* run ```sudo ./build.sh```\n\n## Usage\n\n```shell\nusage: tlv [-h] [--minlines MINLINES] [--mintoken MINTOKEN] [-j JOBS]\n           [--lexer {...}]\n           [--wildcard_token {...}]\n           [--verbose] [--nodetails]\n           files [files ...]\n\nFind code duplications across various languages\npositional arguments:\n  files                 Files to parse\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --minlines MINLINES   Minimum length of block in lines before reporting\n  --mintoken MINTOKEN   Minimum length of block in token before reporting\n  -j JOBS, --jobs JOBS  Number of jobs to run in parallel\n  --lexer {3d,aap,actionscript,actionscript3,ada,ada2005,ada95,adl,agda,ahk,al,alloy,amienttalk,amienttalk/2,ampl,an,antlr,antlr-actionscript,antlr-as,antlr-c#,antlr-cpp,antlr-csharp,antlr-java,antlr-perl,antlr-python,antlr-r,antlr-ruy,apachecon,apl,applescript,arduino,arexx,as,as3,asemake,asic,asm,aspectj,aspx-cs,asy,asymptote,at,atch,augeas,autohotkey,autoit,awk,c,c#,c++,c++-ojdum,c-ojdump,ca65,cadl,camkes,capdl,capnp,casic,ceylon,chai,chaiscript,chapel,charmci,cheetah,chpl,cirru,cl,clay,clean,clj,cljs,clojure,clojurescript,cmake,cmas,co,code,common-lisp,componentpascal,console,control,cool,coq,cp,cpp,cpp-ojdump,cpsa,cr,crmsh,croc,cry,cryptol,crystal,csh,csharp,csound,csound-csd,csound-document,csound-orc,csound-sco,csound-score,css,css+django,css+er,css+genshi,css+genshitext,css+jinja,css+lasso,css+mako,css+mozpreproc,css+php,css+ruy,css+smarty,cu,cucumer,cuda,cxx-ojdump,cypher,cython,d,d-ojdump,dart,dasm16,decontrol,delphi,desources,dg,di,django,do,docker,dosatch,doscon,dpatch,dtd,duy,dylan,dylan-console,dylan-lid,dylan-repl,e,earl-grey,earlgrey,easytrieve,ec,ecl,eg,ei,elisp,elixir,elm,emacs,emacs-lisp,en,er,erl,erlang,evoque,ex,exs,extempore,ezhil,gap,gas,gawk,genshi,genshitext,gherkin,glsl,gnuplot,go,golo,gooddata-cl,gosu,gro,groovy,gst,haml,handlears,haskell,haxe,haxeml,hexdump,hlsl,hs,hsa,hsail,hspec,html,html+cheetah,html+django,html+er,html+evoque,html+genshi,html+handlears,html+jinja,html+kid,html+lasso,html+mako,html+myghty,html+ng2,html+php,html+ruy,html+smarty,html+spit,html+twig,htmldjango,http,hx,hxml,hxsl,hylang,i,i6t,idl,idl4,idr,idris,iex,igor,igorpro,ik,in,ini,io,ioke,ir,irc,isaelle,itex,j,jade,jags,jasmin,jasminxt,java,javascript,javascript+cheetah,javascript+django,javascript+er,javascript+genshi,javascript+genshitext,javascript+jinja,javascript+lasso,javascript+mako,javascript+myghty,javascript+php,javascript+ruy,javascript+smarty,jcl,jinja,jl,jlcon,jproperties,js,js+cheetah,js+django,js+er,js+genshi,js+genshitext,js+jinja,js+lasso,js+mako,js+myghty,js+php,js+ruy,js+smarty,js+spit,jsg,json,json-ld,json-oject,jsonld,jsp,julia,juttle,kal,kcon,kid,koka,kotlin,lagda,lasso,lassoscript,lcry,lcryptol,lean,less,lhaskell,lhs,lid,lidr,lidris,lighttpd,lighty,limo,liquid,lisp,literate-agda,literate-cryptol,literate-haskell,literate-idris,litzasic,litzmax,live-script,livescript,llvm,logos,logtalk,lua,m2,make,make,mako,maql,mask,mason,mathematica,matla,matlasession,mawk,max,md,minid,mma,modelica,modula2,moin,monkey,monte,moo,moocode,moon,moonscript,mq4,mq5,mql,mql4,mql5,msc,mscgen,mupad,mxml,myghty,mysql,n,nasm,nawk,ncl,nesc,newlisp,newspeak,ng2,nginx,nim,nimrod,nit,nix,nixos,nn,nsh,nsi,nsis,numpy,nusmv,oa,ocaml,octave,odin,oj-c,oj-c++,oj-j,ojc,ojc++,ojdump,ojdump-nasm,ojective-c,ojective-c++,ojective-j,ojectivec,ojectivec++,ojectivej,ojectpascal,ojj,oo,ooc,oogie,opa,openedge,openugs,pacmancon,pan,parasail,pas,pascal,pawn,pcmk,perl,perl6,php,php3,php4,php5,pig,pike,pkgcon,pl,pl6,plpgsql,plus,po,posh,postgres,postgres-console,postgresql,postgresql-console,postscr,postscript,pot,pov,powershell,praat,progress,prolog,properties,protou,ps1,ps1con,psm1,psql,pug,puppet,py,py3,py3t,pycon,pypy,pypylog,pyrex,pyt,python,python3,pyx,qasic,qml,qs,qvt,qvto,r,racket,ragel,ragel-c,ragel-cpp,ragel-d,ragel-em,ragel-java,ragel-ojc,ragel-r,ragel-ruy,rain,raw,rcon,rd,red,red/system,redcode,registry,reol,resource,resourceundle,rexx,rhtml,rkt,rnc,rng-compact,ro,roocon,root,rql,rs,rsl,rts,rust,ruy,s,sage,salt,sarl,sas,sass,satch,sc,scala,scaml,scheme,scila,scm,scss,shell-session,silver,slash,slim,sls,slurm,smali,smalltalk,smarty,sml,snool,sources.list,sourceslist,sp,sparql,spec,spit,splus,sql,sqlite3,squeak,squidcon,st,st-pytex,stan,stata,supercollider,sv,swi,swig,systemverilog,t-sql,tads3,tap,tasm,tcl,tcsh,tcshcon,tea,teraterm,teratermmacro,termcap,termin,terra,thri,todotxt,toml,tra,trac-wiki,treetop,ts,tsql,ttl,turtle,twig,typescript,typoscript,typoscriptcssdata,typoscripthtmldata,ucode,ugs,unicon,uriscript,v.net,vala,vapi,vcl,vclsnippet,vclsnippets,vctreestatus,velocity,vgl,vhdl,vim,vnet,vscript,wdi,whiley,winatch,winugs,x10,xml,xml+cheetah,xml+django,xml+er,xml+evoque,xml+genshi,xml+jinja,xml+kid,xml+lasso,xml+mako,xml+myghty,xml+php,xml+ruy,xml+smarty,xml+spit,xorg,xq,xql,xqm,xquery,xqy,xten,xtend,yaml,yaml+jinja}\n                        Manually set a lexer to use on all files\n  --wildcard_token {Token.Keyword,Token.Keyword.Constant,Token.Keyword.Declaration,Token.Keyword.Namespace,Token.Keyword.Pseudo,Token.Keyword.Reserved,Token.Keyword.Type,Token.Name,Token.Name.Attribute,Token.Name.Builtin,Token.Name.Builtin.Pseudo,Token.Name.Class,Token.Name.Constant,Token.Name.Decorator,Token.Name.Entity,Token.Name.Exception,Token.Name.Function,Token.Name.Function.Magic,Token.Name.Label,Token.Name.Namespace,Token.Name.Other,Token.Name.Tag,Token.Name.Variable,Token.Name.Variable.Class,Token.Name.Variable.Global,Token.Name.Variable.Instance,Token.Name.Variable.Magic,Token.Literal,Token.Literal.Date,Token.Literal.String,Token.Literal.String.Affix,Token.Literal.String.Backtick,Token.Literal.String.Char,Token.Literal.String.Delimiter,Token.Literal.String.Doc,Token.Literal.String.Double,Token.Literal.String.Escape,Token.Literal.String.Heredoc,Token.Literal.String.Interpol,Token.Literal.String.Other,Token.Literal.String.Regex,Token.Literal.String.Single,Token.Literal.String.Symbol,Token.Literal.Number,Token.Literal.Number.Bin,Token.Literal.Number.Float,Token.Literal.Number.Hex,Token.Literal.Number.Integer,Token.Literal.Number.Integer.Long,Token.Literal.Number.Oct,Token.Operator,Token.Operator.Word,Token.Punctuation,Token.Comment,Token.Comment.Hashbang,Token.Comment.Multiline,Token.Comment.Preproc,Token.Comment.Single,Token.Comment.Special,Token.Generic,Token.Generic.Deleted,Token.Generic.Emph,Token.Generic.Error,Token.Generic.Heading,Token.Generic.Inserted,Token.Generic.Output,Token.Generic.Prompt,Token.Generic.Strong,Token.Generic.Subheading,Token.Generic.Traceback,Token.Text.Whitespace}\n                        Token types that are threated as wildcards (actual\n                        value doesn't matter)\n  --verbose             Verbose output\n  --nodetails           Dump the details of a finding\n```\n\nBy default tool guesses the content type by the filename, if that doesn't work for you please see below\n\n### Specify a lexer\n\nYou can use a specific lexer by running the tool with the **--lexer=** option.\nWhen doing this all input files are processed by the specified lexer, you have to ensure that all passed files are of the specified file, else the results might be bogus.\n\n## Output\n\nOutput will be written to stdout.\nThere are 2 possible finding types\n\n* Duplicate - The code is exactly the same\n* TooLessVariation - The code is the same, when removing all token types specified by --wildcard_token\n\n### Output example\n\n```shell\n/someplace/busybox/modutils/modutils.c:9:0:[TooLessVariation]:Block till 16:0 is nearly the same as in ../modprobe-small.c from 29:0 till 36:0\n>>> #include <sys/syscall.h>\n>>> \n>>> #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)\n>>> #if defined(__NR_finit_module)\n>>> # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)\n>>> #endif\n>>> #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)\n>>> \n<<<\n>>> #include <sys/syscall.h>\n>>> \n>>> #define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)\n>>> #define delete_module(mod, flags) syscall(__NR_delete_module, mod, flags)\n>>> #ifdef __NR_finit_module\n>>> # define finit_module(fd, uargs, flags) syscall(__NR_finit_module, fd, uargs, flags)\n>>> #endif\n>>> \n<<<\n/someplace/busybox/modutils/modutils.c:165:32:[Duplicate]:Block till 169:3 is the same as in ../modprobe-small.c from 324:18 till 327:0\n>>> \n>>> \tfstat(fd, &st);\n>>> \timage = NULL;\n>>> \t/* st.st_size is off_t, we can't just pass it to mmap */\n>>> \tif\n<<<\n/someplace/busybox/modutils/modprobe-small.c:236:15:[Duplicate]:Block till 240:10 is the same as in ../modutils.c from 265:26 till 269:10\n>>> \n>>> \tcase ENOEXEC:\n>>> \t\treturn \"invalid module format\";\n>>> \tcase ENOENT:\n>>> \t\treturn \"\n<<<\n/someplace/busybox/modutils/modutils.c:115:0:[Duplicate]:Block till 130:43 is the same as in ../modprobe-small.c from 177:0 till 194:36\n>>> \n>>> #if ENABLE_FEATURE_CMDLINE_MODULE_OPTIONS\n>>> char* FAST_FUNC parse_cmdline_module_options(char **argv, int quote_spaces)\n>>> {\n>>> \tchar *options;\n>>> \tint optlen;\n>>> \n>>> \toptions = xzalloc(1);\n>>> \toptlen = 0;\n>>> \twhile (*++argv) {\n>>> \t\tconst char *fmt;\n>>> \t\tconst char *var;\n>>> \t\tconst char *val;\n>>> \n>>> \t\tvar = *argv;\n>>> \t\toptions = xrealloc(options, optlen + 2 + \n<<<\n```\n\nif you don't want to see the code itself, pass the **--nodetails** option\n\n## Further reading\n\n* [Pygments](http://pygments.org/)\n\n## Bugs & Contribution\n\nFeel free to create issues or pull requests\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "-- Too less variation -- Find duplicates in source code for various languages",
    "version": "1.5.3",
    "project_urls": {
        "Homepage": "https://github.com/priv-kweihmann/tlv"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b3d8bc0165ef40d7d4ae4b3304f4838a7cc645b82ce2850d3e382dee8b3cc5c",
                "md5": "32aece5d886287d40b9cf82f1ddffed1",
                "sha256": "c9bbfde00db660fc8a3d1c3895f3b849ea8989f42d51fd84ec93415b00cf01de"
            },
            "downloads": -1,
            "filename": "tlv-1.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "32aece5d886287d40b9cf82f1ddffed1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 13520,
            "upload_time": "2024-05-06T11:28:31",
            "upload_time_iso_8601": "2024-05-06T11:28:31.728879Z",
            "url": "https://files.pythonhosted.org/packages/5b/3d/8bc0165ef40d7d4ae4b3304f4838a7cc645b82ce2850d3e382dee8b3cc5c/tlv-1.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8eae6a2060d5361acfeda9aff0db256d85b5a23e2dba7bb08e22fe26ef47f7fe",
                "md5": "907dc91c34e3ff7e1e70906cfe5cbc07",
                "sha256": "226568e832d8862364f0752535b981c306ff8dbfdb85e3578eb0390a3a32661a"
            },
            "downloads": -1,
            "filename": "tlv-1.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "907dc91c34e3ff7e1e70906cfe5cbc07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 17182,
            "upload_time": "2024-05-06T11:28:33",
            "upload_time_iso_8601": "2024-05-06T11:28:33.024100Z",
            "url": "https://files.pythonhosted.org/packages/8e/ae/6a2060d5361acfeda9aff0db256d85b5a23e2dba7bb08e22fe26ef47f7fe/tlv-1.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-06 11:28:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "priv-kweihmann",
    "github_project": "tlv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "Pygments",
            "specs": [
                [
                    "~=",
                    "2.18"
                ]
            ]
        },
        {
            "name": "chardet",
            "specs": [
                [
                    "~=",
                    "5.2"
                ]
            ]
        }
    ],
    "lcname": "tlv"
}
        
Elapsed time: 0.25654s