-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
a:bugPMD crashes or fails to analyse a file.PMD crashes or fails to analyse a file.in:cpdAffects the copy-paste detectorAffects the copy-paste detector
Milestone
Description
cpd stopped working after I migrated the source code to Swift 4.
The problem: pmd cpd quits with an exception.
A full command showcasing the problem:
pmd cpd --language swift --minimum-tokens 50 --files source.swift
Result of running the command above:
net.sourceforge.pmd.lang.ast.TokenMgrError: Lexical error in file <path to file> at line 62, column 60. Encountered: token recognition error at: '\.'
at net.sourceforge.pmd.cpd.SwiftTokenizer.tokenize(SwiftTokenizer.java:48)
at net.sourceforge.pmd.cpd.CPD.addAndThrowLexicalError(CPD.java:142)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:137)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:107)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:69)
at net.sourceforge.pmd.cpd.CPD.addDirectory(CPD.java:79)
at net.sourceforge.pmd.cpd.CPD.addRecursively(CPD.java:64)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.addSourcesFilesToCPD(CPDCommandLineInterface.java:125)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.addSourceFilesToCPD(CPDCommandLineInterface.java:105)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.main(CPDCommandLineInterface.java:83)
at net.sourceforge.pmd.cpd.CPD.main(CPD.java:177)
The line of code for which cpd throws an exception is:
let observation = scrollView.observe(\.contentOffset, options: .new) { [weak self] (scrollView, _) in
Aparently cpd cannot handle the new Swift 4 syntax for KeyPath, which is \.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a:bugPMD crashes or fails to analyse a file.PMD crashes or fails to analyse a file.in:cpdAffects the copy-paste detectorAffects the copy-paste detector