Inspector
|
- |
constructor
|
- |
inherits from EventEmitter
|
- |
accepts an array of file paths
|
- |
assigns a default threshold of 30
|
- |
accepts an options object
|
- |
run
|
- |
emits a start event
|
- |
emits an end event
|
- |
emits the "match" event when a match is found
|
- |
can find an exact match between instances
|
- |
can find the largest match between two instances
|
- |
supports ES6
|
- |
supports JSX
|
- |
supports Flow
|
- |
includes the lines with the match
|
- |
ignores matches with less than the supplied minimum
|
- |
ignores CommonJS require statements
|
- |
ignores AMD define expressions
|
- |
Match
|
- |
has a hash based on the node types
|
- |
stores instance objects containing filename, start and end
|
- |
uses the minimum start value of nodes in an instance
|
- |
populateLines
|
- |
adds the relevant source lines as a prop to each instance
|
- |
NodeUtils
|
- |
walkSubtrees
|
- |
walks each child node using DFS
|
- |
getDFSTraversal
|
- |
returns the DFS traversal of the AST
|
- |
getBFSTraversal
|
- |
returns the BFS traversal of the AST
|
- |
getChildren
|
- |
returns the children of a Node
|
- |
ignores null children
|
- |
ignores empty JSXText nodes
|
- |
isBefore
|
- |
given nodes with different line numbers
|
- |
returns true if the first node has a lower line number
|
- |
returns false if the first node has a higher numbered line
|
- |
given nodes with the same line number
|
- |
returns true if the first node has a lower column number
|
- |
returns false if the first node has a higher column number
|
- |
isES6ModuleImport
|
- |
returns true for an import declaration
|
- |
returns false for export declaration
|
- |
returns false otherwise
|
- |
isAMD
|
- |
returns true for an expression containing a define
|
- |
returns true for an expression containing a define
|
- |
returns true even if the function is a property
|
- |
returns true even if a nested property
|
- |
returns false otherwise
|
- |
isCommonJS
|
- |
returns true for an expression containing a require
|
- |
returns true for a declaration containing a require
|
- |
returns false otherwise
|
- |
typesMatch
|
- |
returns true if all node types match
|
- |
returns false if not all node types match
|
- |
identifiersMatch
|
- |
returns true if all node are matching identifiers
|
- |
returns false if not all node names match
|
- |
literalsMatch
|
- |
returns true if all literals have the same value
|
- |
returns false if not all literals have the same value
|
- |
treats JSXText as a literal
|
- |
ignores the values of nodes which are not literals
|
- |
parse
|
- |
on error
|
- |
includes the filename of the file that failed to parse
|
- |
includes a caret pointing to the unexpected token
|
- |
does not include the src line if longer than 100 chars
|
- |
BaseReporter
|
- |
constructor
|
- |
accepts an inspector as an argument
|
- |
registers a listener for the match event
|
- |
given a match
|
- |
increments the number found
|
- |
invokes _getOutput
|
- |
summary
|
- |
can be printed on inspector end
|
- |
prints the correct results if no matches were found
|
- |
prints the correct results if matches were found
|
- |
DefaultReporter
|
- |
constructor
|
- |
accepts an inspector as an argument
|
- |
prints the summary on end
|
- |
given a match
|
- |
prints the instances
|
- |
JSONReporter
|
- |
constructor
|
- |
accepts an inspector as an argument
|
- |
prints valid json
|
- |
given a match
|
- |
prints the instances and their location
|
- |
can write to a custom stream
|
- |
PMDReporter
|
- |
constructor
|
- |
accepts an inspector as an argument
|
- |
given a match
|
- |
prints paths and line numbers in a duplication element
|
- |