A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/678 below:

[swift][cpd] Exception when running for Swift 4 code (KeyPath) · Issue #678 · pmd/pmd · GitHub

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 \.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4